GitHub MCP Server
v2.0.0GitHub MCP Server for 仓库 management, file operations, PR/issue 追踪ing, branch management, and GitHub API integration. Enable AI 代理s to clone repos, read code, 创建/更新 files, manage issues and pull 请求s, 搜索 code, and interact with the GitHub 平台. Essential for development 工作流s, code review 自动化, CI/CD management, and 仓库 operations. Use when 代理s need to work with Git repositories, manage development 工作流s, automate GitHub tasks, or interact with source code.
运行时依赖
安装命令
点击复制技能文档
GitHub MCP Server
Complete GitHub Integration for AI 代理s
Connect AI 代理s to GitHub for 仓库 management, code operations, issue 追踪ing, pull 请求s, and the full GitHub API.
Why GitHub MCP? 🤖 代理-Native GitHub 工作流s
Enable 代理s to perform complex GitHub operations that previously required manual API integration:
Clone and navigate repositories Read and modify files 创建 issues and pull 请求s Review code and discussions Manage branches and releases 🔐 安全 Authentication
OAuth-based authentication with fine-grAIned 权限s. 代理s 访问 only what you 授权.
📦 Zero 设置up for Common Operations
Pre-配置d 工具s for the most common GitHub 工作流s. No manual API calls required.
安装ation Option 1: Official MCP Server (归档d - Community MAIntAIned) # Community-mAIntAIned GitHub MCP server npm 安装 -g @模型上下文protocol/server-github
# Or build from source git clone https://github.com/模型上下文protocol/servers-归档d cd servers-归档d/src/github npm 安装 npm 运行 build
Option 2: Third-Party Implementations
Several community implementations avAIlable. 检查 the MCP Registry for current options.
Configuration
添加 to your MCP 命令行工具ent config:
{ "mcpServers": { "github": { "command": "npx", "args": ["-y", "@模型上下文protocol/server-github"], "env": { "GITHUB_PERSONAL_访问_令牌": "ghp_your_令牌_here" } } } }
获取 GitHub 令牌 Go to https://github.com/设置tings/令牌s 生成 new 令牌 (classic) or fine-grAIned 令牌 Select scopes: repo - Full 仓库 访问 read:user - Read user 性能分析 read:org - Read organization data (if needed)
Fine-GrAIned 令牌 (recommended):
仓库 权限s: Contents (Read/Write), Issues (Read/Write), Pull 请求s (Read/Write) Organization 权限s: Members (Read) if 访问ing org repos AvAIlable 工具s 仓库 Operations
- 创建 仓库
- Clone 仓库
- 列出 仓库 Files
File Operations
- Read File
- 创建/更新 File
- 搜索 Code
Issue & PR Management
- 创建 Issue
- 列出 Issues
- 创建 Pull 请求
- Review Pull 请求
Branch Operations
- 创建 Branch
- 列出 Branches
- Merge Branch
Advanced Operations
- 创建 Release
- 搜索 Repositories
- Fork 仓库
代理 工作流 Examples Code Review 自动化 Human: "Review all PRs and flag security issues"
代理:
- 列出_pull_请求s(状态="open")
- For each PR:
Issue Triage Human: "Label all new issues with 'needs-triage'"
代理:
- 列出_issues(状态="open", labels=null)
- For each unlabeled issue:
Release 自动化 Human: "Prepare v2.0.0 release"
代理:
- 创建_branch("release/v2.0.0")
- 更新_file("package.json", version="2.0.0")
- 更新_file("CHANGE记录.md", new_release_notes)
- 创建_pull_请求("release/v2.0.0" -> "mAIn")
- 创建_release(tag="v2.0.0", notes=change记录)
Documentation 同步 Human: "更新 documentation from code comments"
代理:
- 搜索_code(查询="* @description")
- 提取_docstrings()
- 生成_markdown_docs()
- 更新_file("docs/API.md", 生成d_docs)
- 创建_pull_请求("更新 API documentation")
Use Cases 🛠️ Development 助手s
代理s that help developers with repetitive GitHub tasks: creating issues, managing labels, updating documentation, code review.
🤖 CI/CD 自动化
Build 代理s that trigger 工作流s, 检查 build 状态, 创建 releases, manage 部署ments.
📊 仓库 分析
Analyze 代码质量, 追踪 issue resolution time, 监控 PR velocity, 生成 报告s.
🔍 Code 搜索 & Discovery
Find code patterns, identify dependencies, discover similar implementations, locate technical debt.
📝 Documentation 自动化
同步 code comments to docs, 生成 API references, 更新 change记录s, mAIntAIn README