MCP服务端
一个TypeScript实现的模型上下文协议,提供了用于JIRA工单创建和TODO管理的集成工具,允许用户通过自然语言接口管理任务。
服务介绍
MCP 服务器
基于 TypeScript 的 Model Context Protocol (MCP) 服务器实现,提供了与多种服务(如 JIRA 和 TODO 管理)集成的工具。
🚀 特性
- 多工具集成:支持多个工具集成的模块化架构
- 类型安全:完全支持 TypeScript 并使用 Zod 模式验证
- ESM 支持:现代 ES Modules 实现
- 可扩展性:易于添加新工具和集成
📦 当前工具
JIRA 集成
- 使用可自定义字段创建问题
- 自动响应格式化
- 问题创建时的模式验证
TODO 管理
- 创建带有优先级和截止日期的待办事项
- 支持可选字段的灵活模式
- 格式化的响应消息
🛠 项目结构
src/
├── config/ # Tool configurations
│ ├── jira-tool.config.ts
│ └── todo-tool.config.ts
├── constant/ # Constant definitions
│ └── tool-name.ts
├── schema/ # Zod schemas for validation
│ ├── jira.ts
│ └── todo.ts
├── server/ # Server management
│ └── mcp-server-tool-manager.ts
├── tools/ # Tool implementations
│ ├── jira/
│ │ └── create-issue.ts
│ └── todo/
│ └── create-todo.ts
└── index.ts # Main entry point
🔌 添加新工具
- 在
constant/tool-name.ts中定义工具常量 - 在
schema/目录中创建模式 - 在
tools/目录中实现工具处理器 - 在
config/目录中添加配置 - 在
index.ts中注册工具
示例:
// 1. Add constant
export const NEW_TOOL = {
ACTION: "action_name"
} as const;
// 2. Create schema
export const newToolSchema = z.object({
// ... schema definition
});
// 3. Implement handler
export const handleAction = async (
args: z.infer<typeof newToolSchema>,
extra: RequestHandlerExtra
): Promise<CallToolResult> => {
// ... implementation
};
// 4. Add configuration
export const newToolConfig = {
name: "New Tool",
version: "1.0.0",
tools: [
{
name: NEW_TOOL.ACTION,
schema: newToolSchema,
handler: handleAction,
},
],
};
🔄 开发工作流
- 创建功能分支
- 实现变更
- 运行测试(当实现后)
- 构建项目
- 提交 PR
📝 注意事项
- 使用 ES Modules 以获得更好的模块化
- 实现 Model Context Protocol 用于标准化通信
- 遵循 TypeScript 最佳实践
- 使用 Zod 模式验证确保类型安全
🛣️ 路线图
- 增加更多 JIRA 操作
- 实现 TODO 持久化
- 添加身份验证
- 添加测试框架
- 添加更多集成(GitHub、Slack 等)
📄 许可证
MIT