GitHub Repository
Provides access to the contents of a GitHub repository.
MCP GitHub Repository Server
An MCP (Model Context Protocol) server that provides access to GitHub repository contents. This server allows AI assistants to browse and read files from specified GitHub repositories.
Demo

Features
Resources
- Access any file in a GitHub repository via URI
- List repository contents and navigate directories
- Support for branch-specific file access
- File contents are served as plain text
Resource URIs
- Base URL format:
https://api.github.com/repos/{owner}/{repo}/contents/{path} - Supports both files and directories
- Files are served with
text/plainMIME type - Directories are served with
application/x-directoryMIME type
Configuration
The server requires the following environment variables:
GITHUB_PERSONAL_ACCESS_TOKEN=your_github_token
GITHUB_OWNER=repository_owner
GITHUB_REPO=repository_name
GITHUB_BRANCH=branch_name # Optional
Development
Install dependencies:
npm install
Build the server:
npm run build
For development with auto-rebuild:
npm run watch
Installation
To use with Claude Desktop, add the server configuration:
Config Location
- MacOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"mcp-server-github-repo": {
"command": "/path/to/mcp-server-github-repo/build/index.js"
}
}
}
API Implementation
The server implements three main MCP endpoints:
ListResources- Lists files and directories in the repositoryReadResource- Retrieves contents of a specific file
Authentication
The server uses GitHub Personal Access Token for authentication. Make sure your token has appropriate permissions to access the repository contents.
Error Handling
The server includes error handling for:
- Missing environment variables
- GitHub API errors
- Invalid paths (e.g., trying to read a directory as a file)
- Authentication failures
Debugging
Since MCP servers communicate over stdio, debugging can be challenging. Use the MCP Inspector for debugging:
npm run inspector
This will provide a URL to access debugging tools in your browser.
Security Notes
- Keep your GitHub Personal Access Token secure
- Consider using tokens with minimal required permissions
- Be aware of repository size limitations when accessing large repositories
License
MIT
Verwandte Server
GitHub
Interact with GitHub repositories, including file operations, repository management, and search.
Obsidian GitHub MCP
Connects AI assistants to Obsidian vaults stored in GitHub repositories, enabling them to read, search, and analyze your notes and documentation.
Bitbucket
Manage Bitbucket repositories, pull requests, and pipelines via the Bitbucket API for both Cloud and Server.
GitHub MCP Server
Integrates with the GitHub API for automation and interaction with repositories.
MCP GitHub Enterprise
Query GitHub Enterprise license data, including summaries, per-user details, organization memberships, and enterprise roles.
Git MCP Server
An MCP server for performing Git operations.
Star Report
Automatically generates and pushes GitHub repository activity reports (stars, commits, issues) to Feishu groups using AI analysis.
GitHub Explorer MCP
Explore GitHub repositories, including file content, directory structure, and other metadata.
GitHub Project Manager with Resource System
A server for GitHub project management with advanced resource management, capacity planning, and workload optimization capabilities.
GitHub Repos Manager MCP Server
Token-based GitHub automation management. No Docker, Flexible configuration, 80+ tools with direct API integration.