Local GitHub MCP server exposing GitHub REST API via FastMCP stdio transport
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file github_mcp-1.1.1.tar.gz.
File metadata
- Download URL: github_mcp-1.1.1.tar.gz
- Upload date:
- Size: 22.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: poetry/2.3.2 CPython/3.12.13 Linux/6.8.0-1057-raspi
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b8c040f155dc81c6da2bb50e7aad20d51c32fa0a6514a8cb2cfd56a66c1197e
|
|
| MD5 |
312e9e4e8c2c21d21d3548d0c62e32d0
|
|
| BLAKE2b-256 |
7d40e6ac4c3893eddd923efa28b92b16295491d8d58e246db0f68528a583305e
|
File details
Details for the file github_mcp-1.1.1-py3-none-any.whl.
File metadata
- Download URL: github_mcp-1.1.1-py3-none-any.whl
- Upload date:
- Size: 26.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: poetry/2.3.2 CPython/3.12.13 Linux/6.8.0-1057-raspi
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd70ad7d58e9f36753f90a372c3b03ee02420482024fe50989961d57082b26da
|
|
| MD5 |
6871c5b4accf820bb40abd613d3e9306
|
|
| BLAKE2b-256 |
3ecc43d9ade8c87ab00edd505e100a264c9aa66a81433bfa91388a563084e3e5
|