GitHub MCP Server
Allows interaction with GitHub repositories, including listing repos, reading files, managing pull requests and issues, searching code, and retrieving repository metadata.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@GitHub MCP ServerList my repositories"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
GitHub MCP Server
A Model Context Protocol (MCP) server that connects Claude to your GitHub repositories. Query repos, review PRs, manage issues, search code, and automate GitHub workflows—all from Claude.
Features
Included Tools
list_repos — List your repositories with metadata (stars, language, etc.)
read_file — Read files from any repo (source code, docs, configs)
list_prs — Fetch pull requests with filtering (open/closed/all)
get_pr — Get PR details including full diff for code review
list_issues — Search and filter issues by state, labels, etc.
create_issue — File new issues programmatically
add_pr_comment — Add review comments to pull requests
search_code — Search code across repos using GitHub search syntax
get_repo_info — Fetch repo metadata (description, stars, topics, etc.)
Related MCP server: PR Reviewer MCP Server
Quick Start
1. Set Up Authentication
Create a GitHub Personal Access Token:
Click Generate new token → Generate new token (fine-grained)
Name it
claude-mcpUnder Repository access, select All repositories or specific repos
Under Permissions, grant:
Contents: Read-only
Issues: Read & write (if you want to create issues)
Pull requests: Read & write (if you want to comment on PRs)
Click Generate token and copy it
2. Install Dependencies
cd /Users/maywu/Projects/github-mcp-server
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt3. Set Your GitHub Token
cp .env.example .env
# Edit .env and paste your token:
# GITHUB_TOKEN=ghp_xxxxxOr set it directly:
export GITHUB_TOKEN="your_github_pat_here"4. Connect to Claude Code
# From the project root:
claude mcp add --env GITHUB_TOKEN="your_github_pat_here" \
--transport stdio github \
-- python server.pyVerify it connected:
claude mcp listYou should see: ✓ github — 9 tools
Usage
Once connected, you can ask Claude to:
List my repositoriesReview PR #456 and suggest improvements for anthropic/claude-codeCreate an issue for the bug we just found in my-repoFind all instances of TODO comments in my codebaseRead the CONTRIBUTING.md from owner/repoList all open issues labeled 'bug' and 'critical' in my-org/my-repoLocal Development & Testing
Run the server directly (for debugging)
export GITHUB_TOKEN="your_token"
python server.pyYou should see:
INFO:mcp.server:Started MCP serverIf there are errors, you'll see them here.
Test a tool manually
Once connected to Claude Code, run:
claudeThen in the session:
Use the github server to list my repos and show me the 5 most recently updated onesClaude will call the list_repos tool and display results.
Common Issues
"Error: GITHUB_TOKEN environment variable not set"
Make sure your token is exported:
echo $GITHUB_TOKENIf using Claude, pass it with
--env:claude mcp add --env GITHUB_TOKEN="token" ...
"Error: Unauthorized (401)"
Your token may have expired or insufficient permissions
Generate a new token at github.com/settings/personal-access-tokens
Check that the token has Contents and Issues scopes enabled
"Timeout connecting to server"
The server may be crashing on startup. Run it directly to see errors:
python server.pyTry increasing the timeout:
MCP_TIMEOUT=60000 claude
Architecture
Server Structure
server.py
├── list_tools() — Define all available tools
├── call_tool() — Route tool calls to handlers
└── _<tool_name>() — Handler for each tool (async)Adding New Tools
To add a new GitHub operation:
Add the tool definition in
list_tools():
Tool(
name="my_new_tool",
description="What this tool does",
inputSchema={
"type": "object",
"properties": {...},
"required": [...]
}
)Add a handler function:
async def _my_new_tool(arguments: dict) -> list[ToolResult]:
# Your implementation here
return [ToolResult(content=[TextContent(text="result")])]Add a route in
call_tool():
elif name == "my_new_tool":
return await _my_new_tool(arguments)GitHub API Limits
Authenticated requests: 5,000/hour
Unauthenticated: 60/hour
This server always uses your token, so you get the 5,000/hour limit.
Security
Never commit your
.envfile or tokens to version controlUse fine-grained personal access tokens (not classic tokens)
Scope tokens to minimal required permissions
Rotate tokens regularly
If a token is leaked, revoke it immediately at github.com/settings/personal-access-tokens
Troubleshooting
Check server status
claude mcp listShould show:
github (stdio)
✓ Connected
9 tools availableView server logs
If running in Claude Code, check the MCP logs:
claude mcp logs githubTest the API directly
curl -H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/user/reposNext Steps
Share with teammates: Commit
.env.exampleandserver.pyto a project repo, have teammates set their ownGITHUB_TOKENDeploy as a service: Run on a server and use
--transport httpinstead ofstdioAdd more tools: Extend with webhooks, actions, releases, discussions, etc.
Integrate with workflows: Build Claude-assisted code review, release notes generation, or issue triage
Resources
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Access the GitHub API, enabling file operations, repository management, search functionality, and…
Connect AI assistants to your GitHub-hosted Obsidian vault to seamlessly access, search, and analy…
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceConnects Claude Desktop to GitHub repositories, enabling users to perform git operations and GitHub API interactions through natural conversation.256 npm-
- FlicenseAqualityDmaintenanceConnects Claude to GitHub, enabling listing repositories, browsing open pull requests, and inspecting PR diffs for code review.4-
- FlicenseNot gradedqualityDmaintenanceEnables to interact with GitHub repositories directly from Claude, supporting actions like viewing repos, checking status, committing and pushing changes, and managing pull requests.-
- FlicenseAqualityDmaintenanceEnables Claude to access and manage GitHub repositories dynamically at runtime, including private repos, with tools for browsing files, searching code, and viewing commits, pull requests, and issues.111-