Skip to main content
Glama
rishav0004

GitHub MCP Server (Custom)

by rishav0004

GitHub MCP Server(自定义)

一个自定义的 Model Context Protocol (MCP) 服务器,为 AI 代理提供对 GitHub 的完整 CRUD 访问:仓库、问题、拉取请求、分支、评论、审查和合并。使用官方 Python mcp SDK(FastMCP)和通过 httpx 的 GitHub REST API 构建。

共 23 个工具 — 完整列表见 server.py。亮点:

领域

工具

仓库

list_repos, get_repo

问题

list_issues, get_issue, create_issue, update_issue, close_issue, add_issue_comment, list_issue_comments

分支

list_branches, get_branch, create_branch, delete_branch

拉取请求

list_pull_requests, get_pull_request, create_pull_request, update_pull_request, merge_pull_request, list_pr_files

审查

list_pr_reviews, create_pr_review

提交

list_commits, get_commit

设置

  1. 安装依赖

    pip install -r requirements.txt
  2. 创建 GitHub 令牌

    前往 https://github.com/settings/tokens 并创建以下任一类型:

    • 一个具有 repo 范围的经典 PAT,或

    • 一个细粒度 PAT,将 ContentsIssuesPull requestsMetadata 设置为读取和写入,范围限定为你希望代理访问的仓库。

  3. 将令牌设置为环境变量

    export GITHUB_TOKEN=ghp_your_token_here
  4. 独立运行(可选健全性检查)

    python server.py

    它将等待 MCP 客户端通过 stdio 连接——这是预期的,它不是 Web 服务器。

Related MCP server: GitHub MCP Server

将其连接到 Claude Desktop

将此添加到你的 claude_desktop_config.json(Windows 上为 %APPDATA%\Claude\claude_desktop_config.json,macOS 上为 ~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "github": {
      "command": "python",
      "args": ["/absolute/path/to/server.py"],
      "env": {
        "GITHUB_TOKEN": "ghp_your_token_here"
      }
    }
  }
}

重启 Claude Desktop,GitHub 工具将出现在工具选择器中。

将其连接到你自己的代理管道(例如 Jira → GitHub → Teams 项目)

由于这是一个标准的 MCP stdio 服务器,任何兼容 MCP 的客户端或 SDK 都可以将其作为子进程启动,并通过 stdin/stdout 与之通信——包括使用 MCP C# SDK 的 .NET 主机,或者如果你的编排器是多语言的,可以使用 Python/TypeScript SDK。将客户端指向:

command: python
args: ["/absolute/path/to/server.py"]
env: { "GITHUB_TOKEN": "<token>" }

扩展它

要添加新工具,只需向 server.py 添加一个新的 @mcp.tool() 装饰函数,该函数调用 _request(method, path, ...) 来访问 GitHub REST API。文档字符串将成为显示给模型的工具描述,类型提示将成为输入模式——因此请确保两者准确。

注意事项

  • 所有写操作(create_*update_*delete_*merge_*)都会在 GitHub 上产生真实更改——没有干运行模式。建议先在临时仓库上进行测试,尤其是 merge_pull_requestdelete_branch

  • 速率限制遵循 GitHub 的标准 REST API 限制(截至撰写本文时,经过身份验证的请求为每小时 5,000 次)——服务器不进行自己的节流。

  • 来自 GitHub 的错误(身份验证失败、404、合并冲突等)会以 RuntimeError 的形式抛出,并包含 API 的响应正文,以便调用代理获得可读的消息来做出反应。

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides secure, controlled access to GitHub operations through the Model Context Protocol with enterprise-grade security features including secret detection, vulnerability scanning, rate limiting, and full audit trails. Supports repository management, file operations, branch creation, commits, and GitHub Actions workflows.
  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    Enables LLMs to interact with GitHub repositories, issues, pull requests, and workflows through the Model Context Protocol. It provides a comprehensive set of tools for repository management, issue tracking, code search, and CI/CD automation.
  • A
    license
    C
    quality
    D
    maintenance
    Enables AI assistants to directly operate GitHub repositories, such as listing issues, through the Model Context Protocol.
    2
    111
    2
    Apache 2.0

View all related MCP servers

Related MCP Connectors

  • Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.

  • Git-backed platform for skills, tools, and context for AI agents

  • A Model Context Protocol (MCP) application for automated GitHub PR analysis and issue management.…

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rishav0004/custom-github-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server