github-mcp
This server provides read and optional write access to GitHub repositories, issues, and pull requests via the GitHub REST API, with write operations disabled by default for safety.
Read tools (always available, work unauthenticated):
get_repo– Fetch repository metadata: description, language, stars, forks, open issues, default branch, archived flag, license, last-push time.list_issues– List issues (excluding PRs), sorted by most recently updated; filter by state and limit.get_issue– Get full details of a single issue (title, body, state, labels, comment count).list_pull_requests– List pull requests, sorted by most recently updated; filter by state and limit.get_pull_request– Fetch full details of a single pull request, including merge state.get_file_content– Read a UTF-8 text file from a repository at a given path (base64-decoded); binary files are reported but not decoded.search_repos– Search public repositories by keyword/qualifiers, sorted by best match.get_user– Retrieve public profile of a GitHub user or organization.list_commits– List commits on a branch/ref, newest first.
Write tools (disabled by default; require GITHUB_MCP_ENABLE_WRITE=1 and GITHUB_TOKEN):
create_issue– Open a new issue (title, optional body and labels).comment_on_issue– Post a comment on an issue or pull request.update_issue_state– Set an issue's state toopenorclosed.add_labels– Add one or more labels to an issue or pull request.create_pr_review_comment– Create a review comment on a specific line of a pull request’s diff.
Safety & error handling:
Write tools are off by default; calling them without opt-in returns a structured
policy_refusalerror. Missing token returnsauth_required.Read operations work without authentication but are subject to lower rate limits (60 req/hr). Providing a fine-grained PAT boosts rate limits and is mandatory for writes.
Structured errors are returned for rate limiting, API errors (4xx/5xx), network issues, and malformed inputs—never crashing the server.
Provides tools for interacting with the GitHub REST API, enabling read and write operations on repositories, issues, pull requests, file contents, commits, and user profiles. Write tools are disabled by default for safety.
github-mcp
A public read+write MCP server over the GitHub REST API, built to the desktop-mcp/rag-mcp/mcp-factory standard (own pyproject, fastmcp server, honest README, real test suite) with env-gated tool groups (write disabled by default). Not the official GitHub MCP server -- see below.
Quickstart (60 seconds)
pip install jaimenbell-github-mcp// Add to your MCP host config (e.g. Claude Desktop/Code's mcpServers block)
{
"mcpServers": {
"github-mcp": {
"command": "github-mcp"
}
}
}The write tool group (issue/PR mutations) is off by default -- see
Env vars below to enable it.
Related MCP server: mcp-github-server
What this is / is not
This is a reference portfolio implementation demonstrating a hardened read+write MCP server pattern over a real external SaaS API (GitHub) -- env-gated tool groups, typed error/rate-limit handling, auth that degrades gracefully, a real test suite. It exists to show, concretely, "I build read/write MCP servers over external APIs" with a link a client can click.
It is NOT the official GitHub MCP server. It does not aim for parity
with GitHub's own MCP offering (GraphQL, Actions, webhooks, GitHub Apps are
all out of scope -- see below). It started life as a factory-scaffolded
read-only demo (mcp-factory's
generated/github_read_server.py) and was hand-hardened into this
standalone read+write server -- the scaffold-then-harden path is itself part
of the story this repo tells.
Tools (14)
One row per tool -- the two groups below just control default-on/off state, not what exists.
Tool | Group | What it does |
|
| Repo metadata (stars, language, license, default branch, archived flag...) |
|
| List issues on a repo (PRs filtered out) |
|
| Fetch a single issue |
|
| List pull requests on a repo |
|
| Fetch a single pull request |
|
| Read a repo file's content (base64-decoded, binary detected not decoded) |
|
| Search public repositories |
|
| Public user/org profile |
|
| List commits on a branch/ref |
|
| Open an issue |
|
| Comment on an issue/PR |
|
| Open/close an issue |
|
| Add labels to an issue/PR |
|
| Create a PR review comment on a diff line |
read is always on and works unauthenticated (GitHub's 60 req/hr tier).
write is env-gated and OFF by default -- requires
GITHUB_MCP_ENABLE_WRITE=1 and GITHUB_TOKEN.
A disabled write call returns a structured policy_refusal error (never a
silent no-op, never a crash). A write call with the group enabled but no
token returns a structured auth_required error -- the group gate and the
token precondition are checked independently, both before any network call.
Write-safety-off-by-default
This is defense-in-depth, mirroring desktop-mcp's input group: harness-level
permission prompts are the first gate, but the server itself refuses every
write tool unless its own environment explicitly opts in with
GITHUB_MCP_ENABLE_WRITE=1, and even then refuses without a GITHUB_TOKEN.
A misconfigured or overly-permissive MCP host cannot turn on GitHub mutations
this process wasn't deliberately configured to allow. The registration this
repo ships with (see ~/.claude.json's github-mcp entry) has the write
group absent from env -- enabling it is a deliberate per-registration
operator choice, not a code change.
Honest-capabilities table
Every claim below maps to the file that implements it and the test(s) that verify it -- no capability is asserted without a corresponding implementation and test.
Claim | Implementation | Verified by |
Repo metadata (stars, language, license, default branch, archived flag...) |
|
|
List / fetch issues (PRs filtered from list) |
|
|
List / fetch pull requests |
|
|
Read a repo file's content (base64-decoded, binary detected not decoded) |
|
|
Search public repositories |
|
|
Public user/org profile |
|
|
List commits on a branch/ref |
|
|
Open an issue |
|
|
Comment on an issue/PR |
|
|
Open/close an issue |
|
|
Add labels to an issue/PR |
|
|
Create a PR review comment on a diff line |
|
|
Write group OFF by default, structured refusal when disabled |
|
|
Write tools require a token even when the group is enabled |
|
|
Fine-grained PAT auth, degrades to unauthenticated tier when absent |
|
|
GitHub primary rate-limit (403 + |
|
|
Malformed owner/repo/path (control chars etc.) that would raise |
|
|
Generic 4xx/5xx surfaces as a typed error, never a crash |
|
|
Non-JSON / malformed responses and network failures surface as typed errors |
|
|
Limitations (read before relying on this)
REST v1 only. No GraphQL API coverage.
No webhooks / GitHub App auth. Fine-grained PAT only.
No Actions/workflow-dispatch tools. Issue/PR CRUD is the v1 write surface.
Unauthenticated read is rate-limited to 60 req/hr by GitHub itself (10 req/min for search) -- expect
rate_limitederrors under sustained unauthenticated use; setGITHUB_TOKEN(even a read-only fine-grained PAT) to raise this considerably.get_file_contenttruncates past 100KB and reports (rather than decodes) non-UTF-8 files.No pagination beyond a single page for list endpoints (
limit, capped per-endpoint, is the only page-size control in v1).Not registered with the mcp-factory hub. Ships as a standalone repo (own pyproject, system Python312 install), matching the rag-mcp/desktop-mcp model.
Env vars
Var | Effect | Default |
| enable the | unset (off) |
| fine-grained PAT; read works without it (degraded unauth rate), write requires it | unset |
|
| unset (skip) |
Usage examples
// A tool call from the MCP host, illustrative -- not a shell command.
{"tool": "get_repo", "arguments": {"owner": "anthropics", "repo": "anthropic-sdk-python"}}
// -> {"ok": true, "full_name": "anthropics/anthropic-sdk-python", "stargazers_count": 1234, ...}
// write group disabled (default):
{"tool": "create_issue", "arguments": {"owner": "o", "repo": "r", "title": "bug"}}
// -> {"ok": false, "error": {"type": "policy_refusal", "group": "write", "required_env": "GITHUB_MCP_ENABLE_WRITE", ...}}
// write group enabled, no token set:
{"tool": "create_issue", "arguments": {"owner": "o", "repo": "r", "title": "bug"}}
// -> {"ok": false, "error": {"type": "auth_required", "tool": "create_issue", ...}}Testing
CI (.github/workflows/ci.yml) runs this suite on every push/PR and fails
the build if the Tests badge above drifts from what the suite actually
reports -- see scripts/check_readme_counts.py.
# unit suite (respx-mocked api.github.com, no real network touched)
python -m pytest -q
# handshake check -- prints every registered tool name
python scripts/list_tools.py
# real-network read smoke (get_repo against a stable public repo;
# no write smoke exists anywhere in this suite -- see safety rails above)
GITHUB_MCP_LIVE=1 python -m pytest -q -k live_get_repoInstall
pip install -r requirements.txt # or: pip install .
# deps: fastmcp==3.4.2, httpx==0.28.1
# test-only: pytest==9.0.3, respx==0.23.1Setup / connect
pip install -r requirements.txton Python 3.12+.(Optional) generate a fine-grained PAT scoped to the repos you want read+write access to (Issues: read/write, Pull requests: read/write, Contents: read is enough for v1). Read tools work with no token at all -- they just run at GitHub's unauthenticated 60 req/hr tier.
Add to your MCP host config (e.g.
~/.claude.json):
{
"mcpServers": {
"github-mcp": {
"command": "C:\\Users\\<you>\\AppData\\Local\\Programs\\Python\\Python312\\python.exe",
"args": ["C:\\Users\\<you>\\projects\\github-mcp\\run_server.py"],
"env": {
"GITHUB_TOKEN": "your-fine-grained-pat-here"
// GITHUB_MCP_ENABLE_WRITE intentionally absent -- write stays off
// until you deliberately opt in per-deployment.
}
}
}
}To enable write tools for a given deployment, add
"GITHUB_MCP_ENABLE_WRITE": "1"to that entry'senvblock. This is a registration-time operator decision, not a code change.
Registered in ~/.claude.json as github-mcp (stdio, system Python312,
read group always on, write group absent from env -- off).
Commercial support
Maintained by Jaimen Bell. For production MCP integrations, custom servers, or agent-reliability work, see jaimenbell.dev.
Building your own MCP server? The MCP Starter Kit has templates, a build playbook, and packaging war-stories from shipping this one.
mcp-name: io.github.jaimenbell/github-mcp
Maintenance
Related MCP Servers
- Flicense-qualityCmaintenanceMCP server for the GitHub REST API that enables interaction with repositories, pull requests, issues, branches, commits, reviews, and code search, with configurable write and destructive operations.
- Flicense-qualityCmaintenanceA simple MCP server that provides repository information (list repos, get repo details) using GitHub's public REST API, without needing any API keys or tokens.
- AlicenseBqualityDmaintenanceMCP (Model Context Protocol) server for GitHub API integration. This server provides comprehensive tools for interacting with GitHub repositories, issues, pull requests, branches, and code search through a unified interface.157MIT
- Flicense-qualityCmaintenanceRead-only MCP server for the GitHub REST API that enables agents to query repositories, issues, files, and users without any write access.
Related MCP Connectors
GitHub Private MCP Pack — access private repos, org data via OAuth.
A basic MCP server to operate on the Postman API.
An MCP server that gives your AI access to the source code and docs of all public github repos
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/jaimenbell/github-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server