github-mcp-proxy
github-mcp-proxy
Cloudflare Workers上で動作する、個人/小規模チーム向けのGitHub MCPサーバーです。AIエージェントに対してリポジトリ単位のガードレールを提供します。
MCP対応のあらゆるエージェント(Claude、Codex、ChatGPT、Cursor、Clineなど)を接続でき、どのリポジトリに、どのようにアクセスできるかを厳密に制御可能です。
[!WARNING] セキュリティや安定性が必要な場合は、公式のGitHub MCPサーバーを使用してください。 フォークは自由ですが、フォーク後のセキュリティ問題については自己責任となります。
なぜこれが必要か
一般的なGitHubトークンをエージェントに渡すと、アカウント全体へのフルアクセス権を与えてしまいます。このサーバーは、その権限を以下のように制限します:
リポジトリ単位の権限レベル —
read/issues/fullブランチ保護 — 新規ブランチは特定のプレフィックス(デフォルトは
claude/)と一致する必要があり、main/masterへの書き込みは常に禁止コミットメッセージポリシー — Conventional Commitsをサーバーサイドで検証
ラベルのホワイトリスト — リポジトリごとに
allowedLabelsを設定。サーバーはGitHub上で自動的にラベルを作成しません禁止パス —
.github/workflows/**は常にブロック監査証跡 — 書き込みのたびに
Signed-off-by/Assisted-byトレーラー、またはエージェントとモデルを識別するフッターが自動的に付与されます
Related MCP server: Kontrol
アーキテクチャ
MCP agent ──(Streamable HTTP + OAuth)──▶ Cloudflare Worker
│
├── workers-oauth-provider (OAuth 2.1 server to MCP clients)
├── GitHub OAuth (OAuth client to github.com)
├── KV (session tokens)
├── Durable Object (MCP agent state)
└── Octokit (GitHub REST)設定(ghmcp.config.ts)はデプロイ時にWorkerにバンドルされます。実行時のKV読み取りは発生せず、satisfies を通じて型チェックが行われます。
クイックスタート
git clone <your-fork>
cd kz-github-mcp
npm install
cp ghmcp.config.sample.ts ghmcp.config.ts # edit: repos you want to expose
cp wrangler.sample.jsonc wrangler.jsonc # edit: KV id + worker name
cp .env.example .env # edit: for local dev onlyGitHub OAuth Appを作成し(ホームページ = https://<worker>.<subdomain>.workers.dev、コールバック = /callback)、以下を実行します:
wrangler kv namespace create "OAUTH_KV" # add the id to wrangler.jsonc
wrangler secret put GITHUB_CLIENT_ID
wrangler secret put GITHUB_CLIENT_SECRET
wrangler secret put COOKIE_ENCRYPTION_KEY # openssl rand -hex 32
npm run deployローカル開発:http://localhost:8788 を指す2つ目のOAuth Appを作成し、.env に認証情報を設定して npm run dev を実行します。
継続的デプロイ(オプション)
.github/workflows/deploy.yml は、main へのプッシュごとにCloudflareへデプロイします。GitHubの「Settings」→「Secrets and variables」→「Actions」で、以下の2つのリポジトリシークレットを設定してください:
シークレット | 入手先 |
| Cloudflareダッシュボード → マイプロフィール → APIトークン → 「Edit Cloudflare Workers」テンプレートでトークンを作成 |
| Cloudflareダッシュボード → Workersページの右サイドバー |
GitHub OAuthの認証情報(GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET, COOKIE_ENCRYPTION_KEY)は、GitHub Actionsではなく、Worker自体の Wrangler シークレットとして保持されます。wrangler secret put で一度設定するだけで済みます。
仕組みについては docs/ARCHITECTURE.md を、各設定項目については docs/CONFIG.md を参照してください。
AIエージェントの接続
Claude (claude.ai) — 「Settings」→「Connectors」→「Add custom connector」→ https://<worker>.<subdomain>.workers.dev/sse を貼り付けます。
Claude Code / Codex / Cursor / Cline — クライアントのMCP設定に追加します:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["mcp-remote", "https://<worker>.<subdomain>.workers.dev/sse"]
}
}
}その他のMCPホスト — 同じ /sse エンドポイントを指定します。初回接続時にOAuthフローが実行されます。
エージェントにツールの正しい使い方を教えるには、SKILL.md をシステムプロンプト、プロジェクトの指示、またはスキルディレクトリに含めてください。
ツール
ghmcp_ というプレフィックスが付きます。各ツールは最小権限レベルを宣言しており、サーバーはそれ以下の権限での呼び出しを拒否します。
カテゴリ | ツール | 最小レベル |
ユーザー |
| read |
リポジトリ |
| read |
Issue |
| read |
Issue |
| issues |
PR |
| read |
PR |
| issues |
ファイル |
| full |
アクション |
| read |
設定の disabledTools を通じて、任意のツールを無効化できます。
検証
npm run validate-configgh CLIを使用して、ghmcp.config.ts 内のすべてのリポジトリが存在すること、および allowedLabels 内のすべてのラベルがGitHub上に存在することを確認します。prebuild フックとして自動実行されるため、タイプミスがあると npm run build が失敗します。
ライセンス
元々は cloudflare/ai/demos/remote-mcp-github-oauth からフォークされました。MITライセンスです。
本ツールはMITライセンスの下で提供されています。詳細は LICENSE を参照してください。
This server cannot be deployed
Maintenance
Related MCP Connectors
AgentGuard — 20-tool AI safety MCP: policy preflight, risk scoring, audit logging, rate limits.
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
Zero-secret MCP gateway for AI agents: risk-scored, audited calls with human-in-the-loop approval.
MCP server for building and testing AI agents with multi-model experimentation and insights.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA local MCP server that provides controlled repository access with policy-based file filtering, secret redaction, and audit logging for AI coding agents.-
- AlicenseNot gradedqualityBmaintenanceA self-hosted MCP server that enables AI coding agents to read, edit, search, and run code in local projects with human review loops and policy controls.MIT
- AlicenseCqualityBmaintenanceA policy-aware MCP server for GitHub and GitHub Actions that enables safe AI-assisted infrastructure workflows—inspecting repositories, preparing branches and pull requests, and constrained remote mutations behind explicit preview-bound approval tokens.18MIT
- AlicenseNot gradedqualityBmaintenanceA local-first MCP server that lets AI agents use gated APIs without holding keys, enforcing declarative policies, injecting secrets server-side, and auditing access without content.2Apache 2.0