Overview
Connect to GitHub repositories, files, issues, and more.
Setup
Run with npx:
npx -y @modelcontextprotocol/server-githubConfiguration
export GITHUB_PERSONAL_ACCESS_TOKEN=<your-token>Documentation
GitHub MCP Server
Overview
Connect to GitHub repositories, files, issues, and more through the Model Context Protocol.
Installation
Quick Setup
npx -y @modelcontextprotocol/server-github
Claude Desktop Configuration
Add to your claude_desktop_config.json:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "your-token-here"
}
}
}
}
Setup
-
Create a GitHub Personal Access Token
- Go to GitHub Settings > Developer settings > Personal access tokens
- Generate a new token with appropriate scopes
- Recommended scopes:
repo,read:org,read:user
-
Configure the MCP Server
- Set the
GITHUB_PERSONAL_ACCESS_TOKENenvironment variable - Restart your AI application
- Set the
Available Tools
| Tool | Description |
|---|---|
search_repositories | Search for GitHub repositories. |
get_file_contents | Get contents of a file or directory. |
create_issue | Create a new issue. |
create_pull_request | Create a new pull request. |
list_issues | List issues in a repository. |
get_issue | Get details of a specific issue. |
update_issue | Update an existing issue. |
list_pull_requests | List pull requests in a repository. |
get_pull_request | Get details of a specific pull request. |
create_pull_request_review | Create a review on a pull request. |
merge_pull_request | Merge a pull request. |
list_branches | List branches in a repository. |
list_commits | List commits in a repository. |
get_commit | Get details of a specific commit. |
compare_commits | Compare two commits or branches. |
Usage Examples
Search for Repositories
{
"name": "search_repositories",
"arguments": {
"query": "langgraph",
"sort": "stars",
"order": "desc"
}
}
Get File Contents
{
"name": "get_file_contents",
"arguments": {
"owner": "langchain-ai",
"repo": "langgraph",
"path": "README.md"
}
}
Create an Issue
{
"name": "create_issue",
"arguments": {
"owner": "my-org",
"repo": "my-repo",
"title": "Bug report",
"body": "Description of the bug...",
"labels": ["bug"]
}
}
Security Notes
- Never commit tokens - Keep your GitHub token secure.
- Use minimal scopes - Only request the permissions you need.
- Rotate tokens regularly - Update your token periodically.
- Use fine-grained tokens - For better security, use fine-grained PATs.
