mcp-gitweekly-report
v1.0.8
Published
GitLab 周报生成器 MCP 服务
Downloads
30
Maintainers
Readme
GitLab 周报生成器 MCP 服务
这是一个 Model Context Protocol (MCP) 服务,可以帮助你自动生成 GitLab 提交记录的周报。
功能
- 连接到 GitLab 实例
- 获取指定日期范围内的提交记录
- 自动生成周报内容
- 支持与各种 AI 工具集成
安装
npm install -g mcp-gitweekly-report使用方法
作为命令行工具
mcp-gitweekly-report在 Claude Desktop 中配置
- 打开 Claude Desktop 设置
- 添加新的 MCP 服务器
- 配置如下:
{
"mcpServers": {
"gitlab-report": {
"command": "npx",
"args": ["-y", "mcp-gitweekly-report"]
}
}
}在 VS Code GitHub Copilot 中配置
在 VS Code 的 settings.json 中添加:
"github.copilot.chat.mcpServers": {
"gitlab-report": {
"command": "npx",
"args": ["-y", "mcp-gitweekly-report"]
}
}工具说明
generate-gitlab-report
生成 GitLab 提交记录的周报。
参数:
gitlabUrl: GitLab 实例的 URL,例如 https://gitlab.comaccessToken: GitLab 访问令牌startDate: (可选) 开始日期,格式为 YYYY-MM-DD,默认为当前日期往前推一周endDate: (可选) 结束日期,格式为 YYYY-MM-DD,默认为当前日期
预设配置
你可以通过命令行参数预设 GitLab URL 和访问令牌,这样用户就不需要每次都提供这些信息:
使用命令行参数
在 MCP 配置中通过 args 参数传递 GitLab URL 和访问令牌:
{
"mcpServers": {
"gitlab-report": {
"command": "npx",
"args": [
"mcp-gitweekly-report",
"--gitlabUrl=https://gitlab.com",
"--accessToken=your_access_token_here"
]
}
}
}在 Claude Desktop 中配置
- 打开 Claude Desktop 设置
- 添加新的 MCP 服务器
- 配置如上所示,包含命令行参数
- Trae CN等IDE集成MCP是一样的配置
在 VS Code GitHub Copilot 中配置
在 VS Code 的 settings.json 中添加:
"github.copilot.chat.mcpServers": {
"gitlab-report": {
"command": "npx",
"args": [
"mcp-gitweekly-report",
"--gitlabUrl=https://gitlab.com",
"--accessToken=your_access_token_here"
]
}
}使用方法
配置好命令行参数后,用户可以简化他们的提问,例如:
使用 generate-gitlab-report 工具生成我的 GitLab 周报,
从 2023-10-01 到 2023-10-07而不需要每次都提供 GitLab URL 和访问令牌。
如果你要生成最近一周的话,直接提问,生成周报即可不需要填写时间范围
本地开发配置示例
如果你是在本地开发环境中使用,配置示例:
{
"mcpServers": {
"gitlab-report": {
"command": "node",
"args": [
"d:\\test-周报生成器(第二版)(Augment)\\mcp-gitweekly-report\\index.js",
"--gitlabUrl=https://your-gitlab-instance.com",
"--accessToken=your_access_token_here"
],
"cwd": "d:\\test-周报生成器(第二版)(Augment)\\mcp-gitweekly-report"
}
}
}安全性注意事项
- 请勿在公共环境或共享设备上保存您的 GitLab 访问令牌
- 考虑使用有限权限的访问令牌,只授予读取权限
- 定期轮换您的访问令牌
- 配置文件中的访问令牌应妥善保管,避免泄露
测试连接
你可以使用提供的测试脚本来验证配置是否正确:
node test-connection.js <GitLab_URL> <Access_Token>例如:
node test-connection.js https://gitlab.com your_access_token_here测试脚本会:
- 验证与 GitLab 的连接
- 获取用户信息
- 列出用户的项目
- 获取最近一周的提交记录
- 生成示例周报
源代码
项目源代码托管在 Gitee: https://gitee.com/mrhaoxiaojun/gitweekly
许可证
MIT
