这是一个针对 Redmine 的 Model Context Protocol (MCP) 服务器实现。它通过集成 Redmine 的 REST API 来提供工单和项目信息给大型语言模型 (LLMs)。
<a href="https://glama.ai/mcp/servers/55eg9u36cg"><img width="380" height="200" src="https://gips0.baidu.com/it/u=4124727228,2175163146&fm=3081&app=3081&f=PNG?w=760&h=400" alt="Redmine Server MCP 服务器" /></a>
支持来自 Redmine REST API 的稳定资源:
要与 Claude 一起使用此服务器,请按以下方式配置:
{
"mcp-server-redmine": {
"command": "npx",
"args": [
"-y",
"--prefix",
"/path/to/mcp-server-redmine",
"mcp-server-redmine"
],
"env": {
"REDMINE_HOST": "https://your-redmine.example.com",
"REDMINE_API_KEY": "your-api-key-here"
}
}
}
command: 执行 npm 包的命令args:
-y: 自动响应“是”到提示--prefix: 指定安装目录env: 环境变量
REDMINE_HOST: Redmine 服务器 URLREDMINE_API_KEY: 您的 Redmine API 密钥设置以下环境变量:
REDMINE_API_KEY: 从 Redmine 用户设置中获取的 API 密钥REDMINE_HOST: Redmine 服务器 URL(例如,https://redmine.example.com)# 运行测试
npm test
为了数据安全,测试仅包括 GET 操作。
使用 MCP Inspector 验证功能。
# 构建
npm run build
# 设置执行权限(重要)
chmod +x dist/index.js
# 启动 inspector
npx @modelcontextprotocol/inspector dist/index.js
这里是一些使用 CLI 模式测试 Redmine MCP 服务器的实际示例。
前提条件:
# 构建项目
npm run build
# 设置执行权限
chmod +x dist/index.js
# 设置环境变量
export REDMINE_API_KEY=your-api-key-here
export REDMINE_HOST=http://localhost:3000 # 或您的 Redmine 服务器 URL
基本测试命令:
列出可用工具:
npx @modelcontextprotocol/inspector --cli \
-e REDMINE_API_KEY=$REDMINE_API_KEY \
-e REDMINE_HOST=$REDMINE_HOST \
node dist/index.js \
--method tools/list
测试工单功能:
# 列出工单(带限制)
npx @modelcontextprotocol/inspector --cli \
-e REDMINE_API_KEY=$REDMINE_API_KEY \
-e REDMINE_HOST=$REDMINE_HOST \
node dist/index.js \
--method tools/call \
--tool-name list_issues \
--tool-arg limit=5
# 获取特定工单详情
npx @modelcontextprotocol/inspector --cli \
-e REDMINE_API_KEY=$REDMINE_API_KEY \
-e REDMINE_HOST=$REDMINE_HOST \
node dist/index.js \
--method tools/call \
--tool-name get_issue \
--tool-arg id=1
# 按项目过滤工单
npx @modelcontextprotocol/inspector --cli \
-e REDMINE_API_KEY=$REDMINE_API_KEY \
-e REDMINE_HOST=$REDMINE_HOST \
node dist/index.js \
--method tools/call \
--tool-name list_issues \
--tool-arg project_id=1 \
--tool-arg limit=3
测试项目功能:
# 列出所有项目
npx @modelcontextprotocol/inspector --cli \
-e REDMINE_API_KEY=$REDMINE_API_KEY \
-e REDMINE_HOST=$REDMINE_HOST \
node dist/index.js \
--method tools/call \
--tool-name list_projects
# 获取特定项目详情
npx @modelcontextprotocol/inspector --cli \
-e REDMINE_API_KEY=$REDMINE_API_KEY \
-e REDMINE_HOST=$REDMINE_HOST \
node dist/index.js \
--method tools/call \
--tool-name show_project \
--tool-arg id=1
测试用户功能(需要管理员权限):
# 列出用户
npx @modelcontextprotocol/inspector --cli \
-e REDMINE_API_KEY=$REDMINE_API_KEY \
-e REDMINE_HOST=$REDMINE_HOST \
node dist/index.js \
--method tools/call \
--tool-name list_users
# 获取特定用户详情
npx @modelcontextprotocol/inspector --cli \
-e REDMINE_API_KEY=$REDMINE_API_KEY \
-e REDMINE_HOST=$REDMINE_HOST \
node dist/index.js \
--method tools/call \
--tool-name show_user \
--tool-arg id=1
测试时间条目功能:
# 列出时间条目
npx @modelcontextprotocol/inspector --cli \
-e REDMINE_API_KEY=$REDMINE_API_KEY \
-e REDMINE_HOST=$REDMINE_HOST \
node dist/index.js \
--method tools/call \
--tool-name list_time_entries \
--tool-arg limit=5
# 获取特定时间条目详情
npx @modelcontextprotocol/inspector --cli \
-e REDMINE_API_KEY=$REDMINE_API_KEY \
-e REDMINE_HOST=$REDMINE_HOST \
node dist/index.js \
--method tools/call \
--tool-name show_time_entry \
--tool-arg id=1
高级测试:
# 按状态过滤工单
npx @modelcontextprotocol/inspector --cli \
-e REDMINE_API_KEY=$REDMINE_API_KEY \
-e REDMINE_HOST=$REDMINE_HOST \
node dist/index.js \
--method tools/call \
--tool-name list_issues \
--tool-arg status_id=1 \
--tool-arg limit=5
# 按关键词搜索工单
npx @modelcontextprotocol/inspector --cli \
-e REDMINE_API_KEY=$REDMINE_API_KEY \
-e REDMINE_HOST=$REDMINE_HOST \
node dist/index.js \
--method tools/call \
--tool-name list_issues \
--tool-arg subject="bug" \
--tool-arg limit=3
# 获取特定项目的工时条目
npx @modelcontextprotocol/inspector --cli \
-e REDMINE_API_KEY=$REDMINE_API_KEY \
-e REDMINE_HOST=$REDMINE_HOST \
node dist/index.js \
--method tools/call \
--tool-name list_time_entries \
--tool-arg project_id=1 \
--tool-arg limit=10
故障排除:
连接问题:验证您的 Redmine 服务器是否正在运行且可访问:
curl -H "X-Redmine-API-Key: $REDMINE_API_KEY" \
"$REDMINE_HOST/projects.json"
权限错误:某些操作需要管理员权限。检查您的 API 密钥权限在 Redmine 中。
环境变量:确保环境变量正确设置:
echo $REDMINE_API_KEY
echo $REDMINE_HOST
构建问题:确保项目已构建且权限已设置:
npm run build
chmod +x dist/index.js
ls -la dist/index.js
一些功能需要管理员权限:
list_users: 需要管理员create_user: 需要管理员update_user: 需要管理员delete_user: 需要管理员可用信息根据用户权限级别而异。详情参见 Redmine API 文档。
@modelcontextprotocol/sdk: MCP SDKzod: 模式验证typescript: 类型系统.
├── src/
│ ├── tools/ # 工具定义
│ │ ├── issues.ts
│ │ ├── projects.ts
│ │ ├── time_entries.ts
│ │ └── index.ts
│ ├── formatters/ # 格式化程序
│ │ ├── issues.ts
│ │ ├── projects.ts
│ │ ├── time_entries.ts
│ │ └── index.ts
│ ├── lib/ # 公共库
│ │ ├── client.ts # Redmine API 客户端
│ │ ├── config.ts # 配置管理
│ │ └── types.ts # 类型定义
│ ├── handlers.ts # 请求处理器
│ └── index.ts # 入口点
├── docs/
│ └── adr/ # 架构决策记录
├── package.json # 项目配置
├── tsconfig.json # TypeScript 配置
└── README.md # 文档
# 安装依赖
npm install
# 构建
npm run build
# 启动开发服务器
npm run dev
主要设计决策记录在 docs/adr 中。添加或修改功能时请参考这些文档。
MIT