Skip to main content
Glama
shanksxz

GitHub Repository MCP Server

by shanksxz

GitHub Repository MCP Server

This Model Context Protocol (MCP) server allows AI models to access GitHub repository contents as context. It provides tools to fetch file contents, repository structure, and entire repositories for use as context in AI interactions.

Features

  • Fetch entire repository contents as context

  • Get specific file contents from a repository

  • Get repository structure (file listing)

  • Filter files by extension

  • Exclude specific paths

  • Limit the number of files returned

Related MCP server: GitHub Repo Explainer MCP

Installation

# 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

Usage

Setting up GitHub Authentication

While the server can work with public repositories without authentication, GitHub API has strict rate limits for unauthenticated requests (60 requests/hour). To increase this limit to 5000 requests/hour, set the GITHUB_TOKEN environment variable:

# 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

You can create a personal access token in your GitHub Developer Settings.

Using with Cursor

To use this server with Cursor follow these steps:

  1. Open Cursor Settings

  2. Search for "MCP"

  3. Click on "Add a new MCP Server"

  4. Enter the following information:

    • Name: github-repo-context (or any name you want)

    • Type: Command

    • Command: /path/to/your-local-repo-setup/gh.sh

  5. Click "Save"

  6. Enable the server by clicking the toggle next to the server name

  7. You should now be able to use the server in your project

The server communicates via stdin/stdout following the MCP protocol.

Available Tools

The server provides the following tools:

  1. get-repo-context: Get all files from a GitHub repository to use as context

    • Parameters:

      • owner: GitHub repository owner/organization name

      • repo: GitHub repository name

      • maxFiles (optional): Maximum number of files to include (default: 50)

      • fileExtensions (optional): File extensions to include (e.g., ['js', 'ts', 'md'])

      • excludePaths (optional): Paths to exclude (default: ['node_modules', 'dist', 'build'])

  2. get-file-content: Get content of a specific file from a GitHub repository

    • Parameters:

      • owner: GitHub repository owner/organization name

      • repo: GitHub repository name

      • path: Path to the file in the repository

  3. get-repo-structure: Get the structure of a GitHub repository

    • Parameters:

      • owner: GitHub repository owner/organization name

      • repo: GitHub repository name

Example

When integrated with an AI model that supports MCP, you can use commands like:

Get the structure of the repository tensorflow/tensorflow

The AI would then use the get-repo-structure tool to fetch and display the repository 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.

TDQS

C2.9/5.0
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.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

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.
    17
    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
    607

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/shanksxz/gh-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server