GitHub Prod MCP
A production-ready MCP server for GitHub operations, providing tools for repository management, issues, pull requests, and more via both MCP stdio and REST API.
README
GitHub Prod MCP
Production-ready GitHub MCP server implemented in Python, based on the official GitHub REST API documentation at https://docs.github.com/en/rest.
Features
- MCP stdio server for GitHub operations
- REST API wrapper exposing the same tools
- POST-only tool endpoints
- Request-body-only inputs for tool APIs
- Centralized validation with Pydantic models
- GitHub API version header support
- Timeout handling and normalized API errors
- Shared service layer for MCP and REST parity
Implemented tools
get_authenticated_usercreate_repositoryget_repositoryget_repository_detailslist_branchesget_branchlist_repository_filesget_file_contentsearch_repositoriessearch_codesearch_issueslist_issuesget_issuecreate_issueupdate_issuecreate_issue_commentlist_pull_requestsget_pull_requestcreate_pull_requestmerge_pull_requestget_commitcompare_commitscreate_or_update_filedelete_filecreate_repository_dispatchtrigger_workflow_dispatchlist_workflow_runs
Project structure
src/github_prod_mcp/main.py- MCP stdio serversrc/github_prod_mcp/rest_api.py- REST API wrappersrc/github_prod_mcp/github_api.py- GitHub REST clientsrc/github_prod_mcp/service.py- shared business layersrc/github_prod_mcp/models.py- request and response schemassrc/github_prod_mcp/config.py- environment-driven settings
Requirements
- Python 3.10+
- A GitHub token with the scopes required for the operations you plan to use
Setup
1. Create a virtual environment
PowerShell:
python -m venv .venv
.venv\Scripts\Activate.ps1
2. Install dependencies
python -m pip install --upgrade pip
python -m pip install -e .
3. Configure environment
Copy .env.example to .env and set your token:
GITHUB_TOKEN=ghp_your_token_here
GITHUB_API_BASE_URL=https://api.github.com
GITHUB_API_VERSION=2022-11-28
GITHUB_USER_AGENT=github-prod-mcp/0.1.0
GITHUB_TIMEOUT_SECONDS=30
REST_HOST=127.0.0.1
REST_PORT=8080
LOG_LEVEL=INFO
Run the MCP server
python -m github_prod_mcp.main
Run the REST API
python -m github_prod_mcp.rest_api
REST docs will be available at:
http://127.0.0.1:8080/docshttp://127.0.0.1:8080/openapi.json
REST API design rule
All tool endpoints are exposed as POST endpoints under /tools/....
For tool execution:
- no path variables
- no query variables
- inputs are passed in the JSON request body only
Examples:
Get repository
POST /tools/get_repository
Content-Type: application/json
{
"owner": "octocat",
"repo": "Hello-World"
}
Get repository details
POST /tools/get_repository_details
Content-Type: application/json
{
"owner": "octocat",
"repo": "Hello-World",
"include_branches": true,
"include_root_files": true,
"include_readme": false
}
List repository files
POST /tools/list_repository_files
Content-Type: application/json
{
"owner": "octocat",
"repo": "Hello-World",
"path": "",
"ref": "main"
}
Get file content metadata
POST /tools/get_file_content
Content-Type: application/json
{
"owner": "octocat",
"repo": "Hello-World",
"path": "README.md",
"ref": "main"
}
Create issue
POST /tools/create_issue
Content-Type: application/json
{
"owner": "octocat",
"repo": "Hello-World",
"title": "Bug report",
"body": "Something is broken"
}
Trigger workflow dispatch
POST /tools/trigger_workflow_dispatch
Content-Type: application/json
{
"owner": "octocat",
"repo": "Hello-World",
"workflow_id": "ci.yml",
"ref": "main",
"inputs": {
"environment": "prod"
}
}
MCP registration
Update .bob/mcp.json so Bob can launch the stdio server.
Example configuration:
{
"mcpServers": {
"github-prod-mcp": {
"command": "python",
"args": [
"-m",
"github_prod_mcp.main"
],
"cwd": "c:/Users/abdenourChenouf/Documents/MCP-Github/github-prod-mcp",
"env": {
"GITHUB_TOKEN": "YOUR_GITHUB_TOKEN",
"GITHUB_API_BASE_URL": "https://api.github.com",
"GITHUB_API_VERSION": "2022-11-28",
"GITHUB_USER_AGENT": "github-prod-mcp/0.1.0",
"GITHUB_TIMEOUT_SECONDS": "30",
"LOG_LEVEL": "INFO"
},
"disabled": false,
"alwaysAllow": [],
"disabledTools": []
}
}
}
Production notes
- Use a fine-grained GitHub token with least privilege
- Rotate tokens regularly
- Keep
.envout of source control - Run the REST API behind a reverse proxy for TLS and access control
- Add request authentication in front of the REST API before internet exposure
- Tune timeout and logging for your environment
- Add tests before deploying to shared environments
Official API basis
This implementation follows GitHub REST API conventions including:
Accept: application/vnd.github+jsonAuthorization: Bearer <token>X-GitHub-Api-Version: 2022-11-28
Reference:
https://docs.github.com/en/rest
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。