GI

GitHub Enterprise MCP Server for Integrations

Integrate GitHub Enterprise with tools using an MCP server to streamline workflows, automate tasks, and secure interactions.

Quick Install
npx -y @ddukbg/github-enterprise-mcp

Overview

The GitHub Enterprise MCP (Model Context Protocol) Server provides a lightweight bridge between GitHub Enterprise and external tools that need structured repository, pull request, and issue context. It implements the MCP pattern—exposing contextual project data and tooling actions through a small HTTP API—so integrations and automation can query, mutate, and react to repository state without embedding complex GitHub API logic in each tool.

This server is useful when you want to centralize GitHub Enterprise connectivity: manage tokens and webhooks in one place, normalize repository metadata for downstream systems (LLM assistants, CI systems, ticketing syncs), and reduce repetitive GitHub API code across multiple integrations. It can run alongside existing CI/CD or observability stacks and act as a secure, audited gateway between internal services and your GitHub Enterprise instance.

Repository and source code: https://github.com/ddukbg/github-enterprise-mcp

Features

  • Centralized MCP API to expose repository, PR, issue, and branch context
  • Authentication and scoped token management for GitHub Enterprise
  • Webhook listener to surface GitHub events to MCP clients
  • Registerable “tools” / integrations with configurable permissions
  • TLS support and configurable logging for production deployments
  • Health checks and simple metrics for orchestration and monitoring

Installation / Configuration

These instructions assume you are deploying the server in a typical Linux environment or container runtime. Adjust paths and service managers as needed.

  1. Clone the repository:
git clone https://github.com/ddukbg/github-enterprise-mcp.git
cd github-enterprise-mcp
  1. Create an environment file (.env) with the minimum variables:
# .env
GHE_HOST=https://ghe.example.com
GHE_TOKEN=ghp_exampleEnterpriseToken12345
MCP_PORT=8080
MCP_BASE_PATH=/mcp
LOG_LEVEL=info
TLS_CERT=/etc/ssl/certs/mcp.crt    # optional
TLS_KEY=/etc/ssl/private/mcp.key   # optional
  1. Install dependencies and run (if the project is Node-based):
# install
npm install

# run in development
npm run dev

# production
npm run start
  1. Docker (example docker-compose service):
version: "3.8"
services:
  mcp-server:
    image: your-registry/github-enterprise-mcp:latest
    ports:
      - "8080:8080"
    environment:
      - GHE_HOST=https://ghe.example.com
      - GHE_TOKEN=${GHE_TOKEN}
      - MCP_PORT=8080
      - LOG_LEVEL=info
    volumes:
      - /etc/ssl/certs:/etc/ssl/certs:ro
      - /etc/ssl/private:/etc/ssl/private:ro

Notes:

  • Ensure the GHE_TOKEN has the minimum scopes required by your use cases (repo, read:org, etc.).
  • For high-availability, put the server behind a load balancer and use shared backing stores for any persisted state.

Available Resources

The MCP server exposes a small HTTP surface. Typical endpoints you’ll use:

EndpointMethodPurpose
/healthGETLiveness and readiness checks
/v1/contextGETRetrieve contextual data for a repo/PR/issue
/v1/toolsPOST / GET / DELETERegister, list or remove integrations
/v1/webhookPOSTGitHub webhook receiver (configured in GHE)
/metricsGETExport basic metrics for scraping

Example: fetch context for a pull request

curl -H "Authorization: Bearer $MCP_TOOL_TOKEN" \
  "https://mcp.example.com/mcp/v1/context?repo=org/repo&pr=123"

Tool registration (example payload):

POST /mcp/v1/tools
{
  "name": "code-assistant",
  "description": "LLM-backed code reviewer",
  "scopes": ["read:repo", "read:pull_request"]
}

Use Cases

  • Automating PR status comments with an LLM: register an LLM-based “assistant” tool that can request PR diff/context via the MCP API, analyze changes, and post findings as PR comments without handling GitHub tokens directly.
  • Centralized webhook processing: route GitHub webhooks to the MCP server, normalize events, and let multiple internal services subscribe to context-aware notifications through the MCP tool registry.
  • Security scans and gating: a scanning integration can query repository and branch context, run configured checks, and write status checks or block merges based on results—all using the MCP as the single connector to GitHub Enterprise.
  • Issue triage automation: an automation tool can fetch issue metadata, labels, and linked PRs through the MCP server and apply label/classification logic consistently across projects.
  • CI orchestration: let CI agents fetch concise build-relevant metadata (changed files, commit messages, CI policy) from MCP to choose targeted pipelines and speed up builds.

Tips for Developers

  • Keep tokens scoped narrowly and rotate regularly. Prefer per-tool tokens when possible.
  • Use the /health endpoint to integrate with Kubernetes liveness/readiness probes.
  • For production, terminate TLS at a load balancer or enable TLS with provided certs; set LOG_LEVEL to info or warn.
  • When adding new tools, document required scopes and expected callback URLs in a central registry to simplify onboarding.

For full source, examples, and contribution guidelines, see the GitHub repository: https://github.com/ddukbg/github-enterprise-mcp