github-mcp
Provides comprehensive tools for interacting with the GitHub REST API: browsing and reading repositories (overview, file trees, files, in-repo grep, code/issue/PR search, commits, comparisons, pull requests and issues), plus write operations such as creating/committing branches, committing multiple file changes as a fast-forward, resetting or deleting branches, opening/editing/merging pull requests, and creating issues and comments. Scope can be limited with repo allowlists, a read-only mode and protected branches, and every write is undoable.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
github-mcp
A small remote MCP server that gives the Gemini app (gemini.google.com) access to GitHub. It also works with other MCP clients that use OAuth or a bearer token, such as Claude.
It has no npm dependencies. It uses only Node.js and
fetchto the GitHub REST API.It sends one plain JSON answer for each POST, with no SSE and no session. Gemini needs no more than that.
It has its own OAuth 2.1 server with dynamic client registration, so Gemini can connect with no client ID.
Its input schemas use only
type,properties,required,description,itemsand stringenum. Gemini refuses the whole connector when one tool uses a keyword such asanyOf,$reforadditionalProperties.
Why this exists
The official GitHub MCP server did not connect in the Gemini app in our tests. There are two likely causes:
It does not support dynamic client registration.
Its tool schemas use keywords that Gemini refuses.
This server avoids both.
Related MCP server: github-mcp-server
Status
Version 0.1.0. The read and write tools work, with tests and a live test on github.com through the Gemini app.
Tools
Read (12):
Tool | What it does |
| Lists the repositories that the token can reach. |
| Gives the default branch, the branches, the top level and the README. |
| Lists the files under a directory, at one level or at all levels. |
| Reads up to 10 files. A long file comes back cut, with the next line number. |
| Finds every matching line in one repository, at any ref. It downloads the tarball and searches it in memory. |
| GitHub search for code, issues and pull requests. GitHub code search often misses files, so use |
| Recent commits of a branch or a path. |
| Commits and diff between two refs. |
| Lists pull requests. |
| Gives a pull request with its diff, and optionally its comments and reviews. |
| Lists issues. |
| Gives an issue with its comments. |
Write (8):
Tool | What it does |
| Makes a branch from a ref. |
| Writes one commit with many files added, changed or deleted. It creates the branch if needed, and works on an empty repository. The update is a fast-forward, so it never overwrites a push from someone else. |
| Moves a branch to another commit (force push). The result gives the old SHA, to undo. |
| Deletes a branch, but not the default branch. The result gives the SHA, to undo. |
| Opens, edits, closes or reopens a pull request. |
| Merges with merge, squash or rebase, optionally only at an expected head SHA. |
| Opens or edits an issue. |
| Comments on an issue or a pull request. |
No tool deletes a repository or changes settings, branch protection, collaborators, webhooks or secrets. Each write can be undone.
Set READ_ONLY=1 to remove the write tools. Set PROTECTED_BRANCHES (such as main,release/*) to refuse reset_branch and delete_branch on those branches.
Limits for each answer:
Item | Limit |
One file | 2,000 lines or 100,000 characters |
One answer | 250,000 characters |
One diff | 300 lines for each file, 1,500 lines in total. Lockfiles are not shown. |
One commit | 100 files and 10 MB |
One tool call | 50 seconds. After that it stops with an error, because Gemini stops a call after about 60 seconds. |
Security model
The server is on a public URL, and its GitHub token can write code. These are the fences:
The GitHub token is the real limit. Use a fine-grained personal access token. Give it only the repositories and permissions that you need.
OAuth approval.
A client such as Gemini registers itself, then sends you to an approval page.
The page asks for the approval secret. With no secret, there is no token.
The approval secret opens only the approval page. It is not a bearer token.
Allowed redirect hosts. A client can register only with a redirect URI on an allowed host. The default list has the Gemini hosts,
claude.aiand localhost.Short tokens.
Access tokens last 1 hour, and refresh tokens last 30 days.
Each refresh token works one time.
When a used refresh token comes back, the server revokes all tokens of that client.
Tokens are kept as SHA-256 digests, in a file with mode 600.
REPOSlimits the repositories that the tools can touch. The default is all repositories that the token can reach.A random route. The path of
PUBLIC_URLis the MCP endpoint. Make it random.The log has one line for each request: method, tool, result and time. The log never holds content, tokens or secrets.
Set up
1. Make a GitHub token
On GitHub, open Settings > Developer settings > Fine-grained tokens > Generate new token.
Select the repositories.
Set these repository permissions:
Permission
Access
Contents
Read and write
Pull requests
Read and write
Issues
Read and write
Actions
Read
Commit statuses
Read
Workflows
Read and write (only to change files in
.github/workflows/)For a read-only server, set each permission to Read.
Put the token in a file that only you can read:
mkdir -p ~/.github-mcp && chmod 700 ~/.github-mcp pbpaste > ~/.github-mcp/github.token # or paste it with an editor chmod 600 ~/.github-mcp/github.token
2. Configure
Variable | Required | Default | Meaning |
| yes, or | File with the GitHub token, mode 600. | |
| yes | Public https address of the MCP endpoint, with a random path, such as | |
| no | made in | The secret that the approval page asks for. |
| no | none | A fixed bearer token, for curl or for clients that take a header. 32 characters or more. |
| no |
| Repositories that the tools can touch, such as |
| no | off |
|
| no | none | Branches with no force reset and no delete, such as |
| no | Gemini, claude.ai, localhost | OAuth redirect hosts. |
| no |
| Listen address. Use |
| no |
| Listen port. |
| no |
| OAuth clients and tokens. |
| no |
| For GitHub Enterprise Server. |
Each *_FILE variable also has a plain form, such as GITHUB_TOKEN. A file is safer, because a process list or a log can show a variable.
3. Run
export GITHUB_TOKEN_FILE=~/.github-mcp/github.token
export PUBLIC_URL="https://your-host.example/$(node bin/github-mcp.mjs random)"
node bin/github-mcp.mjs check # checks the token and shows the configuration
node bin/github-mcp.mjs serveThe server listens on 127.0.0.1. Put an https proxy or tunnel in front of it. The proxy must send these paths to the server:
the route (the path of
PUBLIC_URL), and all paths under it/.well-known/oauth-protected-resource<route>/.well-known/oauth-authorization-server<route>/.well-known/openid-configuration<route>
Tailscale Funnel
Do the steps below. Do not run tailscale funnel reset, because it removes the other services on the host.
Look at the current configuration:
tailscale funnel statusAdd the routes. Replace
<route>with your route. In each command, the--set-pathvalue is the path that the public URL receives:tailscale funnel --bg --set-path /<route> http://127.0.0.1:7814/<route> tailscale funnel --bg --set-path /.well-known/oauth-protected-resource/<route> http://127.0.0.1:7814/.well-known/oauth-protected-resource/<route> tailscale funnel --bg --set-path /.well-known/oauth-authorization-server/<route> http://127.0.0.1:7814/.well-known/oauth-authorization-server/<route> tailscale funnel --bg --set-path /.well-known/openid-configuration/<route> http://127.0.0.1:7814/.well-known/openid-configuration/<route>Look at the configuration again, and make sure that the other services are still there:
tailscale funnel status
One host and port for each connector
Gemini keeps one OAuth login for each origin (host and port). If two MCP servers share one origin, such as two paths on https://host.ts.net, the login of one connector replaces the login of the other, and Gemini shows "Could not connect the account". Give this server its own origin. With Tailscale Funnel, use port 8443 or 10000 (add --https=8443 to the commands above, and put :8443 in PUBLIC_URL).
Other ways to put it online
cloudflared, with a
cloudflared tunneltohttp://127.0.0.1:7814.Caddy, with
reverse_proxy 127.0.0.1:7814.Any host that runs Node.js 22 or later. Set
HOST=0.0.0.0behind its TLS proxy, and keepDATA_DIRon a disk that stays after a restart.
4. Add the connector in Gemini
In Gemini, open Settings > Connectors (custom MCP), and add the URL. The URL is your
PUBLIC_URL.Gemini opens the approval page. Enter the approval secret:
cat ~/.github-mcp/approval.secretSet the tools to "always allowed", if you want.
In a chat, write
@<connector name>to make Gemini call the tools. If you do not, Gemini often answers from memory.
Deploy on Vercel (serverless)
A serverless host has no disk that stays, so the built-in OAuth server cannot keep its clients and tokens there. On Vercel, an external OAuth server gives the tokens, and api/mcp.js only checks them.
The function reads the token table of that server in a Neon Postgres database over HTTP, with no driver. It expects a table mcp_tokens(hash, kind, client_id, scope, expires_at, revoked_at), where hash is the base64url SHA-256 of the token. A token opens this server only when its scope holds AUTH_SCOPE.
Run
vercel deploy --prod. Vercel gives the project its own hostname.Set these environment variables in Vercel:
Variable
Meaning
GITHUB_TOKENThe GitHub token (mark it sensitive).
TOKEN_DATABASE_URLNeon connection string of the token table (mark it sensitive).
AUTH_SERVERIssuer URL of the OAuth server.
AUTH_SCOPEScope of this server. Default
github.PUBLIC_URLhttps://<your-project>.vercel.app/api/mcpREPOS,PROTECTED_BRANCHES,READ_ONLYAs above.
In the OAuth server, register
PUBLIC_URLas a resource with the scopeAUTH_SCOPE.Deploy again, so the function reads the variables.
vercel.json sends the discovery paths (/.well-known/...) to the function. Function time is limited to 60 seconds.
Commands
github-mcp serve # start the server
github-mcp check # check the token and the configuration
github-mcp clients # list the OAuth clients
github-mcp revoke <id> # remove one client and its tokens ("all" for every client)
github-mcp random # print a random value for a route or a secretrevoke works while the server runs.
Tests
npm testThe tests need no GitHub account and no network. They use a fake GitHub API.
Plan
A GitHub login mode, so that each user signs in with GitHub on a server that many people share.
Verified (signed) commits with the GraphQL
createCommitOnBranchmutation.get_ci_status: checks and logs of GitHub Actions.
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Operate GitHub from your AI assistant: repos, PRs, issues, Actions. Previews and read-only mode.
Connect any AI agent to 1,000+ apps and 27,000+ actions through one remote MCP server (OAuth).
GitHub Copilot MCP: code, repo, PR, workflow tools for AI assistants.
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceEnables claude.ai to connect to GitHub MCP using OAuth, providing full toolset for repository, issue, PR, Actions, and gist operations.-
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with GitHub issues, pull requests, and Actions workflows through MCP tools.-
- AlicenseNot gradedqualityDmaintenanceEnables remote MCP connections to GitHub, allowing users to list repositories, inspect repository details, manage issues, and read file contents via natural language or MCP clients.MIT
- AlicenseNot gradedqualityDmaintenanceEnables Claude and other MCP clients to read and write GitHub repositories, pull requests, issues, files, branches, commits, releases, and more using a personal access token without OAuth.MIT