MCP 工具链
一个 MCP(模型上下文协议)服务器,用于链接调用其他 MCP 工具,通过允许顺序执行工具并传递结果来减少令牌使用量。旨在解决https://github.com/modelcontextprotocol/specification/issues/215问题
类似 JSON 路径的 Step 函数:
特征
- 按顺序将多个 MCP 工具链接在一起
- 使用
CHAIN_RESULT
占位符将一个工具的结果作为输入传递给另一个工具 - 使用带有
inputPath
和outputPath
参数的 JsonPath 过滤和提取特定数据 - 从已配置的 MCP 服务器自动发现工具
- 与单个工具调用相比,令牌使用量最少
工具
该服务器实现了以下 MCP 工具:
mcp_chain
- 将多个 MCP 服务器链接在一起chainable_tools
- 从所有 MCP 服务器中发现工具,以便可以使用 mcp_chain 工具discover_tools
- 从所有 MCP 服务器重新发现工具
安装
先决条件
- Node.js(v16 或更高版本)
- npm
从 npm 安装
从源代码安装
与 Claude Desktop、Cursor 等一起使用
确保它是最后一个运行的 MCP,否则它将不得不再次运行 DISCOVERY
将以下内容添加到您的claude_desktop_config.json
或mcp.json
中:
如果从 npm 全局安装
如果从源安装
将/path/to/mcp-tool-chainer
替换为您的存储库的实际路径。
示例
链式浏览器和 XPath 工具
将 JsonPath 与 InputPath 和 OutputPath 结合使用
JsonPath 支持
MCP Tool Chainer 现在支持 AWS Step Functions 风格的 InputPath 和 OutputPath 功能:
- inputPath :JsonPath 表达式,用于在传递给工具之前提取输入的特定部分
- outputPath :JsonPath 表达式,用于在传递给下一个工具之前提取输出的特定部分
这些功能仅当输入/输出为有效的 JSON 时才有效。如果 JsonPath 提取失败,则使用原始输入/输出。
有关 JsonPath 语法参考,请参阅JsonPath 语法。
好处
- 减少令牌使用:通过将工具链接在一起,可以避免将大量中间结果发送回 LLM
- 简化的工作流程:通过单个工具调用创建复杂的数据处理管道
- 提高性能:通过最小化 LLM 和工具之间的往返来减少延迟
- 精确的数据流控制:使用 JsonPath 表达式仅提取所需的数据
发展
执照
此 MCP 服务器根据 MIT 许可证获得许可。
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
MCP(模型上下文协议)服务器,可链接调用其他 MCP 工具,通过允许顺序执行工具并传递结果来减少令牌的使用
Related MCP Servers
- -securityAlicense-qualityMCP Server simplifies the implementation of the Model Context Protocol by providing a user-friendly API to create custom tools and manage server workflows efficiently.Last updated -43TypeScriptMIT License
- -securityAlicense-qualityMCP Server provides a simpler API to interact with the Model Context Protocol by allowing users to define custom tools and services to streamline workflows and processes.Last updated -132TypeScriptMIT License
- AsecurityFlicenseAqualityA Model Context Protocol (MCP) server that provides a simple sleep/wait tool, useful for adding delays between operations such as waiting between API calls or testing eventually consistent systems.Last updated -167JavaScript
- AsecurityAlicenseAqualityA dynamic service that creates and manages Model Context Protocol (MCP) servers, allowing users to spawn, customize, and control multiple MCP servers as child processes.Last updated -565TypeScriptMIT License