A Model Context Protocol (MCP) connector for GitHub, for use with Claude.
Project description
GitHub MCP Connector
A Model Context Protocol (MCP) server that connects Claude to GitHub. It exposes a focused set of GitHub REST API operations as MCP tools, so Claude (Desktop, Code, or any MCP client) can read repositories, browse files and commit history, triage issues, review pull requests, and—optionally—open issues and post comments.
It's a small, dependency-light Python package (mcp + httpx) that you point
at a GitHub token. It supports both stdio (the default for Claude Desktop/Code)
and streamable HTTP transports, and works against github.com or GitHub
Enterprise Server.
Features
- 🔍 Search repositories, issues/PRs, and code with GitHub's query syntax
- 📦 Repositories — metadata, branches, file contents, directory listings, your repo list
- 🧾 Commits — history, single-commit detail, and diffs between refs
- 🐛 Issues — list, read, create, comment, and edit/close
- 🔀 Pull requests — list, read, fetch diffs/changed files, open new PRs, and merge
- ⚙️ Actions & releases — list workflow runs and releases
- ✍️ Repo writes — create branches and commit files (gated by read-only mode)
- 🔒 Read-only mode — flip one env var to disable every write tool
- 🏢 Enterprise-friendly — set
GITHUB_API_URLfor GitHub Enterprise Server
Tools
| Tool | Description | Write |
|---|---|---|
get_authenticated_user |
Identity/health check for the configured token | |
list_my_repositories |
List repos the token can access | |
search_repositories |
Search repositories by query | |
get_repository |
Repository metadata | |
list_branches |
Branches with head commit SHAs | |
get_file_contents |
Read a file (decoded) or list a directory | |
list_commits |
Recent commits, optional branch/path filter | |
get_commit |
A single commit with stats and changed files | |
compare_commits |
Diff/ahead-behind between two refs | |
list_issues |
Issues by state/labels | |
get_issue |
A single issue with full body | |
list_pull_requests |
Pull requests by state | |
get_pull_request |
A single PR with body and merge status | |
get_pull_request_diff |
Unified diff for a PR (truncated) | |
list_pull_request_files |
Files changed in a PR | |
list_workflow_runs |
Recent GitHub Actions runs | |
list_releases |
Releases for a repository | |
search_issues |
Search issues and PRs across GitHub | |
search_code |
Search code across GitHub | |
create_pull_request |
Open a new pull request (supports draft) | ✅ |
merge_pull_request |
Merge a PR (merge/squash/rebase) | ✅ |
create_issue |
Open a new issue | ✅ |
update_issue |
Edit/close/reopen an issue | ✅ |
add_issue_comment |
Comment on an issue or PR | ✅ |
create_branch |
Create a branch from a ref | ✅ |
delete_branch |
Delete a branch | ✅ |
create_or_update_file |
Commit a file (create or update) | ✅ |
Tools marked Write are disabled when GITHUB_MCP_READ_ONLY is set.
Requirements
- Python 3.10+
- A GitHub personal access token. The connector applies no repository
restrictions of its own — it can reach exactly the repositories your token
can, so token scope is what controls access:
- All your repositories (recommended for general use): create a classic
PAT with the
reposcope, or a fine-grained PAT whose "Repository access" is set to All repositories. This lets the connector see every repo your account can access (public and private). - Only specific repositories: use a fine-grained PAT and select just those repos under "Repository access".
- Permissions: read access is enough for the read tools; to use the write
tools (
create_issue,add_issue_comment) the token also needs issue write access (classic:repo; fine-grained: Issues → Read and write).
- All your repositories (recommended for general use): create a classic
PAT with the
Install from PyPI (recommended)
The connector is published to PyPI as
github-mcp-connector, so you
can install or run it by name — no clone, no git, no build step. This is the
most reliable option on Windows, where launching from a git URL requires Git on
the spawned process's PATH.
uvx github-mcp-connector # run on demand with uv (nothing to install)
pipx run github-mcp-connector # same, with pipx
pip install github-mcp-connector # or install it permanently
Wire it into Claude by pointing the command at the published package:
Claude Code:
claude mcp add-json github '{
"command": "uvx",
"args": ["github-mcp-connector"],
"env": { "GITHUB_TOKEN": "github_pat_your_token_here" }
}'
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"github": {
"command": "uvx",
"args": ["github-mcp-connector"],
"env": { "GITHUB_TOKEN": "github_pat_your_token_here" }
}
}
}
On Windows, use the full path to uvx.exe (run where.exe uvx to find it), e.g.
C:\\Users\\you\\.local\\bin\\uvx.exe.
Quick start (no clone, no venv)
If the package isn't published yet (or you want to track an unreleased commit),
uvx can also fetch, build, and run the connector straight from GitHub. This
path requires Git to be available to the process that launches it.
Claude Code — one command:
claude mcp add-json github '{
"command": "uvx",
"args": ["--from", "git+https://github.com/winnerlose2026/Github-mcp.git", "github-mcp"],
"env": { "GITHUB_TOKEN": "github_pat_your_token_here" }
}'
Add --scope user to make it available in every project. Verify with
claude mcp list (should show github connected).
Claude Code — project-scoped, shareable: this repo ships a .mcp.json
that reads GITHUB_TOKEN from your environment. Drop the same file in any project
(or copy it from here), export your token, and Claude Code auto-detects it:
export GITHUB_TOKEN=github_pat_your_token_here
claude # prompts once to approve the project MCP server
Claude Desktop: point the command at uvx so there's no interpreter path to
manage:
{
"mcpServers": {
"github": {
"command": "uvx",
"args": ["--from", "git+https://github.com/winnerlose2026/Github-mcp.git", "github-mcp"],
"env": { "GITHUB_TOKEN": "github_pat_your_token_here" }
}
}
}
Prefer pipx? pipx run --spec git+https://github.com/winnerlose2026/Github-mcp.git github-mcp
works the same way; use that as the command/args instead.
Installation (from source)
For development, or if you don't use uv/pipx:
git clone https://github.com/winnerlose2026/Github-mcp.git
cd Github-mcp
python -m venv .venv && source .venv/bin/activate
pip install -e .
Or, without installing, from the repo root:
pip install -r requirements.txt
python -m github_mcp
Configuration
All configuration comes from environment variables (see .env.example):
| Variable | Required | Default | Description |
|---|---|---|---|
GITHUB_TOKEN |
yes | — | GitHub token. GITHUB_PERSONAL_ACCESS_TOKEN and GH_TOKEN are also accepted. |
GITHUB_API_URL |
no | https://api.github.com |
API root; set for GitHub Enterprise Server (e.g. https://ghe.example.com/api/v3). |
GITHUB_MCP_READ_ONLY |
no | false |
When truthy, disables all write tools. |
GITHUB_MCP_TIMEOUT |
no | 30 |
Per-request timeout in seconds. |
GITHUB_MCP_USER_AGENT |
no | github-mcp-connector |
User-Agent header sent to GitHub. |
Connecting to Claude (from-source install)
If you installed from source (above) instead of using uvx/pipx, configure
the client to run the package directly.
Claude Desktop
Add the server to claude_desktop_config.json (Settings → Developer → Edit
Config):
{
"mcpServers": {
"github": {
"command": "python",
"args": ["-m", "github_mcp"],
"env": {
"GITHUB_TOKEN": "ghp_your_token_here"
}
}
}
}
Use the absolute path to the Python interpreter from the virtualenv where you
installed the package (e.g. /path/to/Github-mcp/.venv/bin/python), or the
github-mcp console script directly. Restart Claude Desktop after editing.
Claude Code
claude mcp add github \
--env GITHUB_TOKEN=ghp_your_token_here \
-- python -m github_mcp
Streamable HTTP
To run as a standalone HTTP server instead of stdio:
GITHUB_TOKEN=ghp_your_token_here python -m github_mcp --http
Example prompts
Once connected, you can ask Claude things like:
- "What's the open PR backlog on
owner/repo?" - "Read
README.mdfrom the default branch ofowner/repoand summarize it." - "Show me the diff for PR #42 and summarize the risky parts."
- "Open an issue titled 'Flaky test in CI' with these reproduction steps…"
Development
pip install -e ".[dev]"
pytest
The test suite mocks the GitHub API with httpx.MockTransport, so it runs
fully offline and makes no network calls.
Releasing (maintainers)
Publishing is automated via GitHub Actions
(.github/workflows/publish.yml) using PyPI
Trusted Publishing (OIDC) — no API tokens are stored anywhere.
One-time PyPI setup (before the first release):
- Sign in at pypi.org and go to Your projects → Publishing (or Account → Publishing for a project that doesn't exist yet).
- Add a pending publisher with:
- PyPI Project Name:
github-mcp-connector - Owner:
winnerlose2026 - Repository:
Github-mcp - Workflow name:
publish.yml - Environment name:
pypi
- PyPI Project Name:
- (Recommended) In the GitHub repo, create an Environment named
pypi(Settings → Environments) so the publish job is gated.
Cutting a release:
- Bump
versioninpyproject.toml, commit, and merge tomain. - Tag and publish a GitHub Release (e.g.
v0.1.0). Publishing the release triggers the workflow, which builds the sdist + wheel, runstwine check, and uploads to PyPI. - Confirm it's live:
uvx github-mcp-connector@latest --help.
Until the first release is published, install via the git-based quick start instead.
Security notes
- The connector only has the access your token grants. A broad token (
reposcope / all repositories) gives Claude reach across every repo your account can touch — convenient, but treat the token like the credential it is. Prefer a fine-grained, repo-limited token if you only need a few repositories. - Run with
GITHUB_MCP_READ_ONLY=truewhen you only need read access; this is enforced server-side, before any write request is sent to GitHub. This pairs well with a broad-access token: full visibility, no write risk. - Never commit your token.
.envis git-ignored;.env.exampleis the template to copy.
License
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_connector-0.4.0.tar.gz.
File metadata
- Download URL: github_mcp_connector-0.4.0.tar.gz
- Upload date:
- Size: 24.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af8052a3d9d30532653a199242153f337d511d0eb7a11fbd9129bb791f94f972
|
|
| MD5 |
09942faf342651d57b0567db066382fe
|
|
| BLAKE2b-256 |
8f00addaa4b3ac4fa9c2ea851db6bdee1dbb5b571324b112e5b9f4c1725b3dce
|
Provenance
The following attestation bundles were made for github_mcp_connector-0.4.0.tar.gz:
Publisher:
publish.yml on winnerlose2026/Github-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
github_mcp_connector-0.4.0.tar.gz -
Subject digest:
af8052a3d9d30532653a199242153f337d511d0eb7a11fbd9129bb791f94f972 - Sigstore transparency entry: 1710128576
- Sigstore integration time:
-
Permalink:
winnerlose2026/Github-mcp@55efb3f44882ce714a49c2e881220311fdc9c95b -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/winnerlose2026
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@55efb3f44882ce714a49c2e881220311fdc9c95b -
Trigger Event:
release
-
Statement type:
File details
Details for the file github_mcp_connector-0.4.0-py3-none-any.whl.
File metadata
- Download URL: github_mcp_connector-0.4.0-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a63cdf63ab43ff38ddbf0891b1c4f8afe052d00011f57351e402d91be3b880e
|
|
| MD5 |
c732f262c6c56a14f0cf16f6f7b6205e
|
|
| BLAKE2b-256 |
4cffd28e7ac773c919eb7db1b0d7da2d7dd2b0664810d4c1aefdfadec7d92625
|
Provenance
The following attestation bundles were made for github_mcp_connector-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on winnerlose2026/Github-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
github_mcp_connector-0.4.0-py3-none-any.whl -
Subject digest:
5a63cdf63ab43ff38ddbf0891b1c4f8afe052d00011f57351e402d91be3b880e - Sigstore transparency entry: 1710128594
- Sigstore integration time:
-
Permalink:
winnerlose2026/Github-mcp@55efb3f44882ce714a49c2e881220311fdc9c95b -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/winnerlose2026
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@55efb3f44882ce714a49c2e881220311fdc9c95b -
Trigger Event:
release
-
Statement type: