GitHub 通知 MCP 服务器
一个 MCP(模型上下文协议)服务器,提供用于管理 GitHub 通知的工具。该服务器允许像 Claude 这样的 AI 助手通过自然语言命令帮助您管理 GitHub 通知。
特征
- 列出并过滤您的 GitHub 通知
- 将通知标记为已读
- 查看通知线程详细信息
- 订阅或取消订阅通知线程
- 将话题标记为已完成
- 管理特定于存储库的通知
- 控制存储库通知设置(所有活动、默认或静音)
先决条件
- Node.js 18 或更高版本
- 带有
notifications
或repo
范围的 GitHub 个人访问令牌(经典)
安装
- 克隆此存储库
git clone https://github.com/yourusername/github-notifications-mcp-server.git
cd github-notifications-mcp-server
- 安装依赖项
- 构建项目
- 使用你的 GitHub 令牌创建一个
.env
文件GITHUB_TOKEN=your_github_personal_access_token_here
用法
直接运行服务器
与 Claude Desktop 一起使用
将服务器添加到您的claude_desktop_config.json
文件:
{
"mcpServers": {
"github-notifications": {
"command": "node",
"args": ["/absolute/path/to/github-notifications-mcp-server/build/index.js"],
"env": {
"GITHUB_TOKEN": "your_github_personal_access_token_here"
}
}
}
}
可用工具
工具名称 | 描述 |
---|
list-notifications | 列出经过身份验证的用户的所有 GitHub 通知 |
mark-notifications-read | 将所有通知标记为已读 |
get-thread | 获取有关通知线程的信息 |
mark-thread-read | 将特定主题标记为已读 |
mark-thread-done | 将话题标记为已完成 |
get-thread-subscription | 获取主题的订阅状态 |
set-thread-subscription | 订阅主题 |
delete-thread-subscription | 取消订阅主题 |
list-repo-notifications | 列出特定存储库的通知 |
mark-repo-notifications-read | 将存储库的通知标记为已读 |
manage-repo-subscription | 管理存储库订阅:all_activity、默认(参与和@mentions)或忽略(静音) |
示例提示
以下是服务器连接后您可以在 Claude Desktop 中使用的一些示例提示:
- “你能查看我的 GitHub 通知吗?”
- “显示过去 24 小时内未读的通知。”
- “将我的所有通知标记为已读。”
- “您能告诉我有关通知线程 12345 的信息吗?”
- “取消我订阅主题 12345。”
- “我对 octocat/Hello-World 存储库有哪些通知?”
- “将来自 octocat/Hello-World 存储库的所有通知标记为已读。”
- “监视 octocat/Hello-World 存储库上的所有活动。”
- “将 octocat/Hello-World 存储库设置为默认设置(参与和 @mentions)。”
- “检查 octocat/Hello-World 存储库的通知设置。”
- “将来自 octocat/Hello-World 存储库的所有通知静音。”
发展
URL 处理
此服务器会自动将 GitHub API URL 转换为其对应的 Web UI URL。例如:
- API网址:
https://api.github.com/repos/nodejs/node/pulls/57557
- 转换为:
https://github.com/nodejs/node/pull/57557
转换处理:
- 域名从
api.github.com/repos
转换为github.com
- 拉取请求的路径修正(将
pulls
更改为pull
) - 保留额外的路径段
项目结构
github-notifications-mcp-server/
├── src/ # Source code
│ ├── tools/ # Tool implementations
│ ├── types/ # Type definitions
│ ├── utils/ # Utility functions
│ ├── index.ts # Entry point
│ └── server.ts # Server configuration
├── build/ # Compiled JavaScript
├── .env # Environment variables
├── package.json # Dependencies
├── tsconfig.json # TypeScript configuration
└── README.md # Documentation
建筑
测试
运行自动化测试:
手动测试 URL 转换:
执照
麻省理工学院