mcp-github-context
v1.0.0
Published
GitHub MCP server for contextualizing code work with PRs, reviews, commits, and more
Maintainers
Readme
MCP GitHub Context
A Model Context Protocol (MCP) server that provides GitHub context to AI assistants and editors.
✨ Features
- 📥 Fetch pull request diffs
- 📋 List and inspect pull requests, comments, and reviews
- 📁 List files in PRs and inspect commits
- 🔀 Compare branches
- 🔍 Extract Git remote info from local repositories
📦 Installation
From npm
npm install -g mcp-github-contextFrom source
git clone https://github.com/junielton/mcp-github-context.git
cd mcp-github-context
npm install
npm run build🚀 Usage
Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| GITHUB_TOKEN | Recommended | GitHub Personal Access Token for private repos and higher rate limits (5000/hour vs 60/hour) |
Generate a token at: https://github.com/settings/tokens
Required scopes: repo for private repos, or public_repo for public only.
Running the server
# Development
GITHUB_TOKEN=your_token npm run dev
# Production
GITHUB_TOKEN=your_token npm start
# If installed globally
GITHUB_TOKEN=your_token mcp-github-context🔧 MCP Client Configuration
Add this to your MCP client configuration (e.g., Claude, Cursor, etc.):
Using npx (recommended)
{
"mcpServers": {
"github-context": {
"command": "npx",
"args": ["-y", "mcp-github-context"],
"env": {
"GITHUB_TOKEN": "your_github_token_here"
}
}
}
}Using global install
{
"mcpServers": {
"github-context": {
"command": "mcp-github-context",
"env": {
"GITHUB_TOKEN": "your_github_token_here"
}
}
}
}Using local install
{
"mcpServers": {
"github-context": {
"command": "node",
"args": ["/path/to/mcp-github-context/dist/server.js"],
"env": {
"GITHUB_TOKEN": "your_github_token_here"
}
}
}
}🛠️ Available Tools
| Tool | Description |
|------|-------------|
| fetch_github_pr_diff | Fetch raw diff content from a PR |
| list_pull_requests | List PRs with optional filters (state, limit) |
| get_pr_details | Get complete PR details (title, body, labels, stats) |
| get_pr_comments | Fetch all PR comments (general + review) |
| get_pr_reviews | Get all PR reviews with status |
| get_pr_files | List files changed in a PR with stats |
| compare_branches | Compare two branches (commits, files) |
| get_commit_details | Get commit info (author, message, files) |
| get_git_remote_info | Extract owner/repo from local Git repository |
💡 Example Prompts
Once configured, you can use prompts like:
- "List the open PRs in facebook/react"
- "Get details of PR #123 from org/repo"
- "Show me the diff for PR #456"
- "Compare main and develop branches in org/repo"
- "What files were changed in commit abc123?"
📄 License
Apache-2.0 — see LICENSE
👤 Author
junielton - GitHub
🙏 Acknowledgments
- Built on the Model Context Protocol
- Powered by GitHub REST API
