github-repos
github-mcp-server
stdio 経由で GitHub リポジトリを Claude Code(または MCP 互換クライアント)に公開する、最小限の読み取り専用 MCP サーバーです。
公開するツール
list_repos(owner?, include_forks?, limit?)- 自分のリポジトリ(または他のオーナーの公開リポジトリ)を一覧表示しますget_repo_info(owner, repo)- 1 つのリポジトリのメタデータlist_directory(owner, repo, path?, ref?)- リポジトリのファイルツリーを閲覧しますread_file(owner, repo, path, ref?, max_bytes?)- テキストファイルの内容を読み取りますget_readme(owner, repo, ref?)- リポジトリの README を取得しますsearch_code(query, owner?, repo?, limit?)- コードを検索します(必要に応じて自分のリポジトリに限定)list_commits(owner, repo, path?, limit?)- 最近のコミット履歴
すべて読み取り専用です。書き込み、作成、削除のエンドポイントは公開されていません。
Related MCP server: github-mcp-tool
セットアップ
GitHub パーソナルアクセストークンを作成(ファイングレイン、推奨): GitHub -> Settings -> Developer settings -> Personal access tokens -> Fine-grained tokens -> Generate new token.
リポジトリアクセス: Claude に読み取らせたいリポジトリを選択(または「All repositories」)
権限: Contents: Read-only、Metadata: Read-only(
search_codeを機能させたい場合は Code search: Read-only を追加)
依存関係をインストール:
cd github-mcp-server python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txtトークンを設定(スクリプトにハードコードしたり、どこにもコミットしないでください):
export GITHUB_TOKEN=github_pat_xxxxxxxxxxxx永続化するには、その行を
~/.zshrc/~/.bashrcに追加するか、direnvなどのツールで.envファイルを使用してください。ただし、gitignore されていることを確認してください。サーバーを Claude Code CLI に登録:
claude mcp add github-repos -- python3 /absolute/path/to/github-mcp-server/server.py(venv を使用した場合は、venv の python を指定してください:
/absolute/path/to/github-mcp-server/.venv/bin/python3)サーバーは環境から
GITHUB_TOKENを読み取るため、claudeを実行するシェルでエクスポートするか、明示的に渡してください:claude mcp add github-repos --env GITHUB_TOKEN=github_pat_xxxxxxxxxxxx -- python3 /absolute/path/to/github-mcp-server/server.py接続を確認:
claude mcp listgithub-reposが接続済みとして表示されるはずです。その後、Claude Code セッションで「list my repos」や「read the README of my flight-delay-prediction repo」などと質問すると、Claude がこれらのツールを呼び出します。ローカルスモークテスト(クライアントなし)
python3 -c " import os os.environ['GITHUB_TOKEN'] = 'github_pat_xxx' from server import list_repos print(list_repos()) "
注意事項 / 次のステップ
レート制限: 認証済みリクエストは GitHub の REST API から 1 時間あたり 5,000 回取得できます。インタラクティブな使用には十分です。
後で書き込みアクセス(issue の作成、PR へのコメント)が必要になった場合は、
requests.post/patchを使用して新しい@mcp.tool()関数を追加してください。GitHub の状態を変更するツールが明確になるよう、分離して明確な名前を付けてください。これを claude.ai/Cowork から利用可能にしたい場合(Claude Code CLI/VS Code だけでなく)、stdio トランスポートから OAuth を使用したホスト型 HTTP サーバーに移行する必要があります。これは大幅に大きなステップであり、そのリーチが必要な場合にのみ価値があります。
This server cannot be deployed
Maintenance
Related MCP Connectors
Access the GitHub API, enabling file operations, repository management, search functionality, and…
GitHub MCP — wraps the GitHub public REST API (no auth required for public endpoints)
GitHub Private MCP Pack — access private repos, org data via OAuth.
An MCP server that gives your AI access to the source code and docs of all public github repos
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables GitHub API integration via MCP, allowing search, repository details, file contents, and issue management.251 npmISC
- FlicenseNot gradedqualityDmaintenanceEnables managing GitHub repositories, files, and user information through MCP, with support for creating, updating, and deleting repository contents, as well as fetching user profiles.1-
- FlicenseNot gradedqualityDmaintenanceEnables natural language interaction with GitHub through an MCP server. Supports reading repos, issues, and PRs, as well as creating and editing issues with user confirmation.-
- AlicenseNot gradedqualityBmaintenanceEnables searching GitHub code with filters and reading arbitrary file contents from any repository via MCP.GPL 3.0