MCP-GitHub通知管理器
一种MCP服务器,它使像克劳德这样的AI助手能够通过自然语言命令帮助用户管理他们的GitHub通知。
服务介绍
GitHub 通知 MCP 服务器
一个提供工具来管理 GitHub 通知的 MCP(Model Context Protocol)服务器。此服务器允许像 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 -
安装依赖项
npm install -
构建项目
npm run build -
创建一个包含您的 GitHub 令牌的
.env文件GITHUB_TOKEN=your_github_personal_access_token_here
使用
直接运行服务器
npm start
与 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 |
管理仓库订阅:所有活动、默认(参与和 @提及)或忽略(静音) |
示例提示
以下是一些在连接服务器后可以与 Claude Desktop 一起使用的示例提示:
- "你能检查我的 GitHub 通知吗?"
- "显示我过去 24 小时内的未读通知。"
- "将我所有的通知标记为已读。"
- "你能告诉我关于通知线程 12345 的信息吗?"
- "取消我对线程 12345 的订阅。"
- "我在 octocat/Hello-World 仓库中有哪些通知?"
- "将来自 octocat/Hello-World 仓库的所有通知标记为已读。"
- "关注 octocat/Hello-World 仓库的所有活动。"
- "将 octocat/Hello-World 仓库设置为默认设置(参与和 @提及)。"
- "检查我在 octocat/Hello-World 仓库中的通知设置。"
- "静音来自 octocat/Hello-World 仓库的所有通知。"
开发
URL 处理
这台服务器会自动将 GitHub API URL 转换为其对应的网页 UI URL。例如:
- API URL:
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
构建
npm run build
测试
运行自动化测试:
npm test
手动测试 URL 转换:
npm run test:url
许可证
MIT