Skip to main content
Glama
gh-mcp-server

gh-mcp-server

by leonardo-zhu

GitHub App MCP Monorepo

Welcome to the GitHub App MCP Monorepo. This project provides a robust, modular suite of Model Context Protocol (MCP) servers specifically designed to empower AI Agents with secure, GitHub App-based authentication and repository interaction capabilities.

🏗️ Project Structure

This repository is managed as a pnpm workspace:

  • packages/auth: A modular library handling GitHub App authentication. It registers the get_installation_token tool, which leverages @octokit/auth-app and maintains a robust in-memory token cache.

  • packages/server: The primary entry point. It initializes a global MCP server, mounts tools from the auth package, and provides a Stdio transport interface for integration with AI clients.

  • packages/webhook-proxy: Verifies GitHub webhook signatures and forwards payloads to OpenClaw hooks endpoints.

Related MCP server: Git Repo Auth MCP

🔗 Integration Docs

🚀 Getting Started

Prerequisites

  • Node.js (v18 or higher)

  • pnpm (highly recommended for workspace management)

Installation

  1. Clone the repository:

    git clone https://github.com/leonardo-zhu/gh-mcp.git
    cd gh-mcp
  2. Install dependencies:

    pnpm install
  3. Build the entire project:

    pnpm build

⚙️ Configuration

The server relies on environment variables for GitHub App authentication and HTTP endpoint access control. You can define these in your system or within your MCP client configuration:

Variable

Description

Required

GITHUB_APP_ID

Your GitHub App ID

✅

GITHUB_PRIVATE_KEY

Your GitHub App's private key (content, not path)

✅

GITHUB_INSTALLATION_ID

Default Installation ID for the app

❌

GITHUB_CLIENT_ID

Your GitHub App Client ID

❌

MCP_API_KEY

Bearer token required for all HTTP /gh-mcp requests

✅(HTTP mode)

TIP

Use\n to represent newlines in the GITHUB_PRIVATE_KEY if your configuration format (like JSON) requires a single line.

🤖 Usage with AI Clients

Local Usage (Stdio)

Add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "gh-mcp-server": {
      "command": "node",
      "args": ["/absolute/path/to/gh-mcp/dist/index.js"],
      "env": {
        "GITHUB_APP_ID": "...",
        "GITHUB_PRIVATE_KEY": "...",
        "GITHUB_INSTALLATION_ID": "..."
      }
    }
  }
}

Remote Usage (SSE)

To run the server in HTTP mode for remote access:

  1. Start the server on your backend:

    node /path/to/gh-mcp/dist/index.js --sse --port=3000
  2. Configure your local client to use the SSE endpoint:

    • URL: http://your-server-ip:3000/gh-mcp

    • Auth header: Authorization: Bearer <MCP_API_KEY>

You can also start it from the repo root after build:

pnpm start:sse

Quick connectivity test:

curl -i -X POST 'http://127.0.0.1:3000/gh-mcp' \
  -H 'Accept: application/json, text/event-stream' \
  -H 'Content-Type: application/json' \
  -H 'MCP-Protocol-Version: 2025-03-26' \
  -H 'Authorization: Bearer <MCP_API_KEY>' \
  -d '{
    "jsonrpc":"2.0",
    "id":1,
    "method":"initialize",
    "params":{
      "protocolVersion":"2025-03-26",
      "capabilities":{},
      "clientInfo":{"name":"curl-test","version":"1.0.0"}
    }
  }'
NOTE

All logs in both modes are directed tostderr to avoid corrupting the Stdio MCP protocol stream.

🛠️ Tools Provided

get_installation_token

Generates a short-lived GitHub Installation Access Token (IAT).

  • Arguments: installationId (optional number).

  • Returns: A plain-text token.


🚢 Auto Deploy On master

This repository includes a GitHub Actions workflow that deploys automatically when master is updated:

  • Workflow file: .github/workflows/deploy-master.yml

  • Trigger: push to master (and manual workflow_dispatch)

  • Strategy: build artifact in Actions runner, upload to server, then PM2 reload/start on server

Create these repository secrets before enabling it:

  • DEPLOY_SSH_HOST: target server IP/domain

  • DEPLOY_SSH_PORT: SSH port (optional, defaults to 22)

  • DEPLOY_SSH_USER: SSH username

  • DEPLOY_SSH_PRIVATE_KEY: private key content used by GitHub Actions

  • DEPLOY_PATH: release root path on your server (for example /srv/gh-mcp)

  • DEPLOY_PM2_NAME: PM2 app name (optional, defaults to gh-mcp)

  • DEPLOY_ENV_FILE: shared env file path on server (optional, defaults to /root/global-secrets.env)

  • DEPLOY_SERVICE_ENV_FILE: service-specific env file path on server (optional)

  • DEPLOY_KEEP_RELEASES: number of releases to keep (optional, defaults to 3)

What the deploy job does:

  1. Build with pnpm install --frozen-lockfile and pnpm build on GitHub Actions runner.

  2. Pack release tarball and upload to server via SSH.

  3. Extract into $DEPLOY_PATH/releases/<sha>, then switch $DEPLOY_PATH/current symlink.

  4. Source DEPLOY_ENV_FILE and optional DEPLOY_SERVICE_ENV_FILE.

  5. Use PM2 ecosystem file to reload/start:

    • pm2 reload ecosystem.config.cjs --only <name> --update-env (if exists)

    • pm2 start ecosystem.config.cjs --only <name> --update-env (first deploy)

  6. Clean old releases, keeping latest DEPLOY_KEEP_RELEASES.

Built with ❤️ by Antigravity.

Available Tools

2 tools
get_installation_tokenB

Get a GitHub installation access token using the GitHub App's credentials.

Inputs: installationId.

refresh_installation_tokenA

Force-refresh a GitHub installation access token, bypassing the cache. Useful when token permissions have changed or the current token has been revoked.

Inputs: installationId.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 2 tools

    Disambiguation4/5

    The two tools target the same object (installation token), but the cached-get vs force-refresh distinction is explicit in the descriptions, so an agent can choose correctly. The overlap is minimal and clearly delineated, though the boundary relies entirely on the description rather than the name alone.

    Naming Consistency5/5

    Both names follow a strict snake_case verb_noun pattern (get_installation_token, refresh_installation_token) with a shared noun and precise action verbs. Fully predictable and consistent.

    Tool Count3/5

    Two tools is thin even for a narrow GitHub App credential service; the surface covers only retrieval and refresh, with no way to revoke, inspect, or enumerate. It is not grossly mismatched to the purpose, but it sits at the borderline of minimalism.

    Completeness3/5

    Token lifecycle is only half-covered: there is no revoke/invalidate operation, no way to inspect token expiry or scopes, and no enumeration of installations when multiple exist. Agents can obtain and refresh tokens but hit dead ends for management or discovery tasks.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A lightweight stdio-to-http relay that enables the GitHub MCP server to authenticate using a GitHub App instead of a Personal Access Token. It automatically manages fine-grained permissions and short-lived tokens for secure, organizational AI agent workflows.
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Mints short-lived, scoped GitHub App installation tokens on demand for AI agents to access git repositories or the GitHub API.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides a GitHub-integrated Model Context Protocol server with Octokit client, enabling AI models to interact with GitHub repositories, issues, and pull requests.
      ISC