gh-mcp-server
Provides GitHub App authentication by generating short-lived installation access tokens, enabling AI agents to interact with GitHub repositories and installations on the user's behalf.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gh-mcp-server mint an installation access token for installation 12345678"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 theget_installation_tokentool, which leverages@octokit/auth-appand maintains a robust in-memory token cache.packages/server: The primary entry point. It initializes a global MCP server, mounts tools from theauthpackage, 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
OpenClaw Webhook Proxy Integration: end-to-end setup for GitHub App webhook -> gh-mcp proxy -> OpenClaw mapped hooks.
Webhook E2E Local Test: reusable local signed-webhook test with mock OpenClaw.
🚀 Getting Started
Prerequisites
Installation
Clone the repository:
git clone https://github.com/leonardo-zhu/gh-mcp.git cd gh-mcpInstall dependencies:
pnpm installBuild 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 |
| Your GitHub App ID | ✅ |
| Your GitHub App's private key (content, not path) | ✅ |
| Default Installation ID for the app | ❌ |
| Your GitHub App Client ID | ❌ |
| Bearer token required for all HTTP | ✅(HTTP mode) |
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:
Start the server on your backend:
node /path/to/gh-mcp/dist/index.js --sse --port=3000Configure your local client to use the SSE endpoint:
URL:
http://your-server-ip:3000/gh-mcpAuth header:
Authorization: Bearer <MCP_API_KEY>
You can also start it from the repo root after build:
pnpm start:sseQuick 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"}
}
}'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.ymlTrigger:
pushtomaster(and manualworkflow_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/domainDEPLOY_SSH_PORT: SSH port (optional, defaults to22)DEPLOY_SSH_USER: SSH usernameDEPLOY_SSH_PRIVATE_KEY: private key content used by GitHub ActionsDEPLOY_PATH: release root path on your server (for example/srv/gh-mcp)DEPLOY_PM2_NAME: PM2 app name (optional, defaults togh-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 to3)
What the deploy job does:
Build with
pnpm install --frozen-lockfileandpnpm buildon GitHub Actions runner.Pack release tarball and upload to server via SSH.
Extract into
$DEPLOY_PATH/releases/<sha>, then switch$DEPLOY_PATH/currentsymlink.Source
DEPLOY_ENV_FILEand optionalDEPLOY_SERVICE_ENV_FILE.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)
Clean old releases, keeping latest
DEPLOY_KEEP_RELEASES.
Built with ❤️ by Antigravity.
Available Tools
2 toolsget_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
Scored across 2 tools
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.
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.
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.
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
Related MCP Connectors
Operate GitHub from your AI assistant: repos, PRs, issues, Actions. Previews and read-only mode.
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Hosted coding agent: start, follow up on and stop tasks that can open GitHub pull requests.
Git-backed platform for skills, tools, and context for AI agents
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA 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
- FlicenseNot gradedqualityCmaintenanceMints short-lived, scoped GitHub App installation tokens on demand for AI agents to access git repositories or the GitHub API.-
- AlicenseAqualityDmaintenanceEnables LLMs to list, create, and comment on GitHub issues using your own GitHub identity via stdio transport.3MIT
- AlicenseNot gradedqualityDmaintenanceProvides a GitHub-integrated Model Context Protocol server with Octokit client, enabling AI models to interact with GitHub repositories, issues, and pull requests.ISC