feat(community): add stdio MCP tools support#41
Open
Iamjesse0202 wants to merge 1 commit intoMagicCube:mainfrom
Open
feat(community): add stdio MCP tools support#41Iamjesse0202 wants to merge 1 commit intoMagicCube:mainfrom
Iamjesse0202 wants to merge 1 commit intoMagicCube:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
当前仓库中尚未支持 MCP(Model Context Protocol)工具接入。
本 PR 实现了一个最小可用范围:通过 stdio 连接 MCP Server,并将 MCP 工具映射为 Helixent 可调用的
Tool。关联 issue:#40
本次改动
1) 新增
community/mcp模块(stdio MCP)createStdioMcpTools,负责:StdioClientTransport+Client建立 MCP 连接listTools(支持分页)defineTool形式invoke时转发到 MCPcallTooldispose()用于关闭 transport / 释放资源namePrefix,用于避免与内置工具重名冲突2) 新增 MCP 参数 schema 与结果格式化能力
mcpInputSchemaToZodformatMcpCallToolResultcontent/structuredContent/toolResult等返回形态3) 扩展 Coding Agent 的工具注入能力
createCodingAgent中新增可选参数:extraTools?: Tool[]4) 依赖与导出
@modelcontextprotocol/sdksrc/community/mcp/index.ts对外导出 MCP 相关能力5) 测试
新增单测覆盖:
formatMcpCallToolResult的主要分支mcpInputSchemaToZod的成功转换与失败回退分支影响范围
src/community/mcp/*src/coding/agents/lead-agent.ts(新增extraTools参数)extraTools时与之前一致)验证
bun run check当前范围与后续
本 PR 仅实现 stdio + tools(list/call) 的 MCP 最小支持。
暂未纳入以下内容(可后续独立 PR):
Closes #40