github-mcp

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Mode: 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
  • GITHUB_PERSONAL_ACCESS_TOKEN
    environment variable set
  • Docker已安装并运行
  • 已设置
    GITHUB_PERSONAL_ACCESS_TOKEN
    环境变量

Toolsets

工具集

The server provides 80+ tools across 19 toolsets:
ToolsetDescription
actions
Workflow management, runs, jobs, artifacts
code_security
Scanning alerts, code analysis
discussions
Forum interactions
gists
Code snippets management
issues
Issue creation, updates, commenting
labels
Label management and filtering
projects
GitHub Projects board management
pull_requests
PR creation, review, merging
repos
Code search, commits, releases, branches
users
User search and management
orgs
Organization and team management
notifications
Notification management
secret_scanning
Secret scanning alerts
context
Context about the user
服务器提供涵盖19个工具集的80+工具:
工具集描述
actions
工作流管理、运行、任务、制品
code_security
扫描告警、代码分析
discussions
论坛交互
gists
代码片段管理
issues
议题创建、更新、评论
labels
标签管理与过滤
projects
GitHub Projects看板管理
pull_requests
PR创建、评审、合并
repos
代码搜索、提交、发布、分支
users
用户搜索与管理
orgs
组织与团队管理
notifications
通知管理
secret_scanning
密钥扫描告警
context
用户相关上下文

Quick Reference

快速参考

Use the
gh
CLI for GitHub operations:
bash
undefined
使用
gh
CLI执行GitHub操作:
bash
undefined

Get 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
undefined
gh pr list --repo anthropics/claude-code
undefined

Common Tools (Default Toolsets: 40 tools)

常用工具(默认工具集:40个工具)

Repository Operations

仓库操作

  • search_repositories
    - Search for repositories
  • create_repository
    - Create a new repository
  • fork_repository
    - Fork a repository
  • list_commits
    - List repository commits
  • get_commit
    - Get commit details
  • get_file_contents
    - Get file contents from a repository
  • create_or_update_file
    - Create or update a file
  • delete_file
    - Delete a file
  • push_files
    - Push multiple files
  • search_code
    - Search for code across GitHub
  • list_branches
    - List repository branches
  • create_branch
    - Create a new branch
  • list_tags
    - List repository tags
  • get_tag
    - Get tag details
  • 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
    - 推送多个文件
  • search_code
    - 在GitHub全平台搜索代码
  • list_branches
    - 列出仓库分支
  • create_branch
    - 创建新分支
  • list_tags
    - 列出仓库标签
  • get_tag
    - 获取标签详情
  • list_releases
    - 列出发布版本
  • get_latest_release
    - 获取最新发布版本
  • get_release_by_tag
    - 通过标签获取发布版本

Issue Operations

议题操作

  • list_issues
    - List repository issues
  • issue_read
    - Read issue details
  • issue_write
    - Create/update issues
  • add_issue_comment
    - Add a comment to an issue
  • search_issues
    - Search for issues
  • list_issue_types
    - List issue types (for organizations)
  • get_label
    - Get label details
  • sub_issue_write
    - Manage sub-issues
  • assign_copilot_to_issue
    - Assign Copilot to an issue
  • list_issues
    - 列出仓库议题
  • issue_read
    - 查看议题详情
  • issue_write
    - 创建/更新议题
  • add_issue_comment
    - 为议题添加评论
  • search_issues
    - 搜索议题
  • list_issue_types
    - 列出议题类型(适用于组织)
  • get_label
    - 获取标签详情
  • sub_issue_write
    - 管理子议题
  • assign_copilot_to_issue
    - 为议题分配Copilot

Pull Request Operations

拉取请求操作

  • list_pull_requests
    - List repository pull requests
  • pull_request_read
    - Read PR details
  • create_pull_request
    - Create a new PR
  • update_pull_request
    - Update a PR
  • update_pull_request_branch
    - Update PR branch
  • merge_pull_request
    - Merge a PR
  • search_pull_requests
    - Search for pull requests
  • pull_request_review_write
    - Create/submit PR reviews
  • add_comment_to_pending_review
    - Add comments to pending review
  • request_copilot_review
    - Request Copilot review
  • list_pull_requests
    - 列出仓库拉取请求
  • pull_request_read
    - 查看PR详情
  • create_pull_request
    - 创建新PR
  • update_pull_request
    - 更新PR
  • update_pull_request_branch
    - 更新PR分支
  • merge_pull_request
    - 合并PR
  • search_pull_requests
    - 搜索拉取请求
  • pull_request_review_write
    - 创建/提交PR评审
  • add_comment_to_pending_review
    - 为待评审PR添加评论
  • request_copilot_review
    - 请求Copilot评审

User & Team Operations

用户与团队操作

  • get_me
    - Get current authenticated user
  • search_users
    - Search for users
  • get_teams
    - Get organization 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:
    GITHUB_PERSONAL_ACCESS_TOKEN
    environment variable
本Skill使用Docker运行官方GitHub MCP服务器:
  • 镜像:
    ghcr.io/github/github-mcp-server
  • 认证:
    GITHUB_PERSONAL_ACCESS_TOKEN
    环境变量

Environment Variables

环境变量

VariableRequiredDescription
GITHUB_PERSONAL_ACCESS_TOKEN
YesGitHub PAT for authentication
GITHUB_HOST
NoFor GitHub Enterprise (default: github.com)
GITHUB_TOOLSETS
NoComma-separated toolsets to enable
GITHUB_READ_ONLY
NoSet to 1 for read-only mode
变量名是否必填描述
GITHUB_PERSONAL_ACCESS_TOKEN
用于认证的GitHub PAT
GITHUB_HOST
适用于GitHub Enterprise(默认值:github.com)
GITHUB_TOOLSETS
要启用的工具集,以逗号分隔
GITHUB_READ_ONLY
设置为1时启用只读模式

Limiting Toolsets

限制工具集

When using MCP, configure toolsets via environment variables:
bash
undefined
使用MCP时,可通过环境变量配置工具集:
bash
undefined

Only 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
undefined
GITHUB_TOOLSETS=pull_requests,code_security
undefined

Error Handling

错误处理

If operations fail:
  1. Verify Docker is running:
    docker ps
  2. Check GitHub token is set:
    echo $GITHUB_PERSONAL_ACCESS_TOKEN
  3. Ensure token has required permissions for the operation
  4. Use
    gh auth status
    to verify authentication
若操作失败:
  1. 验证Docker是否在运行:
    docker ps
  2. 检查GitHub令牌是否已设置:
    echo $GITHUB_PERSONAL_ACCESS_TOKEN
  3. 确保令牌拥有操作所需的权限
  4. 使用
    gh auth status
    验证认证状态

Related

相关链接

Memory Protocol (MANDATORY)

内存协议(强制要求)

Before starting: Read
.claude/context/memory/learnings.md
After 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
假设中断:若未记录在内存中,则视为未发生。