github-mcp
Connects an AI assistant to a GitHub Enterprise instance to manage repositories and development workflows: clone repos, inspect rulesets and branch protection, create pull requests, review and merge PRs, track issues, search code, publish releases, manage environment configuration, and audit security alerts (Dependabot/CodeQL).
Provides tools for GitHub Actions CI/CD management: analyze failed workflow runs and extract failed steps with log tails, automatically re-run failed jobs when transient errors (timeouts, runner errors, 5xx) are detected, trigger workflow_dispatch runs with custom inputs and refs, and poll running workflows until completion with exponential backoff.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
github-mcp
A Model Context Protocol (MCP) server built with Python and FastAPI that connects your AI coding assistant (GitHub Copilot, Windsurf, Cursor) to your GitHub Enterprise instance (anbgithub.com).
The server exposes 19 tools over Server-Sent Events (SSE) that let your AI assistant clone repos, manage CI/CD pipelines, review and merge pull requests, track issues, search code, publish releases, manage environment config, and audit security alerts -- all through natural language.
Table of Contents
Related MCP server: git-mcp
Prerequisites
Python 3.11+
Git installed and available on your PATH
A GitHub Enterprise Personal Access Token (PAT) from
anbgithub.comwith the following scopes:repo(full control of repositories)workflow(manage GitHub Actions)read:org(read org and team membership)security_events(read security alerts -- Dependabot / CodeQL)
Installation
# 1. Clone this repository
git clone https://github.com/badin017/github-mcp.git
cd github-mcp
# 2. Create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate # macOS / Linux
# .venv\Scripts\activate # Windows
# 3. Install dependencies
pip install -r requirements.txtConfiguration
# Copy the example env file
cp .env.example .envOpen .env and set your token:
# REQUIRED -- your GitHub Enterprise PAT
GITHUB_ENTERPRISE_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx
# OPTIONAL -- override if your Enterprise instance uses a different URL
# GITHUB_BASE_URL=https://anbgithub.com/api/v3
# GITHUB_HOST=anbgithub.comSecurity note:
.envis already listed in.gitignoreand will never be committed.
Starting the Server
python3 main.pyYou should see:
2026-03-15 10:00:00 INFO github-mcp Starting GitHub MCP Server on http://localhost:8000
INFO: Uvicorn running on http://0.0.0.0:8000Verify it is running:
curl http://localhost:8000/health
# {"status":"ok","server":"github-mcp"}Connecting to Your AI Assistant
GitHub Copilot (VS Code)
Open VS Code and make sure GitHub Copilot and Copilot Chat extensions are installed.
Open your User Settings (
Cmd+,on macOS /Ctrl+,on Windows).Search for
mcpin Settings, or directly edit yoursettings.json:
// settings.json
{
"github.copilot.chat.mcpServers": {
"github-enterprise": {
"type": "sse",
"url": "http://localhost:8000/sse"
}
}
}Alternatively, create a
.vscode/mcp.jsonfile at the root of your workspace:
{
"servers": {
"github-enterprise": {
"type": "sse",
"url": "http://localhost:8000/sse"
}
}
}Reload VS Code (
Cmd+Shift+P> Developer: Reload Window).Open Copilot Chat and switch to Agent Mode (click the mode selector at the top of the chat panel).
You should see the MCP tools listed when you click the tools icon. You can now ask Copilot to use them in natural language.
Windsurf
Open Windsurf and go to Settings (gear icon) > MCP Servers (under the Cascade section).
Click Add Server and choose Server-Sent Events (SSE).
Enter the following configuration:
{
"mcpServers": {
"github-enterprise": {
"serverUrl": "http://localhost:8000/sse"
}
}
}Alternatively, edit the Windsurf MCP config file directly:
macOS:
~/.windsurf/mcp_config.jsonWindows:
%APPDATA%\Windsurf\mcp_config.jsonLinux:
~/.config/Windsurf/mcp_config.json
Restart Windsurf or reload the MCP configuration.
Open Cascade (Windsurf's AI panel). The 15 tools will now be available to the AI agent.
Cursor
Open Cursor Settings (
Cmd+,) > MCP Servers.Click + Add new MCP server.
Set type to sse and enter the URL:
{
"mcpServers": {
"github-enterprise": {
"url": "http://localhost:8000/sse"
}
}
}Alternatively, create or edit
~/.cursor/mcp.json:
{
"mcpServers": {
"github-enterprise": {
"url": "http://localhost:8000/sse"
}
}
}Restart Cursor. The tools will appear in Agent mode in the Composer panel.
Available Tools
1. Core Repository Operations
clone_repository
Clone a repository from GitHub Enterprise to your local machine using PAT-authenticated HTTPS.
Parameter | Type | Required | Description |
| string | Yes | Full |
| string | No | Local directory to clone into (default: |
Example prompt:
"Clone the repo
my-org/backend-serviceto./projects/backend."
get_repo_rules
Retrieve active rulesets (newer GitHub API) and branch protection rules for the default branch.
Parameter | Type | Required | Description |
| string | Yes | Repository owner |
| string | Yes | Repository name |
Example prompt:
"What branch protection rules are configured on
my-org/api-gateway?"
Returns: Rulesets with enforcement levels, required status checks, required approvals, CODEOWNERS requirements, signing requirements, and push restrictions.
create_dummy_pr
Create a test pull request by appending a space to README.md using the Git Data API (blob, tree, commit).
Parameter | Type | Required | Description |
| string | Yes | Repository owner |
| string | Yes | Repository name |
| string | No | Target branch (defaults to repo's default branch) |
Example prompt:
"Create a dummy PR on
my-org/test-repotargeting thedevelopbranch."
Returns: PR number, URL, and the name of the created branch.
2. CI/CD & Actions Management
analyze_workflow_run
Analyse a GitHub Actions workflow run and extract detailed error information from failed steps, including log tails.
Parameter | Type | Required | Description |
| string | Yes | Full URL to the workflow run (e.g. |
Example prompt:
"Analyze this failed workflow run: https://anbgithub.com/my-org/service/actions/runs/456789"
Returns: Workflow name, status, conclusion, branch, event trigger, failed job names, failed step names, and the last 50 lines of logs from each failed job.
handle_failed_workflow
Automatically re-run failed jobs if the failure is caused by a transient error (internal error, timeout, runner error, 502/503).
Parameter | Type | Required | Description |
| string | Yes | Full URL to the workflow run |
| string | Yes | Action to take -- use |
Example prompt:
"The build at https://anbgithub.com/my-org/service/actions/runs/456789 failed with a timeout. Rerun the failed jobs."
Behavior: Scans failed job logs for transient error indicators. If found, triggers the rerun-failed-jobs API. If not transient, recommends manual investigation.
trigger_workflow
Trigger a workflow_dispatch event to start a new workflow run with custom input parameters.
Parameter | Type | Required | Description |
| string | Yes | Repository owner |
| string | Yes | Repository name |
| string | Yes | Workflow ID or filename (e.g. |
| string | No | Git ref to run against (defaults to repo default branch) |
| object | No | JSON object of workflow input key-value pairs |
Example prompt:
"Trigger the
deploy.ymlworkflow onmy-org/frontendfor thestagingbranch with inputenvironmentset tostaging."
monitor_workflow_status
Poll a running workflow until it completes. Uses exponential backoff (starts at 10s, caps at 60s, times out at 600s by default).
Parameter | Type | Required | Description |
| string | Yes | Repository owner |
| string | Yes | Repository name |
| integer | Yes | Workflow run ID to monitor |
| integer | No | Initial poll interval in seconds (default 10) |
| integer | No | Maximum wait time in seconds (default 600) |
Example prompt:
"Monitor workflow run 789012 on
my-org/backenduntil it finishes."
Returns: Timestamped status updates and the final conclusion (success/failure) with a link to the run.
3. Pull Request & Code Review
review_and_merge_pr
Check if all CI status checks and check-runs have passed on a PR. If everything is green, approve the PR and merge it.
Parameter | Type | Required | Description |
| string | Yes | Repository owner |
| string | Yes | Repository name |
| integer | Yes | Pull request number |
| string | No |
|
Example prompt:
"If all checks pass on PR #42 in
my-org/api, approve it and squash-merge."
Behavior: Blocks if any check is failing or still running. On success, approves and merges in one operation.
add_pr_comment
Add an inline review comment on a specific file and line number in a pull request diff.
Parameter | Type | Required | Description |
| string | Yes | Repository owner |
| string | Yes | Repository name |
| integer | Yes | Pull request number |
| string | Yes | Relative path of the file to comment on |
| integer | Yes | Line number in the diff |
| string | Yes | Comment body (supports markdown) |
Example prompt:
"On PR #42 in
my-org/api, add a review comment on line 15 ofsrc/handler.pysaying 'This function should validate the input before processing.'"
4. Issue Tracking & Project Management
search_and_create_issue
Search the repository's open issues for duplicates first. If no match is found, create a new issue with labels and assign it to the authenticated user.
Parameter | Type | Required | Description |
| string | Yes | Repository owner |
| string | Yes | Repository name |
| string | Yes | Issue title (also used as the search query) |
| string | No | Issue body in markdown |
| string[] | No | Labels to apply (e.g. |
Example prompt:
"Create a bug issue on
my-org/backendtitled 'NullPointerException in UserService.getProfile' with the labelbug."
Behavior: If a similar open issue already exists, it returns the duplicates instead of creating a new one.
link_pr_to_issue
Update a pull request's description to include Closes #<issue_number> so that merging the PR automatically closes the linked issue.
Parameter | Type | Required | Description |
| string | Yes | Repository owner |
| string | Yes | Repository name |
| integer | Yes | Pull request number |
| integer | Yes | Issue number to link |
Example prompt:
"Link PR #42 to issue #17 in
my-org/backend."
Behavior: Idempotent -- if the closing reference already exists in the PR body, it skips the update.
5. Code Search & Navigation
search_enterprise_codebase
Search for code across your entire GitHub Enterprise instance or scoped to a specific org/repo using the GitHub Search API.
Parameter | Type | Required | Description |
| string | Yes | Search query (function names, error codes, configs) |
| string | No | Org or user to scope the search to |
| string | No | Repository to scope the search to |
| string | No | Filter by programming language (e.g. |
| integer | No | Results per page (default 10, max 100) |
Example prompt:
"Search for
DatabaseConnectionPoolacross all repos inmy-org, filtered to Java files."
Returns: List of matching files with repository name, file path, and code fragment previews.
get_file_history
Fetch the commit history for a specific file to understand who changed it, when, and why.
Parameter | Type | Required | Description |
| string | Yes | Repository owner |
| string | Yes | Repository name |
| string | Yes | Path to the file within the repository |
| string | No | Branch to query (defaults to repo default) |
| integer | No | Number of commits to return (default 15) |
Example prompt:
"Show me the commit history for
src/config/database.ymlinmy-org/backend."
Returns: Commit SHA, date, author, and first line of each commit message.
6. Security & Enterprise Compliance
check_security_alerts
Retrieve active Dependabot vulnerability alerts and Code Scanning (CodeQL) alerts for a repository.
Parameter | Type | Required | Description |
| string | Yes | Repository owner |
| string | Yes | Repository name |
| string | No | Filter by state: |
Example prompt:
"Check for open security vulnerabilities in
my-org/payment-service."
Returns: For each alert: severity level, affected package, advisory summary, and recommended fix version.
get_team_members
List all members of a specific team within an organization. Useful for dynamically assigning PR reviewers based on team structure.
Parameter | Type | Required | Description |
| string | Yes | Organization name |
| string | Yes | Team slug (URL-friendly team name) |
Example prompt:
"List all members of the
platform-engteam inmy-org."
Returns: List of team members with their GitHub usernames and IDs.
7. Release & Artifact Management
generate_and_publish_release
Auto-generate release notes summarizing all merged PRs between two tags and publish a new GitHub Release.
Parameter | Type | Required | Description |
| string | Yes | Repository owner |
| string | Yes | Repository name |
| string | Yes | Tag for the new release (e.g. |
| string | Yes | Previous tag to diff against for release notes |
| string | No | Branch the tag points to (defaults to repo default) |
| boolean | No | Create as draft release (default |
| boolean | No | Mark as prerelease (default |
Example prompt:
"Generate release notes for
v2.1.0based on changes sincev2.0.0inmy-org/backendand publish the release."
Returns: Release URL, generated name, tag info, and the full auto-generated release notes body listing all merged PRs, new contributors, etc.
download_workflow_artifact
Download and extract a build artifact (compiled logs, coverage reports, crash dumps, etc.) from a workflow run into the local workspace so the AI can analyze the raw files.
Parameter | Type | Required | Description |
| string | Yes | Repository owner |
| string | Yes | Repository name |
| integer | Yes | Workflow run ID |
| string | No | Name of the artifact to download (downloads the first if omitted) |
| string | No | Local directory to extract into (default |
Example prompt:
"Download the test coverage artifact from workflow run 123456 in
my-org/backendand tell me which files have low coverage."
Returns: Extraction path, artifact size, and a list of all extracted files. The AI can then read the extracted files directly.
8. Environment & Configuration Automation
manage_repo_variables
Read or update GitHub Actions repository variables (non-secret configuration values). Useful for toggling feature flags or changing configuration across environments directly from the AI chat.
Parameter | Type | Required | Description |
| string | Yes | Repository owner |
| string | Yes | Repository name |
| string | Yes | Variable name to read or update |
| string | No | New value to set (omit to read current value) |
Example prompt (read):
"What is the current value of the
FEATURE_FLAG_NEW_UIvariable inmy-org/frontend?"
Example prompt (write):
"Set the
DEPLOY_TARGETvariable tostaging-2inmy-org/frontend."
Behavior: When writing, the tool attempts to update the variable. If it doesn't exist yet, it creates it automatically.
get_deployment_status
Fetch the latest deployment history for a specific environment (e.g. production, staging). Lets the AI verify whether a recent PR actually made it to production.
Parameter | Type | Required | Description |
| string | Yes | Repository owner |
| string | Yes | Repository name |
| string | Yes | Environment name (e.g. |
| integer | No | Number of deployments to return (default 10) |
Example prompt:
"Show me the last 5 deployments to
productionformy-org/api-gateway. Did the latest one succeed?"
Returns: For each deployment: status (SUCCESS/FAILURE/PENDING), git ref, commit SHA, deployer, timestamp, description, and environment URL.
Usage Examples
Here are end-to-end scenarios you can accomplish by prompting your AI assistant:
Deploy and Monitor
"Trigger the
deploy.ymlworkflow onmy-org/frontendfor therelease/v2.1branch with inputenvironment=production, then monitor it until it completes."
The AI will call trigger_workflow followed by monitor_workflow_status.
Full PR Lifecycle
"Create a bug issue titled 'Fix login timeout on mobile' with label
bugonmy-org/app. Then link PR #55 to that issue. Once CI passes, approve and squash-merge the PR."
The AI will chain search_and_create_issue > link_pr_to_issue > review_and_merge_pr.
Investigate a Failure
"Analyze the failed workflow at https://anbgithub.com/my-org/service/actions/runs/789. If it's a transient error, rerun the failed jobs."
The AI will call analyze_workflow_run and then handle_failed_workflow.
Debug Build Artifacts
"Download the test-results artifact from run 456789 in
my-org/backend. What tests failed?"
The AI will call download_workflow_artifact, then read the extracted test report files to identify failures.
Release a New Version
"Generate release notes for
v3.0.0fromv2.9.0inmy-org/platformand publish it. Then check if the production deployment succeeded."
The AI will chain generate_and_publish_release > get_deployment_status.
Environment Config Update
"Set the
MAINTENANCE_MODEvariable totrueonmy-org/api, trigger thedeploy.ymlworkflow, and monitor it until done."
The AI will chain manage_repo_variables > trigger_workflow > monitor_workflow_status.
Security Audit
"Check for open security alerts in
my-org/payment-serviceand create issues for any critical vulnerabilities."
The AI will call check_security_alerts and then search_and_create_issue for each critical finding.
Code Archaeology
"Search for
parseAuthTokenacrossmy-orgin TypeScript files, then show me the commit history for the file where it's defined."
The AI will call search_enterprise_codebase followed by get_file_history.
API Endpoints
Endpoint | Method | Description |
| GET | Health check |
| GET | MCP SSE connection (for clients) |
| POST | MCP message transport |
Troubleshooting
Server won't start
GITHUB_ENTERPRISE_TOKEN is not set. Add it to a .env file and restart.Make sure you created a .env file from .env.example and set your PAT.
Authentication failed
Error: Authentication failed - check GITHUB_ENTERPRISE_TOKEN.Your token may be expired or lack the required scopes. Generate a new PAT at https://anbgithub.com/settings/tokens with repo, workflow, read:org, and security_events scopes.
Rate limit exceeded
Error: Rate limit exceeded. Resets at epoch 1741234567.GitHub Enterprise has API rate limits. The server reports when your limit resets. Wait until then or use a token with higher limits.
Tools not showing in Copilot / Windsurf / Cursor
Make sure the server is running (
curl http://localhost:8000/health).Verify the MCP config points to
http://localhost:8000/sse.Restart / reload your editor after changing MCP configuration.
In Copilot, ensure you are in Agent Mode (not Ask or Edit mode).
404 on Rulesets / Security Alerts
Some GitHub Enterprise versions may not support all API endpoints (rulesets, Dependabot alerts, code scanning). The tools handle this gracefully and report which endpoints are unavailable.
License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Access the GitHub API, enabling file operations, repository management, search functionality, and…
Operate GitHub from your AI assistant: repos, PRs, issues, Actions. Previews and read-only mode.
Manage repositories, users, releases, and automate GitHub workflows
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to perform GitHub operations such as creating repositories, issues, pull requests, and more through natural language.-
- FlicenseBqualityDmaintenanceEnables AI clients to interact with GitHub repositories, issues, pull requests, and code search through the GitHub REST API.12-
- FlicenseNot gradedqualityBmaintenanceEnables AI assistants to interact with GitHub through the GitHub REST API, supporting repository, file, issue, pull request, branch, commit, search, and label operations with explicit confirmation for write operations.-
- AlicenseAqualityDmaintenanceConnects AI assistants to GitHub repositories, pull requests, issues, commits, and code search while enabling repository visibility controls, CI/CD monitoring, sandboxed local filesystem access, and code quality/security analysis.131MIT