Git Repo Auth MCP
Mints short-lived, scoped GitHub App installation tokens on demand for AI agents to access git repositories or the GitHub API.
README
Git Repo Auth MCP
Connect GitHub once. Your agent mints its own short-lived, scoped tokens after that.
A Cloudflare Worker that bridges MCP's OAuth to GitHub App installation tokens. Users click "Connect," log in with GitHub, and choose which account to bind. From then on, their MCP session can call one tool — github_token — which returns a ≤1-hour token scoped to their installation, optionally down-scoped per request.
Currently GitHub; forge-agnostic by design.
How the bridge works
- An MCP client (Claude, etc.) connects to
/mcpand is sent through a standard OAuth 2.1 flow (dynamic client registration, PKCE) served by this worker. - Inside that flow, the user logs in with GitHub. The worker checks which installations of this GitHub App the user actually controls (
GET /user/installations— GitHub filters by both app and user). - Zero installations → the user is sent to install the app on their repos. One → bound automatically. Several → a picker.
- The grant is bound to that installation ID. Every later
github_tokencall mints for that installation only. GitHub enforces the walls: a token minted for one installation physically cannot touch another's repositories.
Security model — read before trusting
What is never stored. No GitHub tokens, ever. Installation tokens are minted on demand and die within the hour. The GitHub user token from login is used for two GET requests and discarded. The worker's state is: its own OAuth grants (hashed, in KV) and 10-minute pending records during account selection.
What the operator holds. One GitHub App private key — their own, in worker secrets. Users never hand over keys. This is the standard model every CI service uses.
Blast radius, honestly. If this worker is compromised, the attacker gains minting capability over the repos of every account that installed the app — not their keys, not their accounts, but their installed scope, within the app's permission ceiling. Your kill switch as a user is first-class and unilateral: uninstall the app, and minting for your account ends instantly; outstanding tokens die within the hour. If that trust trade doesn't fit you, self-host your own instance (below) — it's the same code.
"No Administration" ≠ "cannot escalate." The recommended grant (Contents RW, PRs RW, Workflows RW, Metadata R) excludes Administration. But Workflows write means a token holder can modify CI, and CI runs with the repo's own credentials. The path is accepted, not eliminated: CI changes land in PRs and audit logs under the app's [bot] identity. Users who don't want the trade can simply not grant the app repos where it matters — or the operator can drop the Workflows permission app-wide.
Per-request enforcement. The permission ceiling, repository scoping, one-hour expiry, and bot provenance are all enforced by GitHub, not by this code.
Connect (as a user)
Add this server to your MCP client:
https://<deployment>/mcp
Your client will walk you through GitHub login and installation binding. Then ask your agent to call github_token when it needs git or API access.
github_token parameters (both optional): repositories (names, no owner) and permissions (e.g. {"contents":"read"}) — each must be within what the app was granted and where it's installed.
Operate (run your own bridge)
- Create a GitHub App (Settings → Developer settings → GitHub Apps → New). Webhook off. Permissions: Contents RW, Pull requests RW, Workflows RW (optional — see security model), Metadata R. Nothing else; explicitly not Administration. Make the app public if others should be able to install it.
- Enable user OAuth on the app: set Callback URL to
https://<deployment>/callback, then generate a client secret (App settings → Client secrets). Note the Client ID. - Generate the private key. Paste it as-is — the worker auto-converts GitHub's PKCS#1 format to the PKCS#8 that WebCrypto needs. (Manual fallback if ever needed:
openssl pkcs8 -topk8 -inform PEM -in key.pem -nocrypt.) The key never transits chat in any format. - Set the slug in
wrangler.jsonc(GH_APP_SLUG, fromgithub.com/apps/<slug>) and create a KV namespace for theOAUTH_KVbinding if the committed ID isn't yours:wrangler kv namespace create OAUTH_KV. - Secrets (never committed, never pasted in chat):
wrangler secret put GH_APP_ID wrangler secret put GH_APP_PRIVATE_KEY # the PKCS#8 PEM wrangler secret put GITHUB_CLIENT_ID wrangler secret put GITHUB_CLIENT_SECRET - Deploy:
npm install && npm run deploy - Keep any existing PAT until the first real token mints. Retiring the fallback before validating the replacement is how lockouts happen.
Retired in v0.2: MCP_AUTH_TOKEN (replaced by per-user OAuth) and GH_APP_INSTALLATION_ID (now bound per grant).
Development
npm install
npm run typecheck
npm test
npm run dev # local; dummy values in .dev.vars (gitignored)
Troubleshooting & project journal
Field-observed failures and fixes live in docs/troubleshooting.md — start there if a token "doesn't work." The evidence behind each entry is the project journal under odd/ledger/: dated DOLCHEO records of what was observed, learned, and decided. New observations go to the journal first, then get distilled into troubleshooting.
License
Deliberately not yet licensed (all rights reserved by default) — a licensing decision is pending and will be made once, deliberately. Open an issue if you need clarity before then.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。