GitHub リポジトリ MCP サーバー
このモデルコンテキストプロトコル(MCP)サーバーは、AIモデルがGitHubリポジトリのコンテンツをコンテキストとしてアクセスできるようにします。ファイルの内容、リポジトリ構造、そしてリポジトリ全体を取得し、AIインタラクションのコンテキストとして使用するためのツールを提供します。
特徴
- リポジトリの内容全体をコンテキストとして取得する
- リポジトリから特定のファイルの内容を取得する
- リポジトリ構造を取得する(ファイルリスト)
- 拡張子でファイルをフィルタリングする
- 特定のパスを除外する
- 返されるファイルの数を制限する
インストール
使用法
GitHub認証の設定
サーバーは認証なしでパブリックリポジトリを操作できますが、GitHub API は認証されていないリクエストに対して厳格なレート制限(60 リクエスト/時間)を設けています。この制限を 5000 リクエスト/時間に引き上げるには、 GITHUB_TOKEN
環境変数を設定します。
GitHub 開発者設定で個人アクセス トークンを作成できます。
カーソルの使用
このサーバーを Cursor で使用するには、次の手順に従います。
- カーソル設定を開く
- 「MCP」を検索
- 「新しいMCPサーバーを追加」をクリックします。
- 次の情報を入力してください。
- 名前: github-repo-context (または任意の名前)
- タイプ: コマンド
- コマンド: /path/to/your-local-repo-setup/gh.sh
- 「保存」をクリック
- サーバー名の横にあるトグルをクリックしてサーバーを有効にします
- これでプロジェクトでサーバーが使えるようになるはずです
サーバーは、MCP プロトコルに従って stdin/stdout を介して通信します。
利用可能なツール
サーバーは次のツールを提供します。
- get-repo-context : コンテキストとして使用する GitHub リポジトリからすべてのファイルを取得する
- パラメータ:
owner
: GitHubリポジトリの所有者/組織名repo
: GitHubリポジトリ名maxFiles
(オプション): 含めるファイルの最大数 (デフォルト: 50)fileExtensions
(オプション): 含めるファイル拡張子 (例: ['js', 'ts', 'md'])excludePaths
(オプション): 除外するパス (デフォルト: ['node_modules', 'dist', 'build'])
- パラメータ:
- get-file-content : GitHub リポジトリから特定のファイルの内容を取得する
- パラメータ:
owner
: GitHubリポジトリの所有者/組織名repo
: GitHubリポジトリ名path
: リポジトリ内のファイルへのパス
- パラメータ:
- get-repo-structure : GitHubリポジトリの構造を取得する
- パラメータ:
owner
: GitHubリポジトリの所有者/組織名repo
: GitHubリポジトリ名
- パラメータ:
例
MCP をサポートする AI モデルと統合すると、次のようなコマンドを使用できます。
次に、AI はget-repo-structure
ツールを使用してリポジトリ構造を取得して表示します。
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
AI モデルがコンテキストとして GitHub リポジトリのコンテンツにアクセスできるようにし、AI インタラクションで使用するためにリポジトリ全体、特定のファイル コンテンツ、リポジトリ構造を取得する機能を備えています。
Related MCP Servers
- -securityAlicense-qualityA server that allows AI assistants to browse and read files from specified GitHub repositories, providing access to repository contents via the Model Context Protocol.Last updated -3JavaScriptMIT License
- -securityAlicense-qualityA Model Context Protocol server that enables AI agents to retrieve and understand entire codebases at once, providing tools to analyze local workspaces or remote GitHub repositories.Last updated -9TypeScriptMIT License
- AsecurityFlicenseAqualityA Model Context Protocol server that enables AI models to interact with GitHub's API, allowing for repository creation and management with descriptions, topics, and website URLs through natural language commands.Last updated -1JavaScript
- -securityFlicense-qualityProvides integration with Github through the Model Context Protocol (MCP), allowing Large Language Models to interact with Github's repositories, issues, pull requests and search functionality.Last updated -1TypeScript