github/github-mcp-server

GitHub: github/github-mcp-server

GitHub 官方的 MCP 服务器,为 AI 工具提供标准化接口以通过自然语言操作 GitHub 平台的各种功能。

Stars: 27469 | Forks: 3681

[![Go Report Card](https://goreportcard.com/badge/github.com/github/github-mcp-server)](https://goreportcard.com/report/github.com/github/github-mcp-server) # GitHub MCP 服务器 GitHub MCP Server 将 AI 工具直接连接到 GitHub 平台。这赋予 AI agent、助手和聊天机器人读取仓库和代码文件、管理 Issue 和 PR、分析代码以及自动化工作流的能力。所有这些都通过自然语言交互完成。 ### 使用场景 - 仓库管理:浏览和查询代码,搜索文件,分析提交,并在你有权访问的任何仓库中理解项目结构。 - Issue & PR 自动化:创建、更新和管理 Issue 以及 Pull Request。让 AI 协助分类 Bug、审查代码变更并维护看板。 - CI/CD & 工作流智能:监控 GitHub Actions 工作流运行,分析构建失败,管理发布,并深入了解你的开发流水线。 - 代码分析:检查安全发现,审查 Dependabot 告警,理解代码模式,并全面深入了解你的代码库。 - 团队协作:访问讨论,管理通知,分析团队活动,并简化团队的流程。 专为希望将其 AI 工具连接到 GitHub 上下文和功能的开发者构建,从简单的自然语言查询到复杂的多步骤 agent 工作流。 ## 远程 GitHub MCP Server [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=github&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2F%22%7D) [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=github&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2F%22%7D&quality=insiders) 远程 GitHub MCP Server 由 GitHub 托管,提供了最简单快速的上手方式。如果你的 MCP host 不支持远程 MCP server,别担心!你可以改用 [GitHub MCP Server 的本地版本](https://github.com/github/github-mcp-server?tab=readme-ov-file#local-github-mcp-server)。 ### 前置条件 1. 一个支持远程服务器的兼容 MCP host(VS Code 1.101+、Claude Desktop、Cursor、Windsurf 等) 2. 任何适用的[策略已启用](https://github.com/github/github-mcp-server/blob/main/docs/policies-and-governance.md) ### 在 VS Code 中安装 为了快速安装,请使用上方的一键安装按钮之一。完成该流程后,切换到 Agent 模式(位于 Copilot Chat 文本输入框旁),服务器就会启动。确保你使用的是 [VS Code 1.101](https://code.visualstudio.com/updates/v1_101) 或[更高版本](https://code.visualstudio.com/updates)以获得远程 MCP 和 OAuth 支持。 或者,要手动配置 VS Code,请从下方示例中选择适当的 JSON 块并将其添加到你的 host 配置中:
使用 OAuth使用 GitHub PAT
VS Code (版本 1.101 或更高)
``` { "servers": { "github": { "type": "http", "url": "https://api.githubcopilot.com/mcp/" } } } ``` ``` { "servers": { "github": { "type": "http", "url": "https://api.githubcopilot.com/mcp/", "headers": { "Authorization": "Bearer ${input:github_mcp_pat}" } } }, "inputs": [ { "type": "promptString", "id": "github_mcp_pat", "description": "GitHub Personal Access Token", "password": true } ] } ```
### 在其他 MCP host 中安装 - **[Copilot CLI](/docs/installation-guides/install-copilot-cli.md)** - GitHub Copilot CLI 安装指南 - **[GitHub Copilot in other IDEs](/docs/installation-guides/install-other-copilot-ides.md)** - JetBrains、Visual Studio、Eclipse 和 Xcode 中 GitHub Copilot 的安装指南 - **[Claude Applications](/docs/installation-guides/install-claude.md)** - Claude Desktop 和 Claude Code CLI 安装指南 - **[Codex](/docs/installation-guides/install-codex.md)** - OpenAI Codex 安装指南 - **[Cursor](/docs/installation-guides/install-cursor.md)** - Cursor IDE 安装指南 - **[Windsurf](/docs/installation-guides/install-windsurf.md)** - Windsurf IDE 安装指南 - **[Rovo Dev CLI](/docs/installation-guides/install-rovo-dev-cli.md)** - Rovo Dev CLI 安装指南 ### 配置 #### 工具集配置 有关远程服务器配置、工具集、headers 和高级用法的完整详细信息,请参阅 [Remote Server Documentation](docs/remote-server.md)。此文件提供了在 VS Code 和其他 MCP host 中连接、自定义和安装远程 GitHub MCP Server 的全面说明和示例。 当未指定工具集时,将使用[默认工具集](#default-toolset)。 #### Insiders 模式
使用 URL 路径使用 Header
``` { "servers": { "github": { "type": "http", "url": "https://api.githubcopilot.com/mcp/insiders" } } } ``` ``` { "servers": { "github": { "type": "http", "url": "https://api.githubcopilot.com/mcp/", "headers": { "X-MCP-Insiders": "true" } } } } ```
有关更多详细信息和示例,请参阅 [Remote Server Documentation](docs/remote-server.md#insiders-mode),以及 [Insiders Features](docs/insiders-features.md) 获取可用功能的完整列表。 #### GitHub Enterprise ##### 带数据驻留的 GitHub Enterprise Cloud (ghe.com) GitHub Enterprise Cloud 也可以使用远程服务器。 `https://octocorp.ghe.com` 使用 GitHub PAT token 的示例: ``` { ... "github-octocorp": { "type": "http", "url": "https://copilot-api.octocorp.ghe.com/mcp", "headers": { "Authorization": "Bearer ${input:github_mcp_pat}" } }, ... } ``` ##### GitHub Enterprise Server GitHub Enterprise Server 不支持远程服务器托管。请参考本地服务器配置中的 [GitHub Enterprise Server and Enterprise Cloud with data residency (ghe.com)](#github-enterprise-server-and-enterprise-cloud-with-data-residency-ghecom)。 ## 本地 GitHub MCP Server [![Install with Docker in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=github&inputs=%5B%7B%22id%22%3A%22github_token%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22GitHub%20Personal%20Access%20Token%22%2C%22password%22%3Atrue%7D%5D&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22-e%22%2C%22GITHUB_PERSONAL_ACCESS_TOKEN%22%2C%22ghcr.io%2Fgithub%2Fgithub-mcp-server%22%5D%2C%22env%22%3A%7B%22GITHUB_PERSONAL_ACCESS_TOKEN%22%3A%22%24%7Binput%3Agithub_token%7D%22%7D%7D) [![Install with Docker in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=github&inputs=%5B%7B%22id%22%3A%22github_token%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22GitHub%20Personal%20Access%20Token%22%2C%22password%22%3Atrue%7D%5D&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22-e%22%2C%22GITHUB_PERSONAL_ACCESS_TOKEN%22%2C%22ghcr.io%2Fgithub%2Fgithub-mcp-server%22%5D%2C%22env%22%3A%7B%22GITHUB_PERSONAL_ACCESS_TOKEN%22%3A%22%24%7Binput%3Agithub_token%7D%22%7D%7D&quality=insiders) ### 前置条件 1. 要在容器中运行服务器,你需要安装 [Docker](https://www.docker.com/)。 2. 安装 Docker 后,你还需要确保 Docker 正在运行。Docker 镜像位于 `ghcr.io/github/github-mcp-server`。该镜像是公开的;如果在拉取时遇到错误,可能是 token 过期,需要执行 `docker logout ghcr.io`。 3. 最后,你需要[创建一个 GitHub Personal Access Token](https://github.com/settings/personal-access-tokens/new)。 MCP server 可以使用许多 GitHub API,因此请启用你愿意授予 AI 工具的权限(要了解更多关于 access token 的信息,请查看[文档](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens))。
安全地处理 PAT ### 环境变量(推荐) 为了保持你的 GitHub PAT 安全并在不同的 MCP host 间可重用: 1. **将你的 PAT 存储在环境变量中** export GITHUB_PAT=your_token_here 或者创建一个 `.env` 文件: GITHUB_PAT=your_token_here 2. **保护你的 `.env` 文件** # 添加到 .gitignore 以防止意外提交 echo ".env" >> .gitignore 3. **在配置中引用该 token** # CLI 使用 claude mcp update github -e GITHUB_PERSONAL_ACCESS_TOKEN=$GITHUB_PAT # 在配置文件中(如果支持) "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "$GITHUB_PAT" } ### Token 安全最佳实践 - **最小权限范围**:只授予必要的权限 - `repo` - Repository 操作 - `read:packages` - Docker 镜像访问 - `read:org` - 组织团队访问 - **分离 token**:为不同的项目/环境使用不同的 PAT - **定期轮换**:定期更新 token - **永远不要提交**:将 token 排除在版本控制之外 - **文件权限**:限制对包含 token 的配置文件的访问 chmod 600 ~/.your-app/config.json
### GitHub Enterprise Server 和带数据驻留的 Enterprise Cloud (ghe.com) 可以使用 `--gh-host` 标志和 `GITHUB_HOST` 环境变量来设置 GitHub Enterprise Server 或带数据驻留的 GitHub Enterprise Cloud 的主机名。 - 对于 GitHub Enterprise Server,请使用 `https://` URI 方案前缀作为主机名,否则默认为 `http://`,这是 GitHub Enterprise Server 不支持的。 - 对于带数据驻留的 GitHub Enterprise Cloud,请使用 `https://YOURSUBDOMAIN.ghe.com` 作为主机名。 ``` "github": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "-e", "GITHUB_HOST", "ghcr.io/github/github-mcp-server" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}", "GITHUB_HOST": "https://" } } ``` ## 安装 ### 在 VS Code 的 GitHub Copilot 中安装 为了快速安装,请使用上方的一键安装按钮之一。完成该流程后,切换到 Agent 模式(位于 Copilot Chat 文本输入框旁),服务器就会启动。 更多关于在 VS Code 中使用 MCP server 工具的信息,请参阅 [agent mode documentation](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)。 在其他 IDE(JetBrains、Visual Studio、Eclipse 等)的 GitHub Copilot 中安装 将以下 JSON 块添加到你的 IDE 的 MCP 设置中。 ``` { "mcp": { "inputs": [ { "type": "promptString", "id": "github_token", "description": "GitHub Personal Access Token", "password": true } ], "servers": { "github": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}" } } } } } ``` 或者,你可以将类似的示例(即不带 mcp 键)添加到工作区中名为 `.vscode/mcp.json` 的文件中。这将允许你与接受相同格式的其他 host 应用程序共享配置。
不包含 MCP 键的示例 JSON 块
``` { "inputs": [ { "type": "promptString", "id": "github_token", "description": "GitHub Personal Access Token", "password": true } ], "servers": { "github": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}" } } } } ```
### 在其他 MCP Host 中安装 对于其他 MCP host 应用程序,请参考我们的安装指南: - **[Copilot CLI](docs/installation-guides/install-copilot-cli.md)** - GitHub Copilot CLI 安装指南 - **[GitHub Copilot in other IDEs](/docs/installation-guides/install-other-copilot-ides.md)** - JetBrains、Visual Studio、Eclipse 和 Xcode 中 GitHub Copilot 的安装指南 - **[Claude Code & Claude Desktop](docs/installation-guides/install-claude.md)** - Claude Code 和 Claude Desktop 安装指南 - **[Cursor](docs/installation-guides/install-cursor.md)** - Cursor IDE 安装指南 - **[Google Gemini CLI](docs/installation-guides/install-gemini-cli.md)** - Google Gemini CLI 安装指南 - **[Windsurf](docs/installation-guides/install-windsurf.md)** - Windsurf IDE 安装指南 有关所有安装选项的完整概述,请参阅我们的 **[Installation Guides Index](docs/installation-guides)**。 ### 从源码构建 如果你没有 Docker,可以使用 `go build` 在 `cmd/github-mcp-server` 目录中构建二进制文件,并将 `GITHUB_PERSONAL_ACCESS_TOKEN` 环境变量设置为你的 token,然后使用 `github-mcp-server stdio` 命令。要指定构建的输出位置,请使用 `-o` 标志。你应该将服务器配置为使用构建的可执行文件作为其 `command`。例如: ``` { "mcp": { "servers": { "github": { "command": "/path/to/github-mcp-server", "args": ["stdio"], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "" } } } } } ``` ### CLI 实用工具 `github-mcp-server` 二进制文件包含一些 CLI 子命令,对于调试和探索服务器很有帮助。 - `github-mcp-server tool-search ""` 按名称、描述和输入参数名称搜索工具。使用 `--max-results` 返回更多匹配项。 示例(彩色输出需要 TTY;在 Docker 中运行时请使用 `docker run -t` (或 `-it`)): ``` docker run -it --rm ghcr.io/github/github-mcp-server tool-search "issue" --max-results 5 github-mcp-server tool-search "issue" --max-results 5 ``` ## 工具配置 GitHub MCP Server 支持通过 `--toolsets`标志启用或禁用特定功能组。这允许你控制 AI 工具可以使用哪些 GitHub API 功能。仅启用你所需的工具集可以帮助 LLM 进行工具选择并减少上下文大小。 _工具集不仅限于工具。在适用的地方,还包括相关的 MCP Resources 和 Prompts。_ 当未指定工具集时,将使用[默认工具集](#default-toolset)。 #### 指定工具集 要指定你想让 LLM 可用的工具集,可以通过两种方式传递允许列表: 1. **使用命令行参数**: github-mcp-server --toolsets repos,issues,pull_requests,actions,code_security 2. **使用环境变量**: GITHUB_TOOLSETS="repos,issues,pull_requests,actions,code_security" ./github-mcp-server 如果同时提供,环境变量 `GITHUB_TOOLSETS` 优先于命令行参数。 #### 指定单个工具 你也可以使用 `--tools` 标志配置特定工具。工具可以独立使用,也可以与工具集和动态工具集发现结合使用,以实现精细控制。 1. **使用命令行参数**: github-mcp-server --tools get_file_contents,issue_read,create_pull_request 2. **使用环境变量**: GITHUB_TOOLS="get_file_contents,issue_read,create_pull_request" ./github-mcp-server 3. **与工具集结合**(叠加): github-mcp-server --toolsets repos,issues --tools get_gist 这将注册来自 `repos` 和 `issues` 工具集的所有工具,加上 `get_gist`。 4. **与动态工具集结合**(叠加): github-mcp-server --tools get_file_contents --dynamic-toolsets 这将注册 `get_file_contents` 加上动态工具集工具(`enable_toolset`、`list_available_toolsets`、`get_toolset_tools`)。 **重要说明:** - 工具、工具集和动态工具集都可以一起使用 - 只读模式优先:如果设置了 `--read-only`,即使通过 `--tools` 显式请求,写入工具也会被跳过 - 工具名称必须完全匹配(例如 `get_file_contents`,而不是 `getFileContents`)。无效的工具名称将导致服务器在启动时失败并显示错误消息 - 当工具重命名时,旧名称将作为别名保留以实现向后兼容性。有关详细信息,请参阅 [Deprecated Tool Aliases](docs/deprecated-tool-aliases.md)。 ### 在 Docker 中使用工具集 使用 Docker 时,你可以将工具集作为环境变量传递: ``` docker run -i --rm \ -e GITHUB_PERSONAL_ACCESS_TOKEN= \ -e GITHUB_TOOLSETS="repos,issues,pull_requests,actions,code_security" \ ghcr.io/github/github-mcp-server ``` ### 在 Docker 中使用工具 使用 Docker 时,你可以将特定工具作为环境变量传递。你也可以将工具与工具集结合使用: ``` # 仅 Tools docker run -i --rm \ -e GITHUB_PERSONAL_ACCESS_TOKEN= \ -e GITHUB_TOOLS="get_file_contents,issue_read,create_pull_request" \ ghcr.io/github/github-mcp-server # Tools 与 toolsets 结合(附加) docker run -i --rm \ -e GITHUB_PERSONAL_ACCESS_TOKEN= \ -e GITHUB_TOOLSETS="repos,issues" \ -e GITHUB_TOOLS="get_gist" \ ghcr.io/github/github-mcp-server ``` ### 特殊工具集 #### "all" 工具集 可以提供特殊工具集 `all` 来启用所有可用的工具集,而忽略任何其他配置: ``` ./github-mcp-server --toolsets all ``` 或者使用环境变量: ``` GITHUB_TOOLSETS="all" ./github-mcp-server ``` #### "default" 工具集 默认工具集 `default` 是在未指定工具集时传递给服务器的配置。 默认配置是: - context - repos - issues - pull_requests - users 要保持默认配置并添加额外的工具集: ``` GITHUB_TOOLSETS="default,stargazers" ./github-mcp-server ``` ### Insiders 模式 本地 GitHub MCP Server 提供了 insiders 版本,可以抢先体验新功能和实验性工具。 1. **使用命令行参数**: ./github-mcp-server --insiders 2. **使用环境变量**: GITHUB_INSIDERS=true ./github-mcp-server 使用 Docker 时: ``` docker run -i --rm \ -e GITHUB_PERSONAL_ACCESS_TOKEN= \ -e GITHUB_INSIDERS=true \ ghcr.io/github/github-mcp-server ``` ### 可用工具集 以下工具集可用: | | Toolset | Description | | --- | ----------------------- | ------------------------------------------------------------- | | person | `context` | **强烈推荐**:提供关于当前用户和你所操作的 GitHub 上下文的工具 | | workflow | `actions` | GitHub Actions 工作流和 CI/CD 操作 | | codescan | `code_security` | 代码安全相关工具,例如 GitHub Code Scanning | | copilot | `copilot` | Copilot 相关工具 | | dependabot | `dependabot` | Dependabot 工具 | | comment-discussion | `discussions` | GitHub Discussions 相关工具 | | logo-gist | `gists` | GitHub Gist 相关工具 | | git-branch | `git` | GitHub Git API 相关工具,用于底层 Git 操作 | | issue-opened | `issues` | GitHub Issues 相关工具 | | tag | `labels` | GitHub Labels 相关工具 | | bell | `notifications` | GitHub Notifications 相关工具 | | organization | `orgs` | GitHub Organization 相关工具 | | project | `projects` | GitHub Projects 相关工具 | | git-pull-request | `pull_requests` | GitHub Pull Request 相关工具 | | repo | `repos` | GitHub Repository 相关工具 | | shield-lock | `secret_protection` | Secret protection 相关工具,例如 GitHub Secret Scanning | | shield | `security_advisories` | Security advisories 相关工具 | | star | `stargazers` | GitHub Stargazers 相关工具 | | people | `users` | GitHub User 相关工具 | ### 远程 GitHub MCP Server 中的额外工具集 | Toolset | Description | | ----------------------- | ------------------------------------------------------------- | | `copilot` | Copilot 相关工具(例如 Copilot Coding Agent) | | `copilot_spaces` | Copilot Spaces 相关工具 | | `github_support_docs_search` | 搜索文档以回答 GitHub 产品和支持问题 | ## 工具
workflow Actions - **actions_get** - 获取 GitHub Actions 资源(工作流、工作流运行、作业和构件)的详细信息 - **Required OAuth Scopes**: `repo` - `method`: 要执行的方法 (string, required) - `owner`: Repository 所有者 (string, required) - `repo`: Repository 名称 (string, required) - `resource_id`: 资源的唯一标识符。这将根据提供的 "method" 而有所不同,因此请确保提供正确的 ID: - 为 'get_workflow' 方法提供工作流 ID 或工作流文件名(例如 ci.yaml)。 - 为 'get_workflow_run'、'get_workflow_run_usage' 和 'get_workflow_run_logs_url' 方法提供工作流运行 ID。 - 为 'download_workflow_run_artifact' 方法提供构件 ID。 - 为 'get_workflow_job' 方法提供作业 ID。 (string, required) - **actions_list** - 列出 repository 中的 GitHub Actions 工作流 - **Required OAuth Scopes**: `repo` - `method`: 要执行的操作 (string, required) - `owner`: Repository 所有者 (string, required) - `page`: 分页页码 (default: 1) (number, optional) - `per_page`: 每页数 (default: 30, max: 100) (number, optional) - `repo`: Repository 名称 (string, required) - `resource_id`: 资源的唯一标识符。这将根据提供的 "method" 而有所不同,因此请确保提供正确的 ID: - 为 'list_workflows' 方法不要提供任何资源 ID。 - 为 'list_workflow_runs' 方法提供工作流 ID 或工作流文件名(例如 ci.yaml),或省略以列出 repository 中的所有工作流运行。 - 为 'list_workflow_jobs' 和 'list_workflow_run_artifacts' 方法提供工作流运行 ID。 (string, optional) - `workflow_jobs_filter`: 工作流作业的过滤器。**仅**在 method 为 'list_workflow_jobs' 时使用 (object, optional) - `workflow_runs_filter`: 工作流运行的过滤器。**仅**在 method 为 'list_workflow_runs' 时使用 (object, optional) - **actions_run_trigger** - 触发 GitHub Actions 工作流操作 - **Required OAuth Scopes**: `repo` - `inputs`: 工作流接受的输入。仅用于 'run_workflow' 方法。 (object, optional) - `method`: 要执行的方法 (string, required) - `owner`: Repository 所有者 (string, required) - `ref`: 工作流的 git 引用。引用可以是分支或标签名称。'run_workflow' 方法必需。 (string, optional) - `repo`: Repository 名称 (string, required) - `run_id`: 工作流运行的 ID。除 'run_workflow' 外的所有方法都需要。 (number, optional) - `workflow_id`: 工作流 ID(数字)或工作流文件名(例如 main.yml、ci.yaml)。'run_workflow' 方法必需。 (string, optional) - **get_job_logs** - 获取 GitHub Actions 工作流作业日志 - **Required OAuth Scopes**: `repo` - `failed_only`: 为 true 时,获取 run_id 指定的工作流运行中所有失败作业的日志。需要提供 run_id。 (boolean, optional) - `job_id`: 工作流作业的唯一标识符。获取单个作业的日志时必需。 (number, optional) - `owner`: Repository 所有者 (string, required) - `repo`: Repository 名称 (string, required) - `return_content`: 返回实际日志内容而不是 URL (boolean, optional) - `run_id`: 工作流运行的唯一标识符。当 failed_only 为 true 以获取运行中所有失败作业的日志时必需。 (number, optional) - `tail_lines`: 从日志末尾返回的行数 (number, optional)
codescan Code Security - **get_code_scanning_alert** - 获取代码扫描告警 - **Required OAuth Scopes**: `security_events` - **Accepted OAuth Scopes**: `repo`, `security_events` - `alertNumber`: 告警编号。 (number, required) - `owner`: Repository 的所有者。 (string, required) - `repo`: Repository 的名称。 (string, required) - **list_code_scanning_alerts** - 列出代码扫描告警 - **Required OAuth Scopes**: `security_events` - **Accepted OAuth Scopes**: `repo`, `security_events` - `owner`: Repository 的所有者。 (string, required) - `ref`: 你要列出结果的 Git 引用。 (string, optional) - `repo`: Repository 的名称。 (string, required) - `severity`: 按严重程度过滤代码扫描告警 (string, optional) - `state`: 按状态过滤代码扫描告警。默认为 open (string, optional) - `tool_name`: 用于代码扫描的工具名称。 (string, optional)
person Context - **get_me** - 获取我的用户资料 - 无需参数 - **get_team_members** - 获取团队成员 - **Required OAuth Scopes**: `read:org` - **Accepted OAuth Scopes**: `admin:org`, `read:org`, `write:org` - `org`: 包含团队的组织登录名(所有者)。 (string, required) - `team_slug`: Team slug (string, required) - **get_teams** - 获取团队 - **Required OAuth Scopes**: `read:org` - **Accepted OAuth Scopes**: `admin:org`, `read:org`, `write:org` - `user`: 要获取团队的用户名。如果未提供,则使用经过身份验证的用户。 (string, optional)
copilot Copilot - **assign_copilot_to_issue** - 将 Copilot 分配给 Issue - **Required OAuth Scopes**: `repo` - `base_ref`: agent 将开始工作的 Git 引用(例如分支)。如果未指定,默认为 repository 的默认分支 (string, optional) - `custom_instructions`: 可选的自定义指令,用于在 issue 正文之外指导 agent。使用此选项提供 issue 描述中未包含的额外上下文、约束或指导 (string, optional) - `issue_number`: Issue 编号 (number, required) - `owner`: Repository 所有者 (string, required) - `repo`: Repository 名称 (string, required) - **request_copilot_review** - 请求 Copilot 审查 - **Required OAuth Scopes**: `repo` - `owner`: Repository 所有者 (string, required) - `pullNumber`: Pull request 编号 (number, required) - `repo`: Repository 名称 (string, required)
dependabot Dependabot - **get_dependabot_alert** - 获取 dependabot 告警 - **Required OAuth Scopes**: `security_events` - **Accepted OAuth Scopes**: `repo`, `security_events` - `alertNumber`: 告警编号。 (number, required) - `owner`: Repository 的所有者。 (string, required) - `repo`: Repository 的名称。 (string, required) - **list_dependabot_alerts** - 列出 dependabot 告警 - **Required OAuth Scopes**: `security_events` - **Accepted OAuth Scopes**: `repo`, `security_events` - `owner`: Repository 的所有者。 (string, required) - `repo`: Repository 的名称。 (string, required) - `severity`: 按严重程度过滤 dependabot 告警 (string, optional) - `state`: 按状态过滤 dependabot 告警。默认为 open (string, optional)
comment-discussion Discussions - **get_discussion** - 获取讨论 - **Required OAuth Scopes**: `repo` - `discussionNumber`: 讨论编号 (number, required) - `owner`: Repository 所有者 (string, required) - `repo`: Repository 名称 (string, required) - **get_discussion_comments** - 获取讨论评论 - **Required OAuth Scopes**: `repo` - `after`: 分页游标。使用上一页 PageInfo 的 endCursor 用于 GraphQL API。 (string, optional) - `discussionNumber`: 讨论编号 (number, required) - `owner`: Repository 所有者 (string, required) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `repo`: Repository 名称 (string, required) - **list_discussion_categories** - 列出讨论分类 - **Required OAuth Scopes**: `repo` - `owner`: Repository 所有者 (string, required) - `repo`: Repository 名称。如果未提供,将在组织级别查询讨论分类。 (string, optional) - **list_discussions** - 列出讨论 - **Required OAuth Scopes**: `repo` - `after`: 分页游标。使用上一页 PageInfo 的 endCursor 用于 GraphQL API。 (string, optional) - `category`: 按讨论分类 ID 可选过滤。如果提供,仅列出具有此分类的讨论。 (string, optional) - `direction`: 排序方向。 (string, optional) - `orderBy`: 按字段排序讨论。如果提供,也需要提供 'direction'。 (string, optional) - `owner`: Repository 所有者 (string, required) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `repo`: Repository 名称。如果未提供,将在组织级别查询讨论。 (string, optional)
logo-gist Gists - **create_gist** - 创建 Gist - **Required OAuth Scopes**: `gist` - `content`: 简单单文件 gist 创建的内容 (string, required) - `description`: gist 的描述 (string, optional) - `filename`: 简单单文件 gist 创建的文件名 (string, required) - `public`: gist 是否公开 (boolean, optional) - **get_gist** - 获取 Gist 内容 - `gist_id`: gist 的 ID (string, required) - `list_gists` - 列出 Gists - `page`: 分页页码 (min 1) (number, optional) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `since`: 仅更新时间在此时间之后的 gists (ISO 8601 timestamp) (string, optional) - `username`: GitHub 用户名(省略则为经过身份验证用户的 gists) (string, optional) - **update_gist** - 更新 Gist - **Required OAuth Scopes**: `gist` - `content`: 文件内容 (string, required) - `description`: 更新的 gist 描述 (string, optional) - `filename`: 要更新或创建的文件名 (string, required) - `gist_id`: 要更新的 gist ID (string, required)
git-branch Git - **get_repository_tree** - 获取仓库树 - **Required OAuth Scopes**: `repo` - `owner`: Repository 所有者(用户名或组织) (string, required) - `path_filter`: 过滤树结果的可选路径前缀(例如 'src/' 仅显示 src 目录中的文件) (string, optional) - `recursive`: 将此参数设置为 true 将返回树引用的对象或子树。默认为 false (boolean, optional) - `repo`: Repository 名称 (string, required) - `tree_sha`: 树的 SHA1 值或引用(分支或标签)名称。默认为 repository 的默认分支 (string, optional)
issue-opened Issues - **add_issue_comment** - 向 Issue 添加评论 - **Required OAuth Scopes**: `repo` - `body`: 评论内容 (string, required) - `issue_number`: 要评论的 Issue 编号 (number, required) - `owner`: Repository 所有者 (string, required) - `repo`: Repository 名称 (string, required) - **get_label** - 从 repository 获取特定标签。 - **Required OAuth Scopes**: `repo` - `name`: 标签名称。 (string, required) - `owner`: Repository 所有者(用户名或组织名称) (string, required) - `repo`: Repository 名称 (string, required) - **issue_read** - 获取 Issue 详情 - **Required OAuth Scopes**: `repo` - `issue_number`: Issue 编号 (number, required) - `method`: 对单个 Issue 执行的读取操作。 选项有: 1. get - 获取特定 Issue 的详情。 2. get_comments - 获取 Issue 评论。 3. get_sub_issues - 获取 Issue 的子 Issue。 4. get_labels - 获取分配给 Issue 的标签。 (string, required) - `owner`: Repository 的所有者 (string, required) - `page`: 分页页码 (min 1) (number, optional) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `repo`: Repository 的名称 (string, required) - **issue_write** - 创建或更新 Issue。 - **Required OAuth Scopes**: `repo` - `assignees`: 要分配给此 Issue 的用户名 (string[], optional) - `body`: Issue 正文内容 (string, optional) - `duplicate_of`: 此 Issue 重复的 Issue 编号。仅当 state_reason 为 'duplicate' 时使用。 (number, optional) - `issue_number`: 要更新的 Issue 编号 (number, optional) - `labels`: 要应用于此 Issue 的标签 (string[], optional) - `method`: 对单个 Issue 执行的写入操作。 选项有: - 'create' - 创建新 Issue。 - 'update' - 更新现有 Issue。 (string, required) - `milestone`: Milestone 编号 (number, optional) - `owner`: Repository 所有者 (string, required) - `repo`: Repository 名称 (string, required) - `state`: 新状态 (string, optional) - `state_reason`: 状态更改的原因。除非状态更改,否则忽略。 (string, optional) - `title`: Issue 标题 (string, optional) - `type`: 此 Issue 的类型。仅当 repository 配置了 Issue 类型时使用。使用 list_issue_types 工具获取组织的有效类型值。如果 repository 不支持 Issue 类型,请省略此参数。 (string, optional) - **list_issue_types** - 列出可用的 Issue 类型 - **Required OAuth Scopes**: `read:org` - **Accepted OAuth Scopes**: `admin:org`, `read:org`, `write:org` - `owner`: Repository 的组织所有者 (string, required) - **list_issues** -列出 Issues - **Required OAuth Scopes**: `repo` - `after`: 分页游标。使用上一页 PageInfo 的 endCursor 用于 GraphQL API。 (string, optional) - `direction`: 排序方向。如果提供,也需要提供 'orderBy'。 (string, optional) - `labels`: 按标签过滤 (string[], optional) - `orderBy`: 按字段排序 Issues。如果提供,也需要提供 'direction'。 (string, optional) - `owner`: Repository 所有者 (string, required) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `repo`: Repository 名称 (string, required) - `since`: 按日期过滤 (ISO 8601 timestamp) (string, optional) - `state`: 按状态过滤,默认情况下未提供时返回 open 和 closed 的 issues (string, optional) - **search_issues** - 搜索 Issues - **Required OAuth Scopes**: `repo` - `order`: 排序顺序 (string, optional) - `owner`: 可选的 repository 所有者。如果与 repo 一起提供,则仅列出此 repository 的 issues。 (string, optional) - `page`: 分页页码 (min 1) (number, optional) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `query`: 使用 GitHub issues 搜索语法的搜索查询 (string, required) - `repo`: 可选的 repository 名称。如果与 owner 一起提供,则仅列出此 repository 的 issues。 (string, optional) - `sort`: 按匹配类别数量排序字段,默认为最佳匹配 (string, optional) - **sub_issue_write** - 更改子 Issue - **Required OAuth Scopes**: `repo` - `after_id`: 要优先排序在其后的子 Issue ID(应指定 after_id 或 before_id 之一) (number, optional) - `before_id`: 要优先排序在其前的子 Issue ID(应指定 after_id 或 before_id 之一) (number, optional) - `issue_number`: 父 Issue 的编号 (number, required) - `method`: 对单个子 Issue 执行的操作 选项有: - 'add' - 向 GitHub repository 中的父 Issue 添加子 Issue。 - 'remove' - 从 GitHub repository 中的父 Issue 移除子 Issue。 - 'reprioritize' - 更改 GitHub repository 中父 Issue 内子 Issue 的顺序。使用 'after_id' 或 'before_id' 指定新位置。 (string, required) - `owner`: Repository 所有者 (string, required) - `replace_parent`: 为 true 时,替换子 Issue 的当前父 Issue。仅与 'add' 方法一起使用。 (boolean, optional) - `repo`: Repository 名称 (string, required) - `sub_issue_id`: 要添加的子 Issue ID。ID 与 Issue 编号不同 (number, required)
tag Labels - **get_label** - 从 repository 获取特定标签。 - **Required OAuth Scopes**: `repo` - `name`: 标签名称。 (string, required) - `owner`: Repository 所有者(用户名或组织名称) (string, required) - `repo`: Repository 名称 (string, required) - **label_write** - 对 repository 标签进行写入操作。 - **Required OAuth Scopes**: `repo` - `color`: 标签颜色,不带 '#' 前缀的 6 字符十六进制代码(例如 'f29513')。'create' 必需,'update' 可选。 (string, optional) - `description`: 标签描述文本。'create' 和 'update' 可选。 (string, optional) - `method`: 要执行的操作:'create'、'update' 或 'delete' (string, required) - `name`: 标签名称 - 所有操作必需 (string, required) - `new_name`: 标签的新名称(仅与 'update' 方法一起使用以重命名) (string, optional) - `owner`: Repository 所有者(用户名或组织名称) (string, required) - `repo`: Repository 名称 (string, required) - **list_label** - 列出 repository 的标签 - **Required OAuth Scopes**: `repo` - `owner`: Repository 所有者(用户名或组织名称) - 所有操作必需 (string, required) - `repo`: Repository 名称 - 所有操作必需 (string, required)
bell Notifications - **dismiss_notification** - 忽略通知 - **Required OAuth Scopes**: `notifications` - `state`: 通知的新状态 (read/done) (string, required) - `threadID`: 通知线程的 ID (string, required) - **get_notification_details** - 获取通知详情 - **Required OAuth Scopes**: `notifications` - `notificationID`: 通知的 ID (string, required) - **list_notifications** - 列出通知 - **Required OAuth Scopes**: `notifications` - `before`: 仅显示在给定时间之前更新的通知 (ISO 8601 format) (string, optional) - `filter`: 过滤通知,除非指定否则使用默认值。已读通知是用户已经确认的通知。参与通知是用户直接参与的通知,例如他们评论或创建的 issues 或 pull requests。 (string, optional) - `owner`: 可选的 repository 所有者。如果与 repo 一起提供,则仅列出此 repository 的通知。 (string, optional) - `page`: 分页页码 (min 1) (number, optional) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `repo`: 可选的 repository 名称。如果与 owner 一起提供,则仅列出此 repository 的通知。 (string, optional) - `since`: 仅显示在给定时间之后更新的通知 (ISO 8601 format) (string, optional) - **manage_notification_subscription** - 管理通知订阅 - **Required OAuth Scopes**: `notifications` - `action`: 要执行的操作:ignore、watch 或 delete 通知订阅。 (string, required) - `notificationID`: 通知线程的 ID。 (string, required) - **manage_repository_notification_subscription** - 管理 repository 通知订阅 - **Required OAuth Scopes**: `notifications` - `action`: 要执行的操作:ignore、watch 或 delete repository 通知订阅。 (string, required) - `owner`: Repository 的账户所有者。 (string, required) - `repo`: Repository 的名称。 (string, required) - **mark_all_notifications_read** - 将所有通知标记为已读 - **Required OAuth Scopes**: `notifications` - `lastReadAt`: 描述检查通知的最后时间点(可选)。默认:现在 (string, optional) - `owner`: 可选的 repository 所有者。如果与 repo 一起提供,则仅将此 repository 的通知标记为已读。 (string, optional) - `repo`: 可选的 repository 名称。如果与 owner 一起提供,则仅将此 repository 的通知标记为已读。 (string, optional)
organization Organizations - **search_orgs** - 搜索组织 - **Required OAuth Scopes**: `read:org` - **Accepted OAuth Scopes**: `admin:org`, `read:org`, `write:org` - `order`: 排序顺序 (string, optional) - `page`: 分页页码 (min 1) (number, optional) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `query`: 组织搜索查询。示例:'microsoft'、'location:california'、'created:>=2025-01-01'。搜索自动限定为 type:org。 (string, required) - `sort`: 按类别排序字段 (string, optional)
project Projects - **projects_get** - 获取 GitHub Projects 资源的详情 - **Required OAuth Scopes**: `read:project` - **Accepted OAuth Scopes**: `project`, `read:project` - `field_id`: 字段的 ID。'get_project_field' 方法必需。 (number, optional) - `fields`: 获取 project item 时要包含在响应中的特定字段 ID 列表(例如 ["102589", "985201", "169875"])。如果未提供,仅包含标题字段。仅用于 'get_project_item' 方法。 (string[], optional) - `item_id`: item 的 ID。'get_project_item' 方法必需。 (number, optional) - `method`: 要执行的方法 (string, required) - `owner`: 所有者(用户或组织登录名)。名称不区分大小写。 (string, optional) - `owner_type`: 所有者类型(user 或 org)。如果未提供,将自动检测。 (string, optional) - `project_number`: Project 的编号。 (number, optional) - `status_update_id`: project status update 的节点 ID。'get_project_status_update' 方法必需。 (string, optional) - **projects_list** - 列出 GitHub Projects 资源 - **Required OAuth Scopes**: `read:project` - **Accepted OAuth Scopes**: `project`, `read:project` - `after`: 来自上一个 pageInfo.nextCursor 的正向分页游标。 (string, optional) - `before`: 来自上一个 pageInfo.prevCursor 的反向分页游标(罕见)。 (string, optional) - `fields`: 列出 project items 时要包含的字段 ID(例如 ["102589", "985201"])。关键:始终提供以获取字段值。没有这个,仅返回标题。仅用于 'list_project_items' 方法。 (string[], optional) - `method`: 要执行的操作 (string, required) - `owner`: 所有者(用户或组织登录名)。名称不区分大小写。 (string, required) - `owner_type`: 所有者类型(user 或 org)。如果未提供,将自动尝试两者。 (string, optional) - `per_page`: 每页结果数 (max 50) (number, optional) - `project_number`: Project 的编号。'list_project_fields'、'list_project_items' 和 'list_project_status_updates' 方法必需。 (number, optional) - `query`: 过滤/查询字符串。对于 list_projects:按标题文本和状态过滤(例如 "roadmap is:open")。对于 list_project_items:使用 GitHub 的 project 过滤语法进行高级过滤。 (string, optional) - **projects_write** - 修改 GitHub Project items - **Required OAuth Scopes**: `project` - `body`: 状态更新的正文(markdown)。用于 'create_project_status_update' 方法。 (string, optional) - `issue_number`: Issue 编号(当 item_type 为 'issue' 用于 'add_project_item' 方法时使用)。提供 issue_number 或 pull_request_number 之一。 (number, optional) - `item_id`: Project item ID。'update_project_item' 和 'delete_project_item' 方法必需。 (number, optional) - `item_owner`: 包含 issue 或 pull request 的 repository 的所有者(用户或组织)。'add_project_item' 方法必需。 (string, optional) - `item_repo`: 包含 issue 或 pull request 的 repository 的名称。'add_project_item' 方法必需。 (string, optional) - `item_type`: item 的类型,issue 或 pull_request。'add_project_item' 方法必需。 (string, optional) - `method`: 要执行的方法 (string, required) - `owner`: Project 所有者(用户或组织登录名)。名称不区分大小写。 (string, required) - `owner_type`: 所有者类型(user 或 org)。如果未提供,将自动检测。 (string, optional) - `project_number`: Project 的编号。 (number, required) - `pull_request_number`: Pull request 编号(当 item_type 为 'pull_request' 用于 'add_project_item' 方法时使用)。提供 issue_number 或 pull_request_number 之一。 (number, optional) - `start_date`: 状态更新的开始日期,YYYY-MM-DD 格式。用于 'create_project_status_update' 方法。 (string, optional) - `status`: Project 的状态。用于 'create_project_status_update' 方法。 (string, optional) - `target_date`: 状态更新的目标日期,YYYY-MM-DD 格式。用于 'create_project_status_update' 方法。 (string, optional) - `updated_field`: 由要更新的 project 字段的 ID 和字段的新值组成的对象。要清除字段,请将值设置为 null。示例:{"id": 123456, "value": "New Value"}。'update_project_item' 方法必需。 (object, optional)
git-pull-request Pull Requests - **add_comment_to_pending_review** - 向请求者最新的待处理 Pull Request 审查添加审查评论 - **Required OAuth Scopes**: `repo` - `body`: 审查评论的文本 (string, required) - `line`: Pull request diff 中评论适用的 blob 行。对于多行评论,为范围的最后一行 (number, optional) - `owner`: Repository 所有者 (string, required) - `path`: 需要评论的文件的相对路径 (string, required) - `pullNumber`: Pull request 编号 (number, required) - `repo`: Repository 名称 (string, required) - `side`: 要评论的 diff 侧。LEFT 表示之前的状态,RIGHT 表示新 (string, optional) - `startLine`: 对于多行评论,评论适用的范围的第一行 (number, optional) - `startSide`: 对于多行评论,评论适用的 diff 的起始侧。LEFT 表示之前的状态,RIGHT 表示新状态 (string, optional) - `subjectType`: 评论 targeted 的级别 (string, required) - **add_reply_to_pull_request_comment** - 回复 Pull Request 评论 - **Required OAuth Scopes**: `repo` - `body`: 回复的文本 (string, required) - `commentId`: 要回复的评论 ID (number, required) - `owner`: Repository 所有者 (string, required) - `pullNumber`: Pull request 编号 (number, required) - `repo`: Repository 名称 (string, required) - **create_pull_request** - 打开新的 Pull Request - **Required OAuth Scopes**: `repo` - `base`: 要合并到的分支 (string, required) - `body`: PR 描述 (string, optional) - `draft`: 创建为草稿 PR (boolean, optional) - `head`: 包含更改的分支 (string, required) - `maintainer_can_modify`: 允许维护者编辑 (boolean, optional) - `owner`: Repository 所有者 (string, required) - `repo`: Repository 名称 (string, required) - `title`: PR 标题 (string, required) - **list_pull_requests** - 列出 Pull Requests - **Required OAuth Scopes**: `repo` - `base`: 按 base 分支过滤 (string, optional) - `direction`: 排序方向 (string, optional) - `head`: 按 head 用户/组织和分支过滤 (string, optional) - `owner`: Repository 所有者 (string, required) - `page`: 分页页码 (min 1) (number, optional) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `repo`: Repository 名称 (string, required) - `sort`: 排序方式 (string, optional) - `state`: 按状态过滤 (string, optional) - **merge_pull_request** - 合并 Pull Request - **Required OAuth Scopes**: `repo` - `commit_message`: 合并提交的额外详情 (string, optional) - `commit_title`: 合并提交的标题 (string, optional) - `merge_method`: 合并方法 (string, optional) - `owner`: Repository 所有者 (string, required) - `pullNumber`: Pull request 编号 (number, required) - `repo`: Repository 名称 (string, required) - **pull_request_read** - 获取单个 Pull Request 的详情 - **Required OAuth Scopes**: `repo` - `method`: 指定需要从 GitHub 检索哪些 Pull Request 数据的操作。 可能的选项: 1. get - 获取特定 Pull Request 的详情。 2. get_diff - 获取 Pull Request 的 diff。 3. get_status - 获取 Pull Request 中 head commit 的组合 commit 状态。 4. get_files - 获取 Pull Request 中更改的文件列表。与分页参数一起使用以控制返回的结果数量。 5. get_review_comments - 获取 Pull Request 上的审查线程。每个线程包含在同一代码位置 Pull Request 审查期间进行的逻辑分组的审查评论。返回带有元数据(isResolved、isOutdated、isCollapsed)及其关联评论的线程。使用基于游标的分页(perPage、after)控制结果。 6. get_reviews - 获取 Pull Request 上的审查。当询问审查评论时,使用 get_review_comments 方法。 7. get_comments - 获取 Pull Request 上的评论。如果用户不是特别想要审查评论,请使用此选项。与分页参数一起使用以控制返回的结果数量。 8. get_check_runs - 获取 Pull Request 的 head commit 的 check runs。Check runs 是在 PR 上运行的各个 CI/CD 作业和检查。 (string, required) - `owner`: Repository 所有者 (string, required) - `page`: 分页页码 (min 1) (number, optional) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `pullNumber`: Pull request 编号 (number, required) - `repo`: Repository 名称 (string, required) - **pull_request_review_write** - 对 Pull Request 审查进行写入操作(创建、提交、删除)。 - **Required OAuth Scopes**: `repo` - `body`: 审查评论文本 (string, optional) - `commitID`: 要审查的 commit SHA (string, optional) - `event`: 要执行的审查操作。 (string, optional) - `method`: 对 Pull Request 审查执行的写入操作。 (string, required) - `owner`: Repository 所有者 (string, required) - `pullNumber`: Pull request 编号 (number, required) - `repo`: Repository 名称 (string, required) - **search_pull_requests** - 搜索 Pull Requests - **Required OAuth Scopes**: `repo` - `order`: 排序顺序 (string, optional) - `owner`: 可选的 repository 所有者。如果与 repo 一起提供,则仅列出此 repository 的 pull requests。 (string, optional) - `page`: 分页页码 (min 1) (number, optional) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `query`: 使用 GitHub Pull Request 搜索语法的搜索查询 (string, required) - `repo`: 可选的 repository 名称。如果与 owner 一起提供,则仅列出此 repository 的 pull requests。 (string, optional) - `sort`: 按匹配类别数量排序字段,默认为最佳匹配 (string, optional) - **update_pull_request** - 编辑 Pull Request - **Required OAuth Scopes**: `repo` - `base`: 新的 base 分支名称 (string, optional) - `body`: 新描述 (string, optional) - `draft`: 将 Pull Request 标记为草稿 或准备好审查 (string, optional) - `maintainer_can_modify`: 允许维护者编辑 (boolean, optional) - `owner`: Repository 所有者 (string, required) - `pullNumber`: 要更新的 Pull request 编号 (number, required) - `repo`: Repository 名称 (string, required) - `reviewers`: 请求审查的 GitHub 用户名 (string[], optional) - `state`: 新状态 (string, optional) - `title`: 新标题 (string, optional) - **update_pull_request_branch** - 更新 Pull Request 分支 - **Required OAuth Scopes**: `repo` - `expectedHeadSha`: Pull Request 的 HEAD 引用的预期 SHA (string, optional) - `owner`: Repository 所有者 (string, required) - `pullNumber`: Pull request 编号 (number, required) - `repo`: Repository 名称 (string, required)
repo Repositories - **create_branch** - 创建分支 - **Required OAuth Scopes**: `repo` - `branch`: 新分支的名称 (string, required) - `from_branch`: 源分支(默认为 repo 默认分支) (string, optional) - `owner`: Repository 所有者 (string, required) - `repo`: Repository 名称 (string, required) - **create_or_update_file** - 创建或更新文件 - **Required OAuth Scopes**: `repo` - `branch`: 在其中创建/更新文件的分支 (string, required) - `content`: 文件内容 (string, required) - `message`: Commit 消息 (string, required) - `owner`: Repository 所有者(用户名或组织) (string, required) - `path`: 创建/更新文件的路径 (string, required) - `repo`: Repository 名称 (string, required) - `sha`: 被替换文件的 blob SHA。如果文件已存在则必需。 (string, optional) - **create_repository** - 创建 Repository - **Required OAuth Scopes**: `repo` - `autoInit`: 使用 README 初始化 (boolean, optional) - `description`: Repository 描述 (string, optional) - `name`: Repository 名称 (string, required) - `organization`: 在其中创建 repository 的组织(省略则在个人账户中创建) (string, optional) - `private`: Repository 是否应为私有 (boolean, optional) - **delete_file** - 删除文件 - **Required OAuth Scopes**: `repo` - `branch`: 从中删除文件的分支 (string, required) - `message`: Commit 消息 (string, required) - `owner`: Repository 所有者(用户名或组织) (string, required) - `path`: 要删除的文件路径 (string, required) - `repo`: Repository 名称 (string, required) - **fork_repository** - Fork Repository - **Required OAuth Scopes**: `repo` - `organization`: 要 fork 到的组织 (string, optional) - `owner`: Repository 所有者 (string, required) - `repo`: Repository 名称 (string, required) - **get_commit** - 获取 Commit 详情 - **Required OAuth Scopes**: `repo` - `include_diff`: 是否在响应中包含文件 diff 和统计。默认为 true。 (boolean, optional) - `owner`: Repository 所有者 (string, required) - `page`: 分页页码 (min 1) (number, optional) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `repo`: Repository 名称 (string, required) - `sha`: Commit SHA、分支名称或标签名称 (string, required) - **get_file_contents** - 获取文件或目录内容 - **Required OAuth Scopes**: `repo` - `owner`: Repository 所有者(用户名或组织) (string, required) - `path`: 文件/目录路径 (string, optional) - `ref`: 接受可选的 git refs,如 `refs/tags/{tag}`、`refs/heads/{branch}` 或 `refs/pull/{pr_number}/head` (string, optional) - `repo`: Repository 名称 (string, required) - `sha`: 接受可选的 commit SHA。如果指定,将代替 ref 使用 (string, optional) - **get_latest_release** - 获取最新 Release - **Required OAuth Scopes**: `repo` - `owner`: Repository 所有者 (string, required) - `repo`: Repository 名称 (string, required) - **get_release_by_tag** - 按标签名称获取 Release - **Required OAuth Scopes**: `repo` - `owner`: Repository 所有者 (string, required) - `repo`: Repository 名称 (string, required) - `tag`: 标签名称(例如 'v1.0.0') (string, required) - **get_tag** - 获取 Tag 详情 - **Required OAuth Scopes**: `repo` - `owner`: Repository 所有者 (string, required) - `repo`: Repository 名称 (string, required) - `tag`: 标签名称 (string, required) - **list_branches** - 列出分支 - **Required OAuth Scopes**: `repo` - `owner`: Repository 所有者 (string, required) - `page`: 分页页码 (min 1) (number, optional) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `repo`: Repository 名称 (string, required) - **list_commits** - 列出 Commits - **Required OAuth Scopes**: `repo` - `author`: 按作者用户名或电子邮件地址过滤 Commits (string, optional) - `owner`: Repository 所有者 (string, required) - `page`: 分页页码 (min 1) (number, optional) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `repo`: Repository 名称 (string, required) - `sha`: 要列出 Commits 的 Commit SHA、分支或标签名称。如果未提供,使用 repository 的默认分支。如果提供 Commit SHA,将列出直到该 SHA 的 Commits。 (string, optional) - **list_releases** - 列出 Releases - **Required OAuth Scopes**: `repo` - `owner`: Repository 所有者 (string, required) - `page`: 分页页码 (min 1) (number, optional) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `repo`: Repository 名称 (string, required) - **list_tags** - 列出 Tags - **Required OAuth Scopes**: `repo` - `owner`: Repository 所有者 (string, required) - `page`: 分页页码 (min 1) (number, optional) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `repo`: Repository 名称 (string, required) - **push_files** - 推送文件到 Repository - **Required OAuth Scopes**: `repo` - `branch`: 要推送到的分支 (string, required) - `files`: 要推送的文件对象数组,每个对象包含 path (string) 和 content (string) (object[], required) - `message`: Commit 消息 (string, required) - `owner`: Repository 所有者 (string, required) - `repo`: Repository 名称 (string, required) - **search_code** - 搜索代码 - **Required OAuth Scopes**: `repo` - `order`: 结果的排序顺序 (string, optional) - `page`: 分页页码 (min1) (number, optional) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `query`: 使用 GitHub 强大的代码搜索语法的搜索查询。示例:'content:Skill language:Java org:github'、'NOT is:archived language:Python OR language:go'、'repo:github/github-mcp-server'。支持精确匹配、语言过滤、路径过滤等。 (string, required) - `sort`: 排序字段(仅 'indexed') (string, optional) - **search_repositories** - 搜索 Repositories - **Required OAuth Scopes**: `repo` - `minimal_output`: 返回最少的 repository 信息(默认:true)。为 false 时,返回完整的 GitHub API repository 对象。 (boolean, optional) - `order`: 排序顺序 (string, optional) - `page`: 分页页码 (min 1) (number, optional) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `query`: Repository 搜索查询。示例:'machine learning in:name stars:>1000 language:python'、'topic:react'、'user:facebook'。支持高级搜索语法以进行精确过滤。 (string, required) - `sort`: 按字段排序 repositories,默认为最佳匹配 (string, optional)
shield-lock Secret Protection - **get_secret_scanning_alert** - 获取 Secret Scanning 告警 - **Required OAuth Scopes**: `security_events` - **Accepted OAuth Scopes**: `repo`, `security_events` - `alertNumber`: 告警编号。 (number, required) - `owner`: Repository 的所有者。 (string, required) - `repo`: Repository 的名称。 (string, required) - **list_secret_scanning_alerts** - 列出 Secret Scanning 告警 - **Required OAuth Scopes**: `security_events` - **Accepted OAuth Scopes**: `repo`, `security_events` - `owner`: Repository 的所有者。 (string, required) - `repo`: Repository 的名称。 (string, required) - `resolution`: 按解决方案过滤 (string, optional) - `secret_type`: 要返回的 Secret 类型的逗号分隔列表。返回所有默认的 Secret 模式。要返回通用模式,请在参数中传递 token 名称。 (string, optional) - `state`: 按状态过滤 (string, optional)
shield Security Advisories - **get_global_security_advisory** - 获取全局 Security Advisory - **Required OAuth Scopes**: `security_events` - **Accepted OAuth Scopes**: `repo`, `security_events` - `ghsaId`: GitHub Security Advisory ID(格式:GHSA-xxxx-xxxx-xxxx)。 (string, required) - **list_global_security_advisories** - 列出全局 Security Advisories - **Required OAuth Scopes**: `security_events` - **Accepted OAuth Scopes**: `repo`, `security_events` - `affects`: 按受影响的包或版本过滤 advisories(例如 "package1,package2@1.0.0")。 (string, optional) - `cveId`: 按 CVE ID 过滤。 (string, optional) - `cwes`: 按 Common Weakness Enumeration IDs 过滤(例如 ["79", "284", "22"])。 (string[], optional) - `ecosystem`: 按包生态系统过滤。 (string, optional) - `ghsaId`: 按 GitHub Security Advisory ID 过滤(格式:GHSA-xxxx-xxxx-xxxx)。 (string, optional) - `isWithdrawn`: 是否仅返回已撤回的 advisories。 (boolean, optional) - `modified`: 按发布或更新日期或日期范围过滤(ISO 8601 date or range)。 (string, optional) - `published`: 按发布日期或日期范围过滤(ISO 8601 date or range)。 (string, optional) - `severity`: 按严重程度过滤。 (string, optional) - `type`: Advisory 类型。 (string, optional) - `updated`: 按更新日期或日期范围过滤(ISO 8601 date or range)。 (string, optional) - **list_org_repository_security_advisories** - 列出组织 Repository Security Advisories - **Required OAuth Scopes**: `security_events` - **Accepted OAuth Scopes**: `repo`, `security_events` - `direction`: 排序方向。 (string, optional) - `org`: 组织登录名。 (string, required) - `sort`: 排序字段。 (string, optional) - `state`: 按 advisory 状态过滤。 (string, optional) - **list_repository_security_advisories** - 列出 Repository Security Advisories - **Required OAuth Scopes**: `security_events` - **Accepted OAuth Scopes**: `repo`, `security_events` - `direction`: 排序方向。 (string, optional) - `owner`: Repository 的所有者。 (string, required) - `repo`: Repository 的名称。 (string, required) - `sort`: 排序字段。 (string, optional) - `state`: 按 advisory 状态过滤。 (string, optional)
star Stargazers - **list_starred_repositories** - 列出已加星标的 Repositories - **Required OAuth Scopes**: `repo` - `direction`: 结果排序方向。 (string, optional) - `page`: 分页页码 (min 1) (number, optional) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `sort`: 如何排序结果。可以是 'created'(repository 被加星标时)或 'updated'(repository 最后一次推送时)。 (string, optional) - `username`: 要列出已加星标 repositories 的用户名。默认为经过身份验证的用户。 (string, optional) - **star_repository** - 为 Repository 加星标 - **Required OAuth Scopes**: `repo` - `owner`: Repository 所有者 (string, required) - `repo`: Repository 名称 (string, required) - **unstar_repository** - 取消 Repository 星标 - **Required OAuth Scopes**: `repo` - `owner`: Repository 所有者 (string, required) - `repo`: Repository 名称 (string, required)
people Users - **search_users** - 搜索用户 - **Required OAuth Scopes**: `repo` - `order`: 排序顺序 (string, optional) - `page`: 分页页码 (min 1) (number, optional) - `perPage`: 每页结果数 (min 1, max 100) (number, optional) - `query`: 用户搜索查询。示例:'john smith'、'location:seattle'、'followers:>100'。搜索自动限定为 type:user。 (string, required) - `sort`: 按关注者或 repositories 数量或加入 GitHub 的时间排序用户。 (string, optional)
### 远程 GitHub MCP Server 中的额外工具
Copilot - **create_pull_request_with_copilot** - 使用 GitHub Copilot Coding Agent 执行任务 - `owner`: Repository 所有者。你可以猜测所有者,但在继续之前请与用户确认。 (string, required) - `repo`: Repository 名称 - `base_ref`:Agent 将开始工作的 Git 引用(例如分支)。如果未指定,默认为仓库的默认分支(字符串,可选)
Copilot Spaces - **get_copilot_space** - 获取 Copilot Space - `owner`:Space 的所有者。(字符串,必填) - `name`:Space 的名称。(字符串,必填) - **list_copilot_spaces** - 列出 Copilot Spaces
GitHub 支持文档搜索 - **github_support_docs_search** - 检索相关文档以回答 GitHub 产品和支持问题。支持的主题包括:GitHub Actions Workflows、身份验证、GitHub 支持咨询、Pull Request 实践、仓库维护、GitHub Pages、GitHub Packages、GitHub Discussions、Copilot Spaces - `query`:用户关于需要回答的问题的输入。这是最新的原始未编辑用户消息。您应始终保留用户消息原样,切勿修改它。(字符串,必填)
## 动态工具发现 **注意**:此功能目前处于 Beta 阶段,且在远程 GitHub MCP Server 中不可用。请测试该功能,如果遇到任何问题,请告知我们。 您无需在启动时启用所有工具,而是可以开启动态工具集发现。动态工具集允许 MCP 主机根据用户提示列出并启用工具集。这有助于避免模型因可用工具数量过多而混淆的情况。 ### 使用动态工具发现 使用二进制文件时,您可以传入 `--dynamic-toolsets` 标志。 ``` ./github-mcp-server --dynamic-toolsets ``` 使用 Docker 时,您可以将工具集作为环境变量传入: ``` docker run -i --rm \ -e GITHUB_PERSONAL_ACCESS_TOKEN= \ -e GITHUB_DYNAMIC_TOOLSETS=1 \ ghcr.io/github/github-mcp-server ``` ## 只读模式 要以只读模式运行服务器,您可以使用 `--read-only` 标志。这将仅提供只读工具,防止对仓库、Issue、Pull Request 等进行任何修改。 ``` ./github-mcp-server --read-only ``` 使用 Docker 时,您可以将只读模式作为环境变量传入: ``` docker run -i --rm \ -e GITHUB_PERSONAL_ACCESS_TOKEN= \ -e GITHUB_READ_ONLY=1 \ ghcr.io/github/github-mcp-server ``` ## 锁定模式 锁定模式限制服务器将从公开仓库中展示的内容。启用后,服务器会检查每个项目的作者是否拥有对仓库的写入权限。私有仓库不受影响,协作者保留对其自己内容的完整访问权限。 ``` ./github-mcp-server --lockdown-mode ``` 使用 Docker 运行时,设置相应的环境变量: ``` docker run -i --rm \ -e GITHUB_PERSONAL_ACCESS_TOKEN= \ -e GITHUB_LOCKDOWN_MODE=1 \ ghcr.io/github/github-mcp-server ``` 锁定模式的行为取决于调用的工具。 当作者缺少写入权限时,以下工具将返回错误: - `issue_read:get` - `pull_request_read:get` 以下工具将过滤掉缺少写入权限的用户的内容: - `issue_read:get_comments` - `issue_read:get_sub_issues` - `pull_request_read:get_comments` - `pull_request_read:get_review_comments` - `pull_request_read:get_reviews` ## i18n / 覆盖描述 工具的描述可以通过在与二进制文件相同的目录中创建一个 `github-mcp-server-config.json` 文件来覆盖。 该文件应包含一个 JSON 对象,以工具名称为键,新的描述为值。例如: ``` { "TOOL_ADD_ISSUE_COMMENT_DESCRIPTION": "an alternative description", "TOOL_CREATE_BRANCH_DESCRIPTION": "Create a new branch in a GitHub repository" } ``` 您可以通过使用 `--export-translations` 标志运行二进制文件来创建当前翻译的导出。 此标志将保留您所做的任何翻译/覆盖,同时添加自上次导出以来二进制文件中新增的 任何新翻译。 ``` ./github-mcp-server --export-translations cat github-mcp-server-config.json ``` 您也可以使用环境变量来覆盖描述。环境变量名称与 JSON 文件中的键相同, 但带有 `GITHUB_MCP_` 前缀且全部大写。 例如,要覆盖 `TOOL_ADD_ISSUE_COMMENT_DESCRIPTION` 工具,您可以 设置以下环境变量: ``` export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description" ``` ## 库用法 此模块导出的 Go API 目前应被视为不稳定,可能会发生破坏性变更。未来,我们可能会提供稳定性;如果有对此有价值的使用场景,请提交 Issue。 ## 许可证 本项目根据 MIT 开源许可证的条款授权。有关完整条款,请参阅 [MIT](./LICENSE)。
标签:API 集成, Chatbot, Copilot, DLL 劫持, EVTX分析, Go, HTTPX, Issue 管理, LLM, MCP Server, Model Context Protocol, Pull Request, Ruby工具, SOC Prime, Unmanaged PE, VS Code, 人工智能, 仓库管理, 代码分析, 代码审查, 凭证管理, 团队协作, 大语言模型, 安全告警, 开发工具, 开源, 日志审计, 用户模式Hook绕过, 请求拦截