GitHub MCP Agent Server
Provides tools for interacting with GitHub's API, enabling AI agents to search code, manage issues, create pull requests, and perform code reviews on GitHub repositories.
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., "@GitHub MCP Agent Server list open issues in FMorgan-111/github-mcp-server"
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 MCP Agent Server
MCP server giving AI agents controlled GitHub access with policy guard and audit trail.
Architecture
┌───────────────┐ MCP stdio ┌───────────────────┐
│ AI Agent │ ◄──────────────────────► │ GitHub MCP Server │
│ (Claude, Codex│ JSON-RPC 2.0 │ │
│ or any MCP │ ┌─┴───────────────┐ │
│ client) │ │ Policy Guard │ │
└───────────────┘ ├─────────────────┤ │
│ Audit Log │ │
└─────────────────┘ │
┌──────────────────────────────────────────────┐ │
│ github_client.py │ │
│ (httpx) │ │
│ GitHub API │ │
└──────────────────────────────────────────────┘ │
┌──────────────────────────────────────────────┐ │
│ Review Engine (ruff + regex) │ │
└──────────────────────────────────────────────┘ │
└───┘Related MCP server: github-mcp-demo
Features & Tools
Tool | Description | Example Input | Example Output |
| Search GitHub repo code by query |
| List of matching files with paths & URLs |
| List open or closed issues |
| Formatted list of issues |
| Create a new issue (policy-guarded) |
| Confirmation with issue URL |
| Fetch raw diff of a pull request |
| Unified diff as text |
| Create a pull request between branches |
| Confirmation with PR URL |
| Run local automated code review rules |
| List of warnings and errors found |
| Post review findings as PR comments |
| Number of comments posted |
| Read a file from a repository |
| Decoded file content with metadata |
| Create or update a single file (guarded) |
| Commit SHA and URL |
| Push multiple files as a single commit |
| Commit SHA and file list |
| Comment on an issue or pull request |
| Comment URL |
| Merge a pull request |
| Merge status and SHA |
Security Model
Repository Allowlist: Only repositories explicitly allowed by policy can be accessed.
Branch Protection: PRs to protected branches are subject to branch protection rules before merging.
Dry-Run Mode: Execute operations without side effects for safe testing and auditing.
Audit Logging: All actions logged in JSONL format with precise timestamps to maintain traceability.
Policy Configuration: Start from
policy.example.jsonto configure repository allowlists and protected branches.
FAQ
Why not call the GitHub API directly?
Direct API calls lack centralized policy enforcement, audit logging, and uniform tooling support for AI agents. This MCP server adds a controlled, auditable layer for safer automation.
What MCP clients work with this?
Agents like Claude Code, OpenAI Codex, and any client supporting the MCP JSON-RPC 2.0 transport can connect to this server.
How is this different from the official GitHub MCP server?
This project's key differentiator is policy enforcement. Repository allowlists prevent agents from touching unauthorized repos, branch protection blocks accidental PRs to sensitive branches, dry-run mode supports safe validation, and write actions are audit-logged with timestamps.
Quick Start
Prerequisites
Python 3.10+
GitHub personal access token with
reposcope
Install
pip install fastmcp httpx python-dotenvConfigure and Run
git clone https://github.com/FMorgan-111/github-mcp-server.git
cd github-mcp-server
cp .env.example .env && nano .env
python3 -m src.mainConnect with Claude Code
claude mcp add github-agent -- python3 /path/to/github-mcp-server/src/main.pyDevelopment
pip install -e . --break-system-packages
python3 -m pytest tests/ -v
python3 -m src.main106 tests, all passing.
Docker Deployment
docker build -t github-mcp-server .
docker run \
-e GITHUB_TOKEN=ghp_your_token_here \
-i github-mcp-serverThe -e GITHUB_TOKEN=... flag passes the token into the container because
the local .env file is not copied into the image.
License
MIT
Available Tools
12 toolsadd_issue_commentB
Add a comment to a GitHub issue or pull request.
Inputs: repo (required), issue_number (required), body (required), dry_run. Returns: result
comment_pr_reviewB
Fetch PR diff, run code review, and post findings as review comments.
Inputs: repo (required), pr_number (required). Returns: result
create_issueA
Create a new issue in a GitHub repository.
Inputs: repo (required), title (required), body (required), dry_run. Returns: result
create_or_update_fileB
Create or update a single file in a GitHub repository.
Inputs: repo (required), path (required), content (required), message, +3 more. Returns: result
create_prC
Create a new pull request.
Inputs: repo (required), title (required), body (required), head (required), +2 more. Returns: result
get_file_contentsB
Read a file from a GitHub repository.
Inputs: repo (required), path (required), ref. Returns: result
get_pr_diffC
Get the diff for a pull request.
Inputs: repo (required), pr_number (required). Returns: result
list_issuesC
List issues in a GitHub repository.
Inputs: repo (required), state. Returns: result
merge_pull_requestC
Merge a pull request.
Inputs: repo (required), pr_number (required), commit_title, merge_method, +1 more. Returns: result
push_filesC
Push multiple files as a single commit.
Inputs: repo (required), branch (required), message (required), files_json (required), +1 more. Returns: result
review_pr_diffB
Review a PR diff using ruff + legacy regex rules. Returns structured findings.
Inputs: repo (required), pr_number (required). Returns: result
search_codeC
Search for code in GitHub repositories.
Inputs: query (required), repo. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Most tools have distinct purposes, but `review_pr_diff` and `comment_pr_review` both involve PR review, which could cause slight ambiguity. However, their descriptions clarify the different outputs.
All tool names follow a consistent verb_noun pattern in snake_case, making them predictable and easy to understand. No mixing of conventions.
With 12 tools, the server covers core GitHub operations without being bloated or sparse. Each tool serves a clear purpose.
The tool set covers most common GitHub workflows (issues, PRs, files, code search) but lacks update/delete operations for issues and files, which may require workarounds.
Maintenance
Related MCP Connectors
An MCP server that gives your AI access to the source code and docs of all public github repos
GitHub Copilot MCP: code, repo, PR, workflow tools for AI assistants.
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server that enables AI agents to perform GitHub operations like creating repositories, issues, and commits through natural language.ISC
- FlicenseAqualityDmaintenanceMCP server that wraps GitHub REST API to allow AI agents to search repositories, get repository details, list issues, and read READMEs.4-
- FlicenseCqualityCmaintenanceMCP server that enables LLMs to search GitHub, clone repositories, and perform read-only git/GitHub operations such as listing branches, commits, issues, and pull requests.251-
- FlicenseAqualityDmaintenanceMCP server exposing GitHub tools for issues, pull requests, and code browsing via the GitHub REST API. Designed for local LLM clients with flat arguments and streamable HTTP support.15-