---
title: "GitHub：Claude、Cursor、Codex 配置指南 · DotsAgent"
description: "GitHub 官方服务器，支持仓库、issue、pull request、Actions 和代码搜索，并可切换工具集。 在 13 个 MCP 客户端中配置 GitHub。"
url: https://dotsagent.io/zh/mcp/servers/github
---

开发工具 · GitHub

# 配置 GitHub

GitHub 官方服务器，支持仓库、issue、pull request、Actions 和代码搜索，并可切换工具集。

- **发布者**: GitHub 官方
- **托管端点**: `https://api.githubcopilot.com/mcp/`
- **本地运行**: `docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server`
- **传输方式**: streamable-http, stdio
- **身份验证**: 如果客户端有 GitHub app，可在托管 endpoint 上使用 OAuth；否则使用个人访问令牌。
- **环境变量**: `GITHUB_PERSONAL_ACCESS_TOKEN`
- **可访问内容**: 支持读写；也可使用只读模式并筛选工具集。
- **许可证**: MIT
- **源码**: [github.com/github/github-mcp-server](https://github.com/github/github-mcp-server)
- **状态**: 活跃

## 安装

此服务器由供应商托管，因此只需添加其 URL，无需在本机运行任何内容。如果需要身份验证，上方的条目会说明具体方式；OAuth 服务器会在首次连接时提示你进行授权。

### Claude Code

`shell`

```
claude mcp add --transport http --scope project github https://api.githubcopilot.com/mcp/
```

### Cursor

`.cursor/mcp.json`

```
{
  "mcpServers": {
    "github": {
      "url": "https://api.githubcopilot.com/mcp/"
    }
  }
}
```

### Codex

`~/.codex/config.toml`

```
[mcp_servers.github]
url = "https://api.githubcopilot.com/mcp/"
```

### 改为在本机运行（Cursor）

`.cursor/mcp.json`

```
{
  "mcpServers": {
    "github": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "GITHUB_PERSONAL_ACCESS_TOKEN",
        "ghcr.io/github/github-mcp-server"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "${env:GITHUB_PERSONAL_ACCESS_TOKEN}"
      }
    }
  }
}
```

[其他客户端的配置 →](https://dotsagent.io/zh/mcp/config#add=github)

权限范围较广的令牌允许 Agent 写入其覆盖的所有仓库，因此建议使用只读模式或权限范围较窄的令牌。

## 开发工具 中的其他服务器

- [Everything](https://dotsagent.io/zh/mcp/servers/everything): MCP 项目提供的参考测试服务器，包含所有协议功能，可用于检查客户端是否正常工作。

- [Git](https://dotsagent.io/zh/mcp/servers/git): 让 Agent 在你指定的仓库路径上操作本地 Git 仓库：查看状态、diff、历史记录和分支，以及创建 commit。

- [GitLab](https://dotsagent.io/zh/mcp/servers/gitlab): GitLab 内置 endpoint，支持 issue、merge request、pipeline 和搜索，并可选择工具集。

- [Figma](https://dotsagent.io/zh/mcp/servers/figma): 从 Figma 文件向 coding agent 提供画板、变量和组件，让生成的代码符合设计。

- [Context7](https://dotsagent.io/zh/mcp/servers/context7): 将最新的特定版本库文档和代码示例注入 prompt。由服务托管，可选用 API 密钥。

- [Docker MCP Gateway](https://dotsagent.io/zh/mcp/servers/docker-mcp-gateway): 在容器中运行 Docker MCP 目录中的服务器，并通过单个网关 endpoint 提供服务。

## 来源

1. [github.com](https://github.com/github/github-mcp-server)/github/github-mcp-server
2. [registry.modelcontextprotocol.io](https://registry.modelcontextprotocol.io/v0.1/servers?search=github-mcp-server)/v0.1/servers?search=github-mcp-server

为 AI agent 开发者提供的独立参考资料。与此处提及的任何厂商均无关联。

© 2026 DotsAgent · 事实核查日期：2026年10月1日
