github-mcp
An MCP (Model COntext Protocol) server that gives AI assistants direct access to GitHub. Exposing ~22 GitHub REST tools covering repos, files, issues, pull requests, as well as searching.
Table of Contents
Features
A single stdio MCP server (built on FastMCP) exposing 23 GitHub REST tools grouped into four areas:
- Repositories & files —
github_list_repos,github_get_repo,github_list_branches,github_list_commits,github_get_file_contents,github_list_directory,github_create_or_update_file,github_create_branch - Issues —
github_list_issues,github_get_issue,github_create_issue,github_update_issue,github_add_issue_comment - Pull requests —
github_list_pull_requests,github_get_pull_request,github_create_pull_request,github_merge_pull_request,github_add_pr_comment - Search —
github_search_repositories,github_search_code,github_search_issues,github_search_users,github_search_commits
Under the hood:
- Async HTTP via a shared, lazily-initialised
httpx.AsyncClientagainst the pinned GitHub API version (2022-11-28). - Automatic pagination — list endpoints follow the
Link: rel="next"header up to a configurable item cap. - Typed inputs — every tool validates its arguments with Pydantic models.
- Actionable errors — common GitHub failures (401, 403/rate-limit with reset time, 404, 409, 422, timeouts) are translated into clear, human-readable messages.
- Flexible auth — reads a fine-grained PAT from
GITHUB_TOKEN, falling back toGITHUB_PAT.
Installation
Prerequisites
Python 3.12or later- Dependencies
mcp[cli]>=1.0.0,httpx>=0.27.0,pydantic>=2.0.0(see pyproject.toml) (project usespoetryfor dependency management)
Install from PyPi
pip install github-mcp
# or using poetry
poetry add github-mcp
Build from source
git clone https://github.com/LWaetzig/github-mcp.git
cd github-mcp
pip install -e .
Usage
- Detailed documentation about single tools can be found this sphinx documentation
Prerequisites
Create a fine-grained Personal Access Token (PAT)
- Go to GitHub -> Settings -> Developer settings -> Personal access tokens -> Fine-grained tokens (direct link: https://github.com/settings/tokens?type=beta)
- Generate new token
- Set Resource owner and Repository access as appropriate
- Grant these Repository permissions (minimum for full read + write):
| Permission | Access level | Used by tools |
|---|---|---|
| Metadata | Read-only | All tools |
| Contents | Read and write | github_get_file_contents, github_list_directory, github_list_commits, github_create_or_update_file, github_create_branch |
| Issues | Read and write | github_list_issues, github_get_issue, github_create_issue, github_update_issue, github_add_issue_comment |
| Pull requests | Read and write | github_list_pull_requests, github_get_pull_request, github_create_pull_request, github_merge_pull_request, github_add_pr_comment |
Read-only subset: grant only Read-only access to Contents, Issues, Pull requests, and Metadata if you don't need write tools.
export GITHUB_TOKEN=github_pat_...
Or copy .env.example -> .env and fill in the token (load with source .env).
Integrating with Claude Desktop
Add the server to your Claude Desktop configuration:
| Platform | Path |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
Add the github entry under mcpServers, replacing the path with the absolute path to your clone:
{
"mcpServers" : {
"github" : {
"command" : "python",
"args" : ["-m", "github-mcp"],
"env" : {
"GITHUB_TOKEN" : "github_pat_..."
}
}
}
}
Restart Claude Desktop. You should see the github tools available int he tool picker.
Integration with Other MCP Clients
Any MCP client (e.g. Cline, GitHub Copilot, or custm tools) can use this server.
Configuration depends on your assistant, in most cases there is a config to change.
Contribution
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/your-feature) - Commit your changes with clear messages
- Push to your fork
- Open a pull request
Live testing with MCP Inspector (requires a real token)
GITHUB_TOKEN=...
npx @modelcontextprotocol/inspector
uv run github-mcp
Then call github_search_repositories (q="mcp language:python") or github_get_repo (owner="modelcontextprotocol", repo="python-sdk") to verify auth,
pagination, and formatting end-to-end.
Upcoming Features
- Projects v2: Requires GitHub's GraphQL API (
/graphql). Add agraphql_client.pyalongsideclient.pyand a newtools/projects.pymodule. - Actions: Also REST-based but with many endpoints. Add
tools/actions.pyimporting fromclient.py.
Metadata
Release files for github-mcp 1.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| github_mcp-1.1.2.tar.gz | 22.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| github_mcp-1.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 49.1 kB
Release files / github_mcp-1.1.2.tar.gz
| Download URL | github_mcp-1.1.2.tar.gz |
|---|---|
| Size | 22.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a0f873ef7de89855f962919e50ec800f27efaa2d40455716374ba16525e049cc
|
|
BLAKE2b-256 checksum How to use checksums |
c94244eb5a9c7151feab1760c8b63996517a5a7568650142ea97724ea923f099
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
poetry/2.3.2 CPython/3.12.13 Linux/6.8.0-1057-raspi
|
Release files / github_mcp-1.1.2-py3-none-any.whl
| Download URL | github_mcp-1.1.2-py3-none-any.whl |
|---|---|
| Size | 26.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3b21fd70e454e3f019c524a3d28248d92a8d27420d656c269d1658201bf7264f
|
|
BLAKE2b-256 checksum How to use checksums |
90a0fc88800731779de105804b1240ad68e4ea0ca9db4fe9e2bceb37254e650a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
poetry/2.3.2 CPython/3.12.13 Linux/6.8.0-1057-raspi
|