GitHub Repository MCP Server

by shanksxz

2 318 downloads Not rated yet MIT license

About

GitHub context server for AI models. Fetch files, structure, filter, and more.

Details

License
MIT license

Explore

- 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


npm install

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:

bash

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'])

path

Path to the file in the repository

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

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

Installation

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.