Skip to main content
Glama
shanksxz

GitHub Repository MCP Server

by shanksxz

GitHub リポジトリ MCP サーバー

このモデルコンテキストプロトコル(MCP)サーバーは、AIモデルがGitHubリポジトリのコンテンツをコンテキストとしてアクセスできるようにします。ファイルの内容、リポジトリ構造、そしてリポジトリ全体を取得し、AIインタラクションのコンテキストとして使用するためのツールを提供します。

特徴

  • リポジトリの内容全体をコンテキストとして取得する

  • リポジトリから特定のファイルの内容を取得する

  • リポジトリ構造を取得する(ファイルリスト)

  • 拡張子でファイルをフィルタリングする

  • 特定のパスを除外する

  • 返されるファイルの数を制限する

Related MCP server: GitHub Repo Explainer MCP

インストール

# clone the repository
git clone https://github.com/shanksxz/github-mcp.git
cd github-mcp

# install dependencies
npm install

# build the project
npm run build

使用法

GitHub認証の設定

サーバーは認証なしでパブリックリポジトリを操作できますが、GitHub API は認証されていないリクエストに対して厳格なレート制限(60 リクエスト/時間)を設けています。この制限を 5000 リクエスト/時間に引き上げるには、 GITHUB_TOKEN環境変数を設定します。

# create a file called gh.sh and add the following line:
export GITHUB_TOKEN=your_github_personal_access_token
# make the file executable
chmod +x gh.sh
# run the file
./gh.sh

GitHub 開発者設定で個人アクセス トークンを作成できます。

カーソルの使用

このサーバーを Cursor で使用するには、次の手順に従います。

  1. カーソル設定を開く

  2. 「MCP」を検索

  3. 「新しいMCPサーバーを追加」をクリックします。

  4. 次の情報を入力してください。

    • 名前: github-repo-context (または任意の名前)

    • タイプ: コマンド

    • コマンド: /path/to/your-local-repo-setup/gh.sh

  5. 「保存」をクリック

  6. サーバー名の横にあるトグルをクリックしてサーバーを有効にします

  7. これでプロジェクトでサーバーが使えるようになるはずです

サーバーは、MCP プロトコルに従って stdin/stdout を介して通信します。

利用可能なツール

サーバーは次のツールを提供します。

  1. get-repo-context : コンテキストとして使用する GitHub リポジトリからすべてのファイルを取得する

    • パラメータ:

      • owner : GitHubリポジトリの所有者/組織名

      • repo : GitHubリポジトリ名

      • maxFiles (オプション): 含めるファイルの最大数 (デフォルト: 50)

      • fileExtensions (オプション): 含めるファイル拡張子 (例: ['js', 'ts', 'md'])

      • excludePaths (オプション): 除外するパス (デフォルト: ['node_modules', 'dist', 'build'])

  2. get-file-content : GitHub リポジトリから特定のファイルの内容を取得する

    • パラメータ:

      • owner : GitHubリポジトリの所有者/組織名

      • repo : GitHubリポジトリ名

      • path : リポジトリ内のファイルへのパス

  3. get-repo-structure : GitHubリポジトリの構造を取得する

    • パラメータ:

      • owner : GitHubリポジトリの所有者/組織名

      • repo : GitHubリポジトリ名

例

MCP をサポートする AI モデルと統合すると、次のようなコマンドを使用できます。

Get the structure of the repository tensorflow/tensorflow

次に、AI はget-repo-structureツールを使用してリポジトリ構造を取得して表示します。

Available Tools

3 tools
get-file-contentC

Get content of a specific file from a GitHub repository

ParametersJSON Schema
NameRequiredDescriptionDefault
ownerYesGitHub repository owner/organization name
repoYesGitHub repository name
pathYesPath to the file in the repository

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves file content but omits critical details: it doesn't specify whether this is a read-only operation (implied but not explicit), mention authentication requirements, rate limits, error handling for missing files, or the format of returned content. For a tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any fluff or redundancy. It is appropriately sized and front-loaded, making it easy for an agent to parse quickly. Every word earns its place, contributing to clarity without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a read operation with 3 required parameters) and the absence of both annotations and an output schema, the description is incomplete. It doesn't explain what the return value looks like (e.g., file content as text or binary), error conditions, or behavioral traits like authentication needs. For a tool with no structured data to rely on, the description should provide more comprehensive context to guide the agent effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with clear documentation for 'owner', 'repo', and 'path' parameters. The description adds no additional semantic context beyond what the schema provides, such as examples or constraints on path formatting. According to the rules, when schema coverage is high (>80%), the baseline score is 3, which applies here as the description doesn't compensate with extra parameter insights.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get content') and resource ('specific file from a GitHub repository'), making the tool's purpose immediately understandable. It distinguishes from sibling tools like 'get-repo-context' and 'get-repo-structure' by focusing on file content retrieval rather than repository metadata or structure. However, it doesn't explicitly mention the verb 'read' or specify that it's for a single file, which would make it a perfect 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus its siblings. It doesn't mention alternatives like 'get-repo-context' for repository information or 'get-repo-structure' for directory listings, nor does it specify prerequisites such as needing a valid file path. This lack of context leaves the agent to infer usage scenarios without explicit direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get-repo-contextC

Get all files from a GitHub repository to use as context

ParametersJSON Schema
NameRequiredDescriptionDefault
ownerYesGitHub repository owner/organization name
repoYesGitHub repository name
maxFilesNoMaximum number of files to include (default: 50)
fileExtensionsNoFile extensions to include (e.g., ['js', 'ts', 'md'])
excludePathsNoPaths to exclude (e.g., ['node_modules', 'dist'])

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that files are retrieved 'to use as context', implying a read-only operation for contextual purposes, but fails to disclose critical behavioral traits such as rate limits, authentication requirements, pagination, error handling, or what the output format looks like (e.g., structured data vs. raw files). For a tool with 5 parameters and no output schema, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that efficiently conveys the core purpose without unnecessary words. It's front-loaded with the main action and resource, making it easy for an agent to quickly understand the tool's intent. Every part of the sentence earns its place by specifying the scope ('all files') and purpose ('to use as context').

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (5 parameters, no annotations, no output schema), the description is incomplete. It lacks details on behavioral aspects (e.g., how files are returned, error conditions), doesn't differentiate from sibling tools, and provides minimal usage guidance. While the input schema is well-documented, the description fails to add sufficient value beyond it, leaving gaps in understanding the tool's full context and operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, meaning all parameters are well-documented in the input schema itself (e.g., owner, repo, maxFiles with default, fileExtensions, excludePaths). The description adds no additional parameter semantics beyond what the schema provides, such as explaining how fileExtensions or excludePaths interact or typical use cases. Given the high schema coverage, a baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('all files from a GitHub repository'), specifying the action and target. However, it doesn't explicitly differentiate from sibling tools like 'get-file-content' (which likely gets specific file contents) or 'get-repo-structure' (which might get directory structure), leaving room for ambiguity about what distinguishes this tool from those alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal guidance: it states the tool is for getting files 'to use as context', but offers no explicit advice on when to use this tool versus the sibling tools (get-file-content, get-repo-structure). There's no mention of prerequisites, limitations, or alternative scenarios, leaving the agent to infer usage from the tool name and parameters alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get-repo-structureC

Get the structure of a GitHub repository

ParametersJSON Schema
NameRequiredDescriptionDefault
ownerYesGitHub repository owner/organization name
repoYesGitHub repository name

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves repository structure but doesn't explain what that entails (e.g., returns a tree, includes file types, requires authentication, has rate limits, or is read-only). This leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It's front-loaded with the core purpose, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't clarify what 'structure' means, how results are formatted, or any behavioral traits like authentication needs. For a tool with two parameters and no structured context, more detail is needed to be fully helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting both parameters ('owner' and 'repo'). The description adds no additional meaning beyond the schema, such as examples or constraints. Since schema coverage is high, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('structure of a GitHub repository'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'get-file-content' or 'get-repo-context', which likely retrieve different aspects of repository data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get-file-content' or 'get-repo-context'. It lacks context about what 'structure' means (e.g., directory tree, file metadata) or any prerequisites for usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 3 tool updates
    • First observedget-file-content
    • First observedget-repo-context
    • First observedget-repo-structure

TDQS

C2.9/5.0

Scored across 3 tools

Disambiguation2/5

The tools have overlapping purposes that could cause confusion. get-repo-context and get-repo-structure both retrieve repository information, with get-repo-context getting all files and get-repo-structure getting the structure, making their boundaries unclear. get-file-content is more distinct but still part of the same domain.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern with hyphens (get-file-content, get-repo-context, get-repo-structure). The naming is predictable and readable throughout the set.

Tool Count2/5

With only 3 tools, the server feels thin for a GitHub repository domain. It lacks essential operations like create, update, delete, or search, which are typical for such a purpose, making the scope incomplete and underpowered.

Completeness2/5

The tool surface is severely incomplete for a GitHub repository server. It only provides read-only file and structure retrieval, missing core CRUD operations (e.g., create/update files, manage issues/pull requests) and other common GitHub functionalities, leading to significant gaps that will hinder agent workflows.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to analyze GitHub repository structures and read file contents with features like directory traversal, file type analysis, syntax highlighting, and code pattern detection. Supports both public and private repositories through GitHub API integration.
    8 npm
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to access live GitHub repository data without cloning, supporting repo summarization, file explanation, recent changes, and dependency analysis.
    MIT
  • F
    license
    B
    quality
    D
    maintenance
    Enables AI assistants to inspect local Git repositories and interact with the GitHub API for reading commits, diffs, files, issues, comments, pull requests, and project boards.
    10
    101 npm
    -