@mechris3/github-enterprise-mcp-server
v1.0.7
Published
MCP server for GitHub Enterprise — PR reviews, comments, diffs, and more. No Docker required.
Maintainers
Readme
github-enterprise-mcp-server
An MCP (Model Context Protocol) server for GitHub Enterprise and github.com. Provides AI assistants with tools to read, review, and manage pull requests — no Docker required.
Why This Exists
- GitHub's official MCP server requires Docker or Go tooling
- GitHub's remote MCP server doesn't work with self-hosted GitHub Enterprise instances
- Other third-party servers don't support custom GHE base URLs
This server is a pure Node.js package. It works with any GitHub Enterprise instance and public github.com, configurable via a single environment variable.
Quick Start
Option 1: npx (recommended)
Add to your MCP configuration (e.g. .kiro/settings/mcp.json):
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@mechris3/github-enterprise-mcp-server@latest"],
"env": {
"GITHUB_TOKEN": "ghp_your_token_here",
"GITHUB_BASE_URL": "https://github.example.com/api/v3"
}
}
}
}For public github.com, omit
GITHUB_BASE_URL— it defaults tohttps://api.github.com.
Option 2: Clone and build
git clone https://github.com/mechris3/github-enterprise-mcp-server.git
cd github-enterprise-mcp-server
npm install && npm run buildThen in your MCP config:
{
"mcpServers": {
"github": {
"command": "node",
"args": ["/path/to/github-enterprise-mcp-server/dist/index.js"],
"env": {
"GITHUB_TOKEN": "ghp_your_token_here",
"GITHUB_BASE_URL": "https://github.example.com/api/v3"
}
}
}
}Configuration
Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| GITHUB_TOKEN | Yes* | GitHub Personal Access Token |
| GITHUB_TOKEN_FILE | Yes* | Path to a file containing the token (alternative to GITHUB_TOKEN) |
| GITHUB_BASE_URL | No | API base URL. Defaults to https://api.github.com |
*One of GITHUB_TOKEN or GITHUB_TOKEN_FILE must be set.
Token Resolution Priority
GITHUB_TOKENenvironment variable (used directly)GITHUB_TOKEN_FILEenvironment variable (reads token from file at this path)
Base URL Examples
| Instance | Base URL |
|----------|----------|
| github.com | https://api.github.com (default) |
| GitHub Enterprise | https://github.example.com/api/v3 |
PAT Scopes Required
Generate a Classic Personal Access Token at github.com/settings/tokens (or https://your-ghe-host/settings/tokens for GHE) with:
repo— Full repository access (read/write PRs, comments, files)
Available Tools
Pull Request — Read
| Tool | Description |
|------|-------------|
| get_pull_request | Get PR details (title, body, state, author, branches) |
| list_pull_requests | List PRs for a repo, filtered by state/branch/sort |
| get_diff | Get the full unified diff of a PR |
| get_file_contents | Read a file from a specific branch, tag, or commit |
| get_pull_request_files | List changed files with status and patch info |
Pull Request — Write
| Tool | Description |
|------|-------------|
| create_pull_request | Open a new PR from a head branch into a base branch (supports draft) |
| mark_pull_request_ready | Promote a draft PR to ready-for-review (GraphQL) |
Review Comments — CRUD
| Tool | Description |
|------|-------------|
| get_review_comments | Get all review comments with thread structure (via GraphQL) |
| create_review_comment | Post a new comment on a specific line in the diff |
| add_reply_to_comment | Reply to an existing review comment thread |
| edit_review_comment | Edit the body of an existing review comment |
| delete_review_comment | Delete a review comment |
Reviews
| Tool | Description |
|------|-------------|
| create_review | Submit a batched review with verdict and line comments |
Authentication Examples
Below are complete mcp.json configurations showing the full file structure. Place this at .kiro/settings/mcp.json (Kiro), .vscode/mcp.json (VS Code), or wherever your MCP host reads its config.
GitHub Enterprise — token directly in config
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@mechris3/github-enterprise-mcp-server@latest"],
"env": {
"GITHUB_TOKEN": "ghp_xxxxxxxxxxxx",
"GITHUB_BASE_URL": "https://github.yourcompany.com/api/v3"
}
}
}
}GitHub Enterprise — token from a file
Useful for shared machines, secrets managers, or token rotation:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@mechris3/github-enterprise-mcp-server@latest"],
"env": {
"GITHUB_TOKEN_FILE": "~/.config/github-mcp/token",
"GITHUB_BASE_URL": "https://github.yourcompany.com/api/v3"
}
}
}
}The file should contain only the token string (no newline, no quotes).
GitHub Enterprise — token from system environment
Set GITHUB_TOKEN in your shell profile (.zshrc, .bashrc, etc.):
export GITHUB_TOKEN="ghp_xxxxxxxxxxxx"Then omit it from the config — the server inherits it from the process environment:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@mechris3/github-enterprise-mcp-server@latest"],
"env": {
"GITHUB_BASE_URL": "https://github.yourcompany.com/api/v3"
}
}
}
}Public github.com
Omit GITHUB_BASE_URL entirely — it defaults to https://api.github.com:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@mechris3/github-enterprise-mcp-server@latest"],
"env": {
"GITHUB_TOKEN": "ghp_xxxxxxxxxxxx"
}
}
}
}Using a local build instead of npx
If you cloned and built the repo yourself:
{
"mcpServers": {
"github": {
"command": "node",
"args": ["/absolute/path/to/github-enterprise-mcp-server/dist/index.js"],
"env": {
"GITHUB_TOKEN": "ghp_xxxxxxxxxxxx",
"GITHUB_BASE_URL": "https://github.yourcompany.com/api/v3"
}
}
}
}Requirements
- Node.js 18+ (uses native
fetch) - A GitHub PAT with the
reposcope - An MCP-compatible host (Kiro, VS Code with MCP extension, Cursor, Claude Desktop, etc.)
Troubleshooting
"No GitHub token found"
Set either GITHUB_TOKEN or GITHUB_TOKEN_FILE in your MCP config's env block.
401 Unauthorized
Your token is invalid or expired. Generate a new PAT with the repo scope.
404 Not Found
Either the repo doesn't exist, you don't have access, or the base URL is wrong. For GHE, ensure the URL ends with /api/v3.
GraphQL errors on get_review_comments
This tool uses GraphQL. Ensure your GHE instance supports the GraphQL API (available in GHE 2.12+). The tool automatically falls back to REST if GraphQL fails (you'll still get comments, just without thread structure).
Network errors
Ensure the machine running the MCP server can reach your GitHub Enterprise instance. VPN may be required for on-prem installations.
For AI Assistants / Contributors
See CONTEXT.md for architecture details, conventions, and a step-by-step guide for adding new tools. This file is designed to be consumed by LLMs working on the codebase.
License
MIT
