agent-tool-protocol 与mcp的集成

agent-tool-protocol 支持集成mcp 以及被mcp 集成,对于被mcp 的集成,实际上就是将agent-tool-protocol 的几个共同方法暴露给mcp

参考工具

getATPTools(): Tool[] {
    return [
      createSearchApiTool(this), // 搜索api
      createFetchAllApisTool(this), // 查看所有api
      createExecuteCodeTool(this),  // 通过代码模式执行工具
      createExploreApiTool(this),  // 类似文件系统模式的api查看
    ];
  }

注册

if (typeof mcpServer.registerTool === 'function') {
      const inputSchema = tool.zodSchema?.shape ?? {};
      mcpServer.registerTool(
        tool.name,
        {
          description: tool.description || '',
          inputSchema,
        },
        handler
      );
    } else if (typeof mcpServer.tool === 'function') {
      const jsonSchema = {
        type: tool.inputSchema.type,
        properties: tool.inputSchema.properties || {},
        required: tool.inputSchema.required || [],
      };
      mcpServer.tool(tool.name, tool.description || '', jsonSchema, handler);
    } 

说明

agent-tool-protocol 内部的核心就是提供了几个通用的api 进行api 以及mcp服务包装,然后通过代码生成的模式进行工具调用执行

参考资料

https://github.com/mondaycom/agent-tool-protocol

https://github.com/mondaycom/agent-tool-protocol/blob/master/packages/mcp-adapter/src/atp-to-mcp.ts

posted on 2026-06-01 08:00  荣锋亮  阅读(10)  评论(0)    收藏  举报

导航