mcpField
G
GitHub MCP Server Integration

GitHub MCP Server Integration

本地服务
github.com/faheema15版本控制085 周前更新

关于 GitHub MCP Server Integration

GitHub MCP Server Integration 是面向 AI 助手的 FastAPI 服务,可通过 GitHub API 查询用户资料、列出仓库并创建议题。

主要功能

  1. 01查询已认证的 GitHub 用户资料
  2. 02按用户名列出仓库
  3. 03创建仓库议题
  4. 04使用 GitHub 令牌认证

适用场景

  1. 01为助手查询 GitHub 个人资料
  2. 02浏览用户的仓库
  3. 03通过 AI 助手创建议题

MCP 相关

它实现了 MCP 服务,向 AI 助手提供 GitHub 用户资料查询、仓库列表和议题创建操作。OpenAPI 与 ai-plugin.json 描述其端点和元数据。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

暂未收录安装方式

我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。

代码仓库

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

GitHub MCP 服务集成

本项目展示了一个与 GitHub API 集成的 Model Context Protocol(MCP)服务。它允许 Claude 或 OpenAI GPT 等 AI 助手通过 MCP 与 GitHub 交互。


🌐 在线演示

👉 已部署的服务链接
👉 .well-known/ai-plugin.json 端点:

https://github-mcp-server-production.up.railway.app/.well-known/ai-plugin.json

📖 项目概述

此 MCP 服务提供了一个 REST API,允许 AI 助手:

  • 获取用户的 GitHub 个人资料信息
  • 列出用户的仓库
  • 在仓库中创建议题

该服务遵循 Model Context Protocol(MCP) 标准,确保与 AI 系统互操作。


🔧 技术栈

  • FastAPI(用于构建 API 的 Python 框架)
  • OpenAPI(描述 REST API 的标准)
  • ai-plugin.json(MCP 元数据配置)
  • GitHub REST API v3
  • 部署在 Railway 上

✨ 功能

  • 符合 MCP 标准且提供 OpenAPI 文档的服务
  • 使用个人访问令牌与 GitHub 安全交互
  • AI 助手可以:
    • 获取 GitHub 用户详情
    • 按用户名列出仓库
    • 在仓库中创建议题

📂 项目结构

├── ai-plugin.json             # MCP Plugin metadata for AI Assistants
├── openapi.yaml               # OpenAPI spec describing the available endpoints
├── main.py                    # FastAPI MCP server code
├── requirements.txt           # Python dependencies
└── README.md                  # Project documentation (this file)

🚀 工作原理

1. FastAPI 服务
  • 提供以下 REST API 端点:
    • /github/user
    • /github/repos/{username}
    • /github/repos/{owner}/{repo}/issues
2. ai-plugin.json
  • 供 AI 助手了解 MCP 服务的元数据:
    • 插件名称、描述
    • 身份验证方式
    • OpenAPI URL 引用
3. openapi.yaml
  • 定义 AI 助手进行交互所需的所有路由和参数。

🔐 身份验证

  • GitHub 个人访问令牌(PAT)
    • 设置为环境变量:GITHUB_TOKEN
    • 在 .env 文件中设置,或直接在 Railway 的环境设置中配置。

⚙️ 设置说明(本地开发)

前置条件:
  • Python 3.9+
  • 具有 repo 权限的 GitHub 个人访问令牌(PAT)
克隆仓库:
git clone https://github.com/yourusername/github-mcp-server.git
cd github-mcp-server
安装依赖:
pip install -r requirements.txt
创建 .env 文件:
GITHUB_TOKEN=your_personal_access_token
运行 FastAPI 服务:
uvicorn main:app --reload

访问 http://localhost:8000/docs 查看 Swagger UI


🌍 部署(Railway)

  1. 登录 Railway
  2. 创建新项目 → 从 GitHub 部署 → 选择你的 MCP 仓库
  3. 在 Railway 中将 GITHUB_TOKEN 添加为环境变量
  4. 确认启动命令:
    uvicorn main:app --host 0.0.0.0 --port 8000
    
  5. 部署并获取生产环境 URL(例如,https://github-mcp-server-production.up.railway.app)

🤖 使用 AI 助手进行演示

Claude AI / OpenAI GPT 插件(是否可用取决于访问权限)
  • 在 AI 助手设置中注册 .well-known/ai-plugin.json URL。
  • 使用自然语言提示词进行交互:
    "List my GitHub repositories."
    "Create an issue in my repo named 'sample-repo'."
    

📜 OpenAPI 端点

端点方法描述
/github/userGET获取已通过身份验证的用户信息
/github/repos/{username}GET列出用户的仓库
/github/repos/{owner}/{repo}/issuesPOST在仓库中创建议题

📝 请求示例

获取用户信息
curl -X GET https://github-mcp-server-production.up.railway.app/github/user
列出仓库
curl -X GET https://github-mcp-server-production.up.railway.app/github/repos/<username>
创建议题
curl -X POST https://github-mcp-server-production.up.railway.app/github/repos/<owner>/<repo>/issues \
  -H "Content-Type: application/json" \
  -d '{"title": "Bug found!", "body": "Please fix this bug."}'

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。