MantisBT MCP服务器
一种模型上下文协议(MCP)服务器,用于通过其REST API访问MantisBT对象。使用TypeScript、FastMCP、Axios和Zod构建,用于健壮、类型安全的开发。
特性
此MCP服务器通过以下功能提供与MantisBT交互的工具:
问题
getIssue-按ID获取问题getIssues-获取分页问题列表createIssue-创建新问题
项目
getProject-按ID获取项目getProjects-获取所有项目
用户
getCurrentUser-获取当前经过身份验证的用户
出立票据
createIssueNote-为问题创建注释
设置
- 再进行
npm install- 配置环境
复制 .env 并更新您的MantisBT实例详细信息:
API_URL=https://your-mantisbt-instance.com
API_TOKEN=your-api-token-here- 构建项目
npm run build- 运行服务器
npm run dev项目结构
src/
controllers/ # Entity classes (Issues, Projects, Users, etc.)
tools/ # MCP tool definitions
types/ # Zod schemas and TypeScript types
config/ # Configuration utilities
main.ts # Server entry point发展
- TypeScript:全程打字强烈
- 萨德:API请求/响应的运行时验证
- 阿西奥斯:用于REST API调用的HTTP客户端
- FastMCP:MCP服务器框架
- 错误处理:所有控制器的一致错误处理
API集成
服务器使用MantisBT REST API,其中:
- 通过以下方式进行承载令牌身份验证
Authorization头球 - 用于请求/响应验证的Zod模式
- 正确的错误处理和用户友好的错误消息
- 类型安全API响应
可用脚本
npm run dev-启动开发服务器npm run build-将TypeScript构建为JavaScriptnpm run test-运行测试(实施时)npm run lint-运行ESLint
许可证
麻省理工学院
