GitHub MCP Server
Python MCP server for GitHub operations, providing native tool integration with Claude Code and other MCP clients. It enables managing issues, pull requests, CI status, milestones, and batch operations via natural language.
README
GitHub MCP Server
Python MCP (Model Context Protocol) server for GitHub operations, providing native tool integration with Claude Code and other MCP clients.
Features
- 16 GitHub Tools: Issues, PRs, CI status, milestones, and batch operations
- Native MCP Integration: Works seamlessly with Claude Code
- Structured Responses: Type-safe, well-formatted tool outputs
- Batch Operations: Parallel execution for bulk operations
- Environment-Based Config: Configure default repository via environment variables
Installation
From PyPI
pip install github-mcp-server
# or with uv
uvx github-mcp-server
From Source
git clone https://github.com/rriesco/github-mcp-server.git
cd github-mcp-server
uv sync
Configuration
Environment Variables
| Variable | Required | Description |
|---|---|---|
GITHUB_TOKEN |
Yes | GitHub Personal Access Token with repo scope |
GITHUB_OWNER |
No | Default repository owner for all operations |
GITHUB_REPO |
No | Default repository name for all operations |
Claude Code Configuration
Add to your MCP configuration (~/.config/claude-code/mcp-config.json):
{
"mcpServers": {
"github-manager": {
"type": "stdio",
"command": "uvx",
"args": ["github-mcp-server"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}",
"GITHUB_OWNER": "your-username",
"GITHUB_REPO": "your-repo"
}
}
}
}
Getting a GitHub Token
- Go to https://github.com/settings/tokens
- Click "Generate new token (classic)"
- Select scope:
repo(full repository access) - Copy the generated token
Available Tools
Issue Operations
| Tool | Description |
|---|---|
create_issues |
Create one or more issues (parallel execution for multiple) |
get_issue |
Get full issue details including body |
list_issues |
Query issues with filtering (state, labels, milestone, assignee) |
close_issue |
Close an issue with optional comment |
Pull Request Operations
| Tool | Description |
|---|---|
create_pr_with_content |
Create PR with structured content (problem, solution, changes) |
get_pull_request |
Get PR details including mergeable status |
update_pr |
Update PR title, body, base branch, or state |
merge_pr |
Merge PR with method selection (squash/merge/rebase) |
CI/CD Operations
| Tool | Description |
|---|---|
check_ci_status |
Check workflow run status for a branch |
get_ci_logs |
Get CI logs for debugging failed jobs |
Batch Operations
| Tool | Description |
|---|---|
batch_update_issues |
Update multiple issues in parallel |
batch_add_labels |
Add labels to multiple issues |
batch_link_to_project |
Link issues to GitHub Project (v2) |
Milestone Operations
| Tool | Description |
|---|---|
create_milestone |
Create a milestone with optional due date |
list_milestones |
List milestones with filtering |
Usage Examples
Create an Issue
result = create_issues(
issues=[{
"title": "Implement feature X",
"body": "## Description\n\nDetails here...",
"labels": ["enhancement"],
"milestone": 1
}],
owner="your-username",
repo="your-repo"
)
Check CI Status
result = check_ci_status(
branch="feature-branch",
owner="your-username",
repo="your-repo"
)
Create a PR
result = create_pr_with_content(
title="feat: add new feature",
problem="Current behavior lacks X functionality",
solution="Implement X using approach Y",
key_changes="- Added X component\n- Updated Y module",
issue=42, # Optional: links to issue #42
owner="your-username",
repo="your-repo"
)
Development
Prerequisites
- Python >= 3.10
- uv (recommended) or pip
- GitHub Personal Access Token
Setup
git clone https://github.com/rriesco/github-mcp-server.git
cd github-mcp-server
uv sync
Running Tests
# Unit tests only (fast)
uv run pytest -m "not integration" -v
# Integration tests (requires GITHUB_TOKEN, TEST_OWNER, TEST_REPO)
uv run pytest -m integration -v
# All tests with coverage
uv run pytest --cov=src --cov-report=term-missing
Type Checking
uv run mypy src/github_mcp_server --strict
Architecture
Claude Code / MCP Client
|
| MCP Protocol (stdio)
v
┌─────────────────────────────┐
│ Python FastMCP Server │
│ - Tool Registry │
│ - PyGithub Client │
│ - Error Handling │
│ - Type Validation │
└─────────────┬───────────────┘
|
| PyGithub REST API
v
GitHub API
Project Structure
github-mcp-server/
├── src/github_mcp_server/
│ ├── server.py # Server entry point
│ ├── tools/
│ │ ├── issues.py # Issue operations
│ │ ├── pulls.py # PR operations
│ │ ├── ci.py # CI operations
│ │ ├── milestones.py # Milestone operations
│ │ └── batch_operations.py # Batch operations
│ ├── utils/
│ │ ├── github_client.py # Singleton PyGithub client
│ │ ├── errors.py # Structured error handling
│ │ └── types.py # Type definitions
│ └── config/
│ └── defaults.py # Environment-based defaults
└── tests/
├── test_*.py # Unit tests
└── integration/ # Integration tests
License
MIT License - see LICENSE for details.
Links
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。