Skip to main content
Glama
Abdessamad-Y

mcp-github-agent

by Abdessamad-Y

mcp-agent

一个多服务 MCP(Model Context Protocol)服务器,为 AI 代理提供跨 9 个平台的 34 个工具——GitHub、Jira、Azure DevOps、Slack、PagerDuty、Linear、Notion、HuggingFace 和 OpenWeather。

无需在标签页和仪表盘之间来回切换,你只需用自然语言与 AI 助手对话,它就会直接查询或操作这些系统。

适用于 Claude、GPT-4o、Azure OpenAI 以及任何兼容 MCP 的客户端。


什么是 MCP?

Model Context Protocol(模型上下文协议) 是 Anthropic 提出的开放标准,让 AI 模型能够以结构化、安全的方式与外部工具和 API 通信。AI 保持在对话中,但可以触达真实系统来获取数据或执行操作——自主决定调用哪些工具以及调用顺序。

→ 工作原理详解


Related MCP server: GitHub MCP Server

服务与工具

GitHub

工具

类型

功能

get_user_profile

读取

个人简介、所在地、关注者数量及公开仓库数

get_user_repos

读取

按活跃度、星标数或日期排序的公开仓库

get_repo_info

读取

星标数、fork 数、未关闭 issue、主题、许可证、最后推送时间

get_repo_issues

读取

未关闭或已关闭的 issue

get_pull_requests

读取

未关闭或已合并的拉取请求

get_file_content

读取

仓库中任意文件的内容

get_repo_contributors

读取

按提交次数排名的顶级贡献者

get_repo_releases

读取

最新版本与更新日志

get_trending

读取

按语言和周期(每日/每周/每月)查看趋势仓库

search_repos

读取

按关键词、主题或语言搜索

create_issue

写入

创建新 issue(需要 repo 令牌权限范围)

Jira

工具

类型

功能

jira_search_issues

读取

使用 JQL 搜索 issue

jira_get_issue

读取

按 key 查看 issue 的完整详情

jira_get_project_issues

读取

按状态筛选的项目 issue

jira_create_issue

写入

创建 Task、Bug、Story 或 Epic

Azure DevOps

工具

类型

功能

ado_list_pipelines

读取

列出项目中的 CI/CD 流水线

ado_get_pipeline_runs

读取

查看流水线的最近运行记录

ado_search_work_items

读取

按关键词搜索工作项

ado_create_work_item

写入

创建 Task、Bug、User Story 或 Epic

Slack

工具

类型

功能

slack_get_channels

读取

列出工作区中的公开频道

slack_get_messages

读取

读取频道中的最近消息

slack_send_message

写入

向频道或用户发送消息

PagerDuty

工具

类型

功能

pagerduty_get_incidents

读取

按状态列出事件

pagerduty_get_services

读取

列出已配置的服务

pagerduty_create_incident

写入

触发新事件

Linear

工具

类型

功能

linear_get_teams

读取

列出工作区中的团队

linear_get_issues

读取

按状态筛选的团队 issue

linear_create_issue

写入

在团队中创建 issue

Notion

工具

类型

功能

notion_search

读取

按关键词搜索页面和数据库

notion_get_page

读取

获取页面内容

notion_create_page

写入

在父页面下创建新页面

HuggingFace

工具

类型

功能

hf_search_models

读取

按关键词和任务搜索模型

hf_get_model

读取

模型详细信息(下载量、点赞数、标签)

hf_search_datasets

读取

按关键词搜索数据集

OpenWeather

工具

类型

功能

weather_current

读取

城市当前天气

weather_forecast

读取

城市多日天气预报


示例用例

跨服务推理

"检查本周是否有与 Azure DevOps 流水线失败相关的未关闭 Jira bug,然后创建一个 GitHub issue 进行汇总。"

代理会自主依次调用 jira_search_issues → ado_get_pipeline_runs → create_issue。


事件响应

"支付服务上有一个活跃的 PagerDuty 事件。找到合并到该仓库的最新 PR,并通知 #incidents Slack 频道。"

代理会调用 pagerduty_get_incidents → get_pull_requests → slack_send_message。


AI 研究

"在 HuggingFace 上找到下载量最高的文本生成模型,然后在 GitHub 上搜索使用该热门模型的项目。"

代理会调用 hf_search_models → search_repos。


开发者入职

"这个仓库的前 5 位贡献者是谁?获取他们的 GitHub 个人资料,并创建一个 Notion 页面来汇总团队信息。"

代理会调用 get_repo_contributors → get_user_profile (×5) → notion_create_page。

→ 更多用例


安装

1. 克隆并安装

git clone https://github.com/Abdessamad-Y/mcp-github-agent.git
cd mcp-github-agent
pip install -r requirements.txt

2. 配置你的服务

cp .env.example .env
# Add tokens only for the services you want to use
# Unused services are safely ignored

3. 连接到你的 AI 客户端

→ 参见 docs/integrations.md 获取设置指南:

  • Claude Desktop — 原生 MCP,无需编写代码

  • Claude API — 带代理循环的 Python 脚本

  • OpenAI (GPT-4o) — 通过 openai-agents SDK

  • Azure OpenAI — 通过 OpenAI SDK + Azure 端点

  • Cursor / VS Code Copilot


运行演示

GITHUB_TOKEN=your_token python demo.py

运行 4 个真实场景,并输出格式化的终端结果。无需 AI API 密钥。


运行示例

# With Claude API
GITHUB_TOKEN=your_token ANTHROPIC_API_KEY=your_key python examples/with_claude.py

# With OpenAI
GITHUB_TOKEN=your_token OPENAI_API_KEY=your_key python examples/with_openai.py

# With Azure OpenAI
GITHUB_TOKEN=your_token \
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com \
AZURE_OPENAI_KEY=your_key \
AZURE_OPENAI_DEPLOYMENT=gpt-4o \
python examples/with_azure_openai.py

项目结构

mcp-github-agent/
├── server.py              # Entry point — registers all tools
├── mcp_instance.py        # Shared FastMCP instance
├── tools/
│   ├── github.py          # 11 GitHub tools
│   ├── jira.py            # 4 Jira tools
│   ├── azure_devops.py    # 4 Azure DevOps tools
│   ├── slack.py           # 3 Slack tools
│   ├── pagerduty.py       # 3 PagerDuty tools
│   ├── linear.py          # 3 Linear tools
│   ├── notion.py          # 3 Notion tools
│   ├── huggingface.py     # 3 HuggingFace tools
│   └── weather.py         # 2 OpenWeather tools
├── examples/
│   ├── with_claude.py
│   ├── with_openai.py
│   └── with_azure_openai.py
├── docs/
│   ├── how-it-works.md
│   ├── use-cases.md
│   └── integrations.md
├── demo.py
├── requirements.txt
└── .env.example

技术栈

语言

Python 3.10+

MCP SDK

mcp[cli] — Anthropic 官方 Python SDK

HTTP 客户端

httpx

终端输出

rich


文档

工作原理

架构、MCP 协议、传输方式

用例

真实场景提示词与代理行为

集成

Claude、OpenAI、Azure OpenAI、Cursor、VS Code 的设置


许可证

MIT

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Enables AI assistants to access and analyze GitHub profile data, providing insights on repositories, commit history, coding patterns, and generating portfolio summaries for developers and recruiters.
    8
    2
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables AI assistants to answer natural-language GitHub queries by listing repositories, issues, pull requests, branches, commits, and files, as well as performing writes with dry-run and confirmation safeguards.
    -