# GitHub MCP Server

> 直接在对话中管理仓库、Issue 与 PR

- **URL**: https://followmcp.com/zh/servers/github
- **Category**: 开发工具
- **Origin**: 官方
- **Stars**: 307
- **FMRS Score**: 66/100 (Grade C)
- **Source**: https://github.com/modelcontextprotocol/servers-archived/tree/main/src/github
- **Transports**: stdio（本地进程）
- **Runtimes**: Node.js
- **Auth**: 需要 API Key / 凭据

## Overview
封装 GitHub REST/GraphQL API，让模型可以创建分支、提交代码、评论 Issue、发起 Pull Request，把日常协作流程接入对话式工作流，减少来回切换网页的时间。

## Best for
- 希望在编码助手中处理 Issue、文件和 Pull Request 的开发团队
- 需要把重复 GitHub 操作接入自动化工作流的维护者

## Not for
- 无法提供 GitHub Token 的环境
- 要求所有仓库写操作必须由人工在网页确认的组织

## Required permissions
- GitHub Personal Access Token
- Token 对目标仓库的 Contents、Issues 或 Pull requests 权限，按实际工具最小化授予

## Risks
- 高权限 Token 泄露可能导致仓库代码和 Issue 被修改
- 模型可能创建错误分支、Issue 或 PR，写操作前应保留人工确认

## Client config (JSON)
```json
{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxxxxxxxxxxx"
      }
    }
  }
}
```

## Tools (6)
- `create_or_update_file`: 创建或修改仓库中的文件
- `search_repositories`: 按关键词搜索仓库
- `create_issue`: 创建新的 Issue
- `create_pull_request`: 发起 Pull Request
- `list_commits`: 列出分支的提交历史
- `merge_pull_request`: 合并已通过审查的 PR
