github-mcp
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMode: Cognitive/Prompt-Driven — No standalone utility script; use via agent context.
模式:认知/提示驱动 — 无独立实用脚本;需通过Agent上下文使用。
GitHub Skill
GitHub Skill
Overview
概述
This skill provides access to the official GitHub MCP server with progressive disclosure for optimal context usage.
Context Savings: ~95% reduction
- MCP Mode: ~50,000 tokens always loaded (80+ tools)
- Skill Mode: ~500 tokens metadata + on-demand loading
本Skill提供对官方GitHub MCP服务器的访问权限,采用渐进式披露机制以优化上下文使用。
上下文节省率: 约95%的缩减
- MCP模式: 始终加载约50,000个Token(80+工具)
- Skill模式: 约500个Token元数据 + 按需加载
Requirements
要求
- Docker installed and running
- environment variable set
GITHUB_PERSONAL_ACCESS_TOKEN
- Docker已安装并运行
- 已设置环境变量
GITHUB_PERSONAL_ACCESS_TOKEN
Toolsets
工具集
The server provides 80+ tools across 19 toolsets:
| Toolset | Description |
|---|---|
| Workflow management, runs, jobs, artifacts |
| Scanning alerts, code analysis |
| Forum interactions |
| Code snippets management |
| Issue creation, updates, commenting |
| Label management and filtering |
| GitHub Projects board management |
| PR creation, review, merging |
| Code search, commits, releases, branches |
| User search and management |
| Organization and team management |
| Notification management |
| Secret scanning alerts |
| Context about the user |
服务器提供涵盖19个工具集的80+工具:
| 工具集 | 描述 |
|---|---|
| 工作流管理、运行、任务、制品 |
| 扫描告警、代码分析 |
| 论坛交互 |
| 代码片段管理 |
| 议题创建、更新、评论 |
| 标签管理与过滤 |
| GitHub Projects看板管理 |
| PR创建、评审、合并 |
| 代码搜索、提交、发布、分支 |
| 用户搜索与管理 |
| 组织与团队管理 |
| 通知管理 |
| 密钥扫描告警 |
| 用户相关上下文 |
Quick Reference
快速参考
Use the CLI for GitHub operations:
ghbash
undefined使用 CLI执行GitHub操作:
ghbash
undefinedGet repository info
获取仓库信息
gh repo view anthropics/claude-code
gh repo view anthropics/claude-code
List issues
列出议题
gh issue list --repo anthropics/claude-code
gh issue list --repo anthropics/claude-code
Search code
搜索代码
gh search code "language:python MCP"
gh search code "language:python MCP"
Create issue
创建议题
gh issue create --repo me/myrepo --title "Bug" --body "Description"
gh issue create --repo me/myrepo --title "Bug" --body "Description"
List pull requests
列出拉取请求
gh pr list --repo anthropics/claude-code
undefinedgh pr list --repo anthropics/claude-code
undefinedCommon Tools (Default Toolsets: 40 tools)
常用工具(默认工具集:40个工具)
Repository Operations
仓库操作
- - Search for repositories
search_repositories - - Create a new repository
create_repository - - Fork a repository
fork_repository - - List repository commits
list_commits - - Get commit details
get_commit - - Get file contents from a repository
get_file_contents - - Create or update a file
create_or_update_file - - Delete a file
delete_file - - Push multiple files
push_files - - Search for code across GitHub
search_code - - List repository branches
list_branches - - Create a new branch
create_branch - - List repository tags
list_tags - - Get tag details
get_tag - - List releases
list_releases - - Get latest release
get_latest_release - - Get release by tag
get_release_by_tag
- - 搜索仓库
search_repositories - - 创建新仓库
create_repository - - 复刻仓库
fork_repository - - 列出仓库提交记录
list_commits - - 获取提交详情
get_commit - - 获取仓库中文件内容
get_file_contents - - 创建或更新文件
create_or_update_file - - 删除文件
delete_file - - 推送多个文件
push_files - - 在GitHub全平台搜索代码
search_code - - 列出仓库分支
list_branches - - 创建新分支
create_branch - - 列出仓库标签
list_tags - - 获取标签详情
get_tag - - 列出发布版本
list_releases - - 获取最新发布版本
get_latest_release - - 通过标签获取发布版本
get_release_by_tag
Issue Operations
议题操作
- - List repository issues
list_issues - - Read issue details
issue_read - - Create/update issues
issue_write - - Add a comment to an issue
add_issue_comment - - Search for issues
search_issues - - List issue types (for organizations)
list_issue_types - - Get label details
get_label - - Manage sub-issues
sub_issue_write - - Assign Copilot to an issue
assign_copilot_to_issue
- - 列出仓库议题
list_issues - - 查看议题详情
issue_read - - 创建/更新议题
issue_write - - 为议题添加评论
add_issue_comment - - 搜索议题
search_issues - - 列出议题类型(适用于组织)
list_issue_types - - 获取标签详情
get_label - - 管理子议题
sub_issue_write - - 为议题分配Copilot
assign_copilot_to_issue
Pull Request Operations
拉取请求操作
- - List repository pull requests
list_pull_requests - - Read PR details
pull_request_read - - Create a new PR
create_pull_request - - Update a PR
update_pull_request - - Update PR branch
update_pull_request_branch - - Merge a PR
merge_pull_request - - Search for pull requests
search_pull_requests - - Create/submit PR reviews
pull_request_review_write - - Add comments to pending review
add_comment_to_pending_review - - Request Copilot review
request_copilot_review
- - 列出仓库拉取请求
list_pull_requests - - 查看PR详情
pull_request_read - - 创建新PR
create_pull_request - - 更新PR
update_pull_request - - 更新PR分支
update_pull_request_branch - - 合并PR
merge_pull_request - - 搜索拉取请求
search_pull_requests - - 创建/提交PR评审
pull_request_review_write - - 为待评审PR添加评论
add_comment_to_pending_review - - 请求Copilot评审
request_copilot_review
User & Team Operations
用户与团队操作
- - Get current authenticated user
get_me - - Search for users
search_users - - Get organization teams
get_teams - - Get team members
get_team_members
- - 获取当前已认证用户信息
get_me - - 搜索用户
search_users - - 获取组织团队信息
get_teams - - 获取团队成员信息
get_team_members
Configuration
配置
The skill uses Docker to run the official GitHub MCP server:
- Image:
ghcr.io/github/github-mcp-server - Auth: environment variable
GITHUB_PERSONAL_ACCESS_TOKEN
本Skill使用Docker运行官方GitHub MCP服务器:
- 镜像:
ghcr.io/github/github-mcp-server - 认证: 环境变量
GITHUB_PERSONAL_ACCESS_TOKEN
Environment Variables
环境变量
| Variable | Required | Description |
|---|---|---|
| Yes | GitHub PAT for authentication |
| No | For GitHub Enterprise (default: github.com) |
| No | Comma-separated toolsets to enable |
| No | Set to 1 for read-only mode |
| 变量名 | 是否必填 | 描述 |
|---|---|---|
| 是 | 用于认证的GitHub PAT |
| 否 | 适用于GitHub Enterprise(默认值:github.com) |
| 否 | 要启用的工具集,以逗号分隔 |
| 否 | 设置为1时启用只读模式 |
Limiting Toolsets
限制工具集
When using MCP, configure toolsets via environment variables:
bash
undefined使用MCP时,可通过环境变量配置工具集:
bash
undefinedOnly repos and issues
仅启用repos和issues
GITHUB_TOOLSETS=repos,issues
GITHUB_TOOLSETS=repos,issues
Only pull requests and code security
仅启用pull requests和code security
GITHUB_TOOLSETS=pull_requests,code_security
undefinedGITHUB_TOOLSETS=pull_requests,code_security
undefinedError Handling
错误处理
If operations fail:
- Verify Docker is running:
docker ps - Check GitHub token is set:
echo $GITHUB_PERSONAL_ACCESS_TOKEN - Ensure token has required permissions for the operation
- Use to verify authentication
gh auth status
若操作失败:
- 验证Docker是否在运行:
docker ps - 检查GitHub令牌是否已设置:
echo $GITHUB_PERSONAL_ACCESS_TOKEN - 确保令牌拥有操作所需的权限
- 使用验证认证状态
gh auth status
Related
相关链接
- Official GitHub MCP Server: https://github.com/github/github-mcp-server
- GitHub API Documentation: https://docs.github.com/en/rest
- 官方GitHub MCP服务器:https://github.com/github/github-mcp-server
- GitHub API文档:https://docs.github.com/en/rest
Memory Protocol (MANDATORY)
内存协议(强制要求)
Before starting:
Read
.claude/context/memory/learnings.mdAfter completing:
- New pattern ->
.claude/context/memory/learnings.md - Issue found ->
.claude/context/memory/issues.md - Decision made ->
.claude/context/memory/decisions.md
ASSUME INTERRUPTION: If it's not in memory, it didn't happen.
开始前:
阅读
.claude/context/memory/learnings.md完成后:
- 新发现的模式 -> 写入
.claude/context/memory/learnings.md - 发现的问题 -> 写入
.claude/context/memory/issues.md - 做出的决策 -> 写入
.claude/context/memory/decisions.md
假设中断:若未记录在内存中,则视为未发生。