Skip to content

junielton/mcp-github-context

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCP GitHub Context

npm version License: Apache-2.0 Node.js Version

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-context

From 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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published