d4v1dl3d4/github-mcp-server
If you are the rightful owner of github-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A Model Context Protocol (MCP) server that provides tools for interacting with the GitHub API.
GitHub MCP Server
A Model Context Protocol (MCP) server that provides tools for interacting with the GitHub API. This server enables LLMs to access GitHub repositories, issues, pull requests, and file contents through a standardized interface.
Features
- Repository Information: Get detailed information about GitHub repositories
- Issues Management: List and retrieve GitHub issues with filtering options
- Pull Requests: Access pull request data and status
- Repository Search: Search for repositories across GitHub
- File Content Access: Retrieve file contents from repositories
- Authentication: Supports GitHub personal access tokens
Prerequisites
- Node.js 18 or higher
- pnpm package manager
- GitHub personal access token (optional, for higher rate limits and private repositories)
Installation
-
Clone or download this repository
-
Install dependencies:
pnpm install -
Build the project:
pnpm run build
Configuration
GitHub Authentication (Optional)
To access private repositories or increase rate limits, set your GitHub personal access token:
export GITHUB_TOKEN=your_github_token_here
You can create a personal access token at: https://github.com/settings/personal-access-tokens
Usage
Running the Server
pnpm start
Development Mode
pnpm run dev
Available Tools
1. get_repository
Get information about a specific GitHub repository.
Parameters:
owner(string, required): Repository ownerrepo(string, required): Repository name
2. list_issues
List issues for a GitHub repository.
Parameters:
owner(string, required): Repository ownerrepo(string, required): Repository namestate(string, optional): Issue state ('open', 'closed', 'all') - default: 'open'limit(number, optional): Maximum number of issues to return - default: 30
3. get_issue
Get details of a specific GitHub issue.
Parameters:
owner(string, required): Repository ownerrepo(string, required): Repository nameissue_number(number, required): Issue number
4. list_pull_requests
List pull requests for a GitHub repository.
Parameters:
owner(string, required): Repository ownerrepo(string, required): Repository namestate(string, optional): PR state ('open', 'closed', 'all') - default: 'open'limit(number, optional): Maximum number of PRs to return - default: 30
5. search_repositories
Search for GitHub repositories.
Parameters:
query(string, required): Search querysort(string, optional): Sort criteria ('stars', 'forks', 'updated') - default: 'stars'order(string, optional): Sort order ('asc', 'desc') - default: 'desc'limit(number, optional): Maximum number of repositories to return - default: 30
6. get_file_content
Get the content of a file from a GitHub repository.
Parameters:
owner(string, required): Repository ownerrepo(string, required): Repository namepath(string, required): File path in the repositoryref(string, optional): Branch, tag, or commit SHA
MCP Integration
This server is designed to work with MCP-compatible clients. The server communicates via stdio and follows the Model Context Protocol specification.
VS Code Integration
For VS Code debugging, the project includes an mcp.json configuration file in the .vscode directory.
Error Handling
The server includes comprehensive error handling for:
- GitHub API rate limiting
- Authentication errors
- Network connectivity issues
- Invalid repository or file paths
Rate Limiting
GitHub API has rate limits:
- Unauthenticated requests: 60 requests per hour
- Authenticated requests: 5,000 requests per hour
Using a GitHub token is recommended for production use.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
ISC License