github-mcp-server

ohishi-yhonda-pub/github-mcp-server

3.2

If you are the rightful owner of github-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The GitHub MCP Server is designed to facilitate integration with Claude.ai using the Model Context Protocol, leveraging Cloudflare Workers for deployment.

Tools
13
Resources
0
Prompts
0

GitHub MCP Server

Deploy to Cloudflare

Claude.ai用のGitHub MCP(Model Context Protocol)サーバー。Cloudflare Workersで動作。

機能

  • OAuth 2.1認証(PKCE対応)
  • GitHub API連携
    • リポジトリ操作(一覧/取得/作成)
    • ファイル操作(取得/作成/更新)
    • Issue操作(一覧/取得/作成/更新)
    • ブランチ一覧
    • コード検索

セットアップ

1. GitHub OAuth App作成

  1. https://github.com/settings/developers にアクセス
  2. "New OAuth App" をクリック
  3. 以下を入力:
    • Application name: GitHub MCP Server
    • Homepage URL: https://github-mcp-server.<your-account>.workers.dev
    • Authorization callback URL: https://github-mcp-server.<your-account>.workers.dev/oauth/callback
  4. Client ID と Client Secret をメモ

2. Cloudflare KV作成

# KV Namespace作成
wrangler kv:namespace create SESSIONS

# 出力されたIDをwrangler.tomlに設定

3. 環境変数設定

# Secrets設定
wrangler secret put GITHUB_CLIENT_ID
wrangler secret put GITHUB_CLIENT_SECRET
wrangler secret put JWT_SECRET
wrangler secret put SERVER_URL

JWT_SECRETは32文字以上のランダム文字列を生成:

openssl rand -base64 32

SERVER_URLはデプロイ後のWorkers URL:

https://github-mcp-server.<your-account>.workers.dev

4. デプロイ

npm install
npm run deploy

5. Claude.aiで設定

  1. Claude.ai Settings → Integrations
  2. "Add Integration"
  3. Name: GitHub
  4. URL: https://github-mcp-server.<your-account>.workers.dev
  5. "Connect" → GitHubで認証

wrangler.toml設定

name = "github-mcp-server"
main = "src/index.ts"
compatibility_date = "2024-12-01"

[[kv_namespaces]]
binding = "SESSIONS"
id = "<YOUR_KV_NAMESPACE_ID>"

[vars]
OAUTH_SCOPES = "repo,read:user"

ローカル開発

# 開発サーバー起動
npm run dev

# ログ確認
npm run tail

エンドポイント一覧

PathMethodDescription
/.well-known/oauth-protected-resourceGETRFC 9728 リソースメタデータ
/.well-known/oauth-authorization-serverGETRFC 8414 認証サーバーメタデータ
/oauth/authorizeGETOAuth認証開始
/oauth/callbackGETGitHubコールバック
/oauth/tokenPOSTトークン発行
/oauth/registerPOST動的クライアント登録
/mcpPOSTMCP JSON-RPC
/docsGETドキュメント

MCP Tools

ToolDescription
list_reposリポジトリ一覧
get_repoリポジトリ詳細
create_repoリポジトリ作成
get_contentsファイル/ディレクトリ内容
get_file_contentファイル内容(デコード済み)
create_or_update_fileファイル作成/更新
list_issuesIssue一覧
get_issueIssue詳細
create_issueIssue作成
update_issueIssue更新
list_branchesブランチ一覧
search_reposリポジトリ検索
search_codeコード検索

トラブルシューティング

接続エラー

  1. SERVER_URLが正しいか確認
  2. GitHub OAuth AppのCallback URLが正しいか確認
  3. wrangler tailでログを確認

認証エラー

  1. GitHub OAuth AppのClient ID/Secretが正しいか確認
  2. JWT_SECRETが設定されているか確認
  3. KV Namespaceが正しくバインドされているか確認

License

MIT