A Model Context Protocol (MCP) server that connects AI clients like Claude Desktop directly to the GitHub REST API — letting the AI search repositories, read and create issues, inspect pull requests, browse commits, and read file contents without leaving the chat.
The Model Context Protocol is an open standard that lets AI applications talk to external tools and data sources through a common interface. This server implements the protocol over stdio transport, meaning it runs as a local process that Claude Desktop (or any other MCP client) spawns and communicates with via stdin/stdout.
| Tool | Description |
|---|---|
get_authenticated_user |
Returns the profile of the logged-in GitHub user |
search_repositories |
Search GitHub repos by keyword, sortable by stars/forks/updated |
get_repository |
Fetch metadata (stars, forks, topics, license) for any repo |
list_issues |
List open/closed issues with optional label filtering |
get_issue |
Fetch full details and body for a single issue |
create_issue |
Create a new issue with title, body, and labels |
update_issue |
Edit title/body, open/close, or relabel an issue |
list_pull_requests |
List PRs by state (open/closed/all) |
get_pull_request |
Full PR details including diff stats and mergeable status |
list_pr_files |
Every file changed in a PR with additions/deletions |
get_file_contents |
Read any file from a repo at any branch/commit |
list_repository_commits |
Recent commits on any branch with messages and authors |
- Python 3.11 or higher
- A GitHub Personal Access Token
- For public repos: no scopes needed
- For private repos / creating issues: enable the
reposcope
# 1. Clone the repository
git clone https://github.com/yourusername/github-mcp-server.git
cd github-mcp-server
# 2. Create and activate a virtual environment (recommended)
python3 -m venv .venv
source .venv/bin/activate # macOS / Linux
# .venv\Scripts\activate # Windows
# 3. Install dependencies
pip install -r requirements.txtExport your GitHub token before running the server:
export GITHUB_TOKEN=ghp_your_token_hereOr add it to your shell profile (~/.zshrc, ~/.bashrc) so it persists.
python src/github_mcp/server.pyThe server will start and wait for MCP messages on stdin. You won't see output here — connect it through Claude Desktop instead.
- Open Claude Desktop → Settings → Developer → Edit Config
- Add this block to
claude_desktop_config.json:
{
"mcpServers": {
"github": {
"command": "python3",
"args": ["/absolute/path/to/github-mcp-server/src/github_mcp/server.py"],
"env": {
"GITHUB_TOKEN": "ghp_your_token_here"
}
}
}
}- Save and restart Claude Desktop.
- You should now see the GitHub tools available in the tools panel (🔧 icon).
"Search for the top 5 Python MCP server projects on GitHub"
"List all open bugs in the facebook/react repository"
"Show me the last 10 commits on the main branch of vercel/next.js"
"Read the contents of the README.md file from torvalds/linux"
"Create an issue in my repo called 'Fix login button on mobile' with the label 'bug'"
"Get the details of PR #42 in microsoft/vscode and summarise the changes"
github-mcp-server/
├── src/
│ └── github_mcp/
│ ├── __init__.py
│ └── server.py ← All tools live here
├── tests/
│ └── test_server.py
├── requirements.txt
├── pyproject.toml
└── README.md
pip install pytest pytest-mock
pytest tests/ -vClaude Desktop ──stdio──► github-mcp-server ──HTTPS──► api.github.com
(MCP client) (this project) (GitHub REST API)
- Claude Desktop spawns this script as a subprocess.
- They communicate via JSON-RPC messages over stdin/stdout (the MCP protocol).
- When Claude wants to call a tool (e.g.
search_repositories), it sends a tool-call message. - This server receives it, calls the GitHub REST API with your token, and returns the result.
- Claude uses the result to compose its response.
- Your GitHub token is never sent to Anthropic — it only leaves your machine to reach
api.github.comdirectly. - Use a token with the minimum scopes your use case requires.
- Treat your token like a password; don't commit it to source control.
Pull requests are welcome! Ideas for new tools:
- Create and merge pull requests
- Add PR review comments
- Manage repository labels and milestones
- List GitHub Actions workflow runs
- Star / unstar repositories
MIT — see LICENSE for details.