A Model Context Protocol (MCP) server that provides tools for interacting with GitHub repositories.
This MCP server provides two main tools:
Get the file tree structure of a GitHub repository.
Parameters:
owner(string, required): GitHub repository ownerrepo(string, required): GitHub repository namebranch(string, required): Branch name (defaults to 'main')
Returns: A string containing an ASCII tree representation of the repository structure, where directories are marked with / and files are shown without special markers.
Example Output:
my-repo/
├── src/
│ ├── index.ts
│ └── utils/
│ └── helper.ts
├── package.json
└── README.md
Get file contents from a GitHub repository in YAML format.
Parameters:
owner(string, required): GitHub repository ownerrepo(string, required): GitHub repository namebranch(string, required): Branch name (defaults to 'main')extensions(array of strings, optional): File extensions to filter (e.g.,[".ts", ".js"])directories(array of strings, optional): Directories to include (e.g.,["src", "lib"])
Returns: YAML formatted content with:
files: Map of file paths to their content and typemetadata: Statistics including total files, lines, characters, and tokens
Supported File Types: The tool automatically detects file types based on extensions, supporting 40+ programming languages and file formats including JavaScript, TypeScript, Python, Java, C++, Go, Rust, and many more.
PERSONAL_ACCESS_TOKEN(optional): GitHub Personal Access Token for increased rate limits
Create a .env file:
PERSONAL_ACCESS_TOKEN=your_github_token_hereThe server uses raw.githubusercontent.com for fetching file contents to avoid GitHub API rate limits. Repository structure still uses the GitHub API with these limits:
- Without authentication: 60 requests/hour
- With authentication: 5,000 requests/hour
The server enforces a maximum token limit of 200,000 tokens per request to ensure compatibility with Claude models.