GitHub Activity MCP Server
🚀 GitHub Activity MCP Server
一个使用 FastMCP 和 PyGithub 构建的 MCP(Model Context Protocol)服务器,可将 AI 助手连接到 GitHub——搜索仓库、管理 Issue 与 PR、分析贡献,以及更多。
什么是 MCP? Model Context Protocol 是一种开放标准,让 AI 助手通过统一接口连接到外部数据和工具。可以把它想象成“AI 界的 USB-C”。
✨ 功能特性
该服务器提供 13 个工具、3 个资源提供者和 3 个提示模板,覆盖全部三种 MCP 原语。
🔧 工具(模型控制)
AI 可自主执行的操作:
工具 | 说明 |
| 按查询、语言、星标搜索 GitHub 仓库 |
| 获取仓库详细信息(星标、fork、主题等) |
| 读取仓库中的任意文件 |
| 列出最近的提交,支持筛选 |
| 按状态/标签/指派对象筛选 issue |
| 获取 issue 的完整详情 + 评论 |
| 创建新的 issue |
| 在 issue 上发表评论 |
| 按状态/分支筛选 PR |
| 获取 PR 详情 + 合并状态 |
| 查看 PR 代码改动 |
| 获取用户的公开资料 |
| 列出用户的所有仓库 |
📦 资源(应用控制)
AI 可读取的上下文数据:
资源 URI | 说明 |
| 仓库 README(Markdown) |
| 完整文件树列表 |
| 语言占比分布 |
💬 提示词(用户触发)
预置的工作流模板:
提示词 | 说明 |
| 全面的仓库分析 |
| 代码审查(遵循最佳实践) |
| 对未关闭的 issue 分类并排定优先级 |
Related MCP server: GitHub MCP Server
🏗️ 架构
graph LR
A[AI Assistant] <-->|MCP Protocol| B[GitHub MCP Server]
B <-->|REST API| C[GitHub API]
subgraph "MCP Server (FastMCP)"
B --> D[Tools]
B --> E[Resources]
B --> F[Prompts]
end
subgraph "Tools"
D --> D1[Repos]
D --> D2[Issues]
D --> D3[Pull Requests]
D --> D4[Users]
end🚀 快速开始
前置要求
Python ≥ 3.10
GitHub 个人访问令牌(可选,但建议使用以获得更高的速率限制)
安装
# Clone the repository
git clone https://github.com/YOUR_USERNAME/github-mcp-server.git
cd github-mcp-server
# Install dependencies
pip install fastmcp PyGithub设置你的 GitHub Token(可选)
创建一个具有 repo 和 read:user 权限范围的个人访问令牌:
# Linux/macOS
export GITHUB_TOKEN=ghp_your_token_here
# Windows (PowerShell)
$env:GITHUB_TOKEN = "ghp_your_token_here"注意: 没有 token 时,你每小时仅限 60 次 API 请求;有 token 后,每小时可达 5,000 次。
运行服务器
# Run directly
fastmcp run src/server.py
# Or with Python
python -m src.server使用 FastMCP 开发模式测试
fastmcp dev src/server.py⚙️ 配置
Claude Desktop
在 Claude Desktop 配置中添加(macOS 上路径为 ~/Library/Application Support/Claude/claude_desktop_config.json,Windows 上为 %APPDATA%\Claude\claude_desktop_config.json):
{
"mcpServers": {
"github": {
"command": "fastmcp",
"args": ["run", "src/server.py"],
"cwd": "/absolute/path/to/github-mcp-server",
"env": {
"GITHUB_TOKEN": "ghp_your_token_here"
}
}
}
}Cursor
在 Cursor 的 MCP 配置中添加(项目中的 .cursor/mcp.json 或全局配置):
{
"mcpServers": {
"github": {
"command": "fastmcp",
"args": ["run", "src/server.py"],
"cwd": "/absolute/path/to/github-mcp-server",
"env": {
"GITHUB_TOKEN": "ghp_your_token_here"
}
}
}
}VS Code(GitHub Copilot)
在 VS Code 设置中添加(.vscode/settings.json):
{
"mcp": {
"servers": {
"github": {
"command": "fastmcp",
"args": ["run", "src/server.py"],
"cwd": "/absolute/path/to/github-mcp-server",
"env": {
"GITHUB_TOKEN": "ghp_your_token_here"
}
}
}
}
}📁 项目结构
github-mcp-server/
├── src/
│ ├── __init__.py
│ ├── server.py # FastMCP server instance & entry point
│ ├── github_client.py # PyGithub client wrapper & error handling
│ ├── resources.py # Resource providers (README, tree, languages)
│ ├── prompts.py # Prompt templates (analyze, review, triage)
│ └── tools/
│ ├── __init__.py
│ ├── repos.py # Repository tools (search, get, file contents, commits)
│ ├── issues.py # Issue tools (list, get, create, comment)
│ ├── pulls.py # Pull request tools (list, get, diff)
│ └── users.py # User tools (profile, repos)
├── pyproject.toml
├── README.md
├── LICENSE
└── .gitignore🛠️ 技术栈
技术 | 用途 |
高级 MCP 服务器框架 | |
GitHub REST API 客户端 | |
AI 工具集成的开放标准 |
🤝 参与贡献
欢迎贡献!步骤如下:
Fork 此仓库
创建功能分支(
git checkout -b feature/amazing-feature)提交你的更改(
git commit -m 'Add amazing feature')推送到分支(
git push origin feature/amazing-feature)打开一个 Pull Request
📄 许可证
本项目采用 MIT 许可证授权——详情请见 LICENSE 文件。
Maintenance
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
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to analyze GitHub repositories, including fetching repository details, searching, and retrieving README content.4522ISC
- FlicenseNot gradedqualityBmaintenanceEnables AI assistants to perform GitHub operations such as creating repositories, issues, pull requests, and more through natural language.
- FlicenseBqualityDmaintenanceEnables AI assistants to inspect local Git repositories and interact with the GitHub API for reading commits, diffs, files, issues, comments, pull requests, and project boards.10121
- FlicenseCqualityBmaintenanceEnables AI assistants to interact with GitHub repositories via the REST API, supporting repository listing, detail retrieval, and issue management.2
Related MCP Connectors
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Connect AI assistants to your GitHub-hosted Obsidian vault to seamlessly access, search, and analy…
Screens public GitHub repos and PRs to generate risk maps, findings, and merge-readiness signals.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/pranjal-sen-2004/github-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server