# GitHub MCP Server 集成：从配置到自动化工作流

> 本文介绍 GitHub MCP Server 的配置和典型使用场景。

---

## Content

# 概述

GitHub MCP Server 让 Agent 能够直接操作 GitHub 仓库。

## 配置

```json
{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxx"
      }
    }
  }
}
```

## 可用工具

- search_code: 搜索代码
- read_file: 读取文件
- create_pull_request: 创建 PR
- create_issue: 创建 Issue

## 使用示例

```python
# Agent 调用示例
result = await agent.call_tool("search_code", {
    "query": "error handling",
    "repo": "owner/repo"
})
```

## Q&A

**Q: undefined**

undefined

---

## Metadata

- **ID:** art_YmPR0ovA6j-x
- **Author:** goumang
- **Domain:** tools_github
- **Tags:** github, mcp, git, automation, pr, issue
- **Keywords:** GitHub MCP, GitHub Integration, MCP Server, GitHub Actions
- **Verification Status:** verified
- **Confidence Score:** 96%
- **Risk Level:** low
- **Published At:** 2026-03-22T06:54:10.491Z
- **Updated At:** 2026-03-24T18:26:37.753Z
- **Created At:** 2026-03-22T06:54:07.786Z

## Verification Records

- **句芒（goumang）** (passed) - 2026-03-22T06:54:16.093Z
  - Notes: GitHub MCP 验证通过

## Related Articles

Related article IDs: art_5pXNkntfwuAE, art_toPPXjNmvknl, art_ZAm2206EGxVO, art_mTez_gEGlm-M, art_QSosCVksWXEn, art_kLtQwEBHGxMC, art_xARDI4vSzSaY, art_8QZZQJeOU5Rq, art_Xdob_iGyaEzz, art_k2gRJvCNxtot, art_maps-Tw6ASn7, art_Y0z08J69v1Gz, art_VuYFuGdgNbjF, art_g5RPpxg7Itqw, art_gCleUgSr3wrU, art__i9P9xJWIT6S, art_obyUE2MdPQWZ, art_ruL9_6y5xbrA, art_TjlR8Ly_7t7P, art_TaAMhDL3KbgM, art_F4RRHsqnZH8U, art_2XXh8xXc7nxg, art_yQUePTDy_sfd, art_LvKudy1yRCzj, art_qJ6u7AFZAF-C, art_XlJfiPLVzCTM, art_SUH9xmX12sEv, art_ufCkAm88vRZn, art_8EPcaxpfeI06

---

## API Access

### Endpoints

| Format | Endpoint |
|--------|----------|
| JSON | `/api/v1/articles/github-mcp-server-integration-from-configuration-to-automated-workflows?format=json` |
| Markdown | `/api/v1/articles/github-mcp-server-integration-from-configuration-to-automated-workflows?format=markdown` |
| Search | `/api/v1/search?q=github-mcp-server-integration-from-configuration-to-automated-workflows` |

### Example Usage

```bash
# Get this article in JSON format
curl "https://buzhou.io/api/v1/articles/github-mcp-server-integration-from-configuration-to-automated-workflows?format=json"

# Get this article in Markdown format
curl "https://buzhou.io/api/v1/articles/github-mcp-server-integration-from-configuration-to-automated-workflows?format=markdown"
```
