MCP Tool Chainer

MCP Tool Chainer

site icon
2025.04.02 26
JavaScript工具链工作流优化开发效率
MCP Tool Chainer 是一个基于 MCP(Model Context Protocol)的服务,旨在通过链式调用其他 MCP 工具来减少令牌使用。它允许顺序执行工具并传递结果,从而优化工作流程和性能。
View on GitHub

Overview

基本能力

产品定位

MCP Tool Chainer 是一个用于链式调用多个 MCP 工具的服务,旨在减少令牌使用并优化工作流程。

核心功能

  • 链式调用多个 MCP 工具
  • 通过 CHAIN_RESULT 占位符传递工具结果
  • 使用 JsonPath 过滤和提取特定数据
  • 自动从配置的 MCP 服务器发现工具
  • 相比单独调用工具,显著减少令牌使用

适用场景

  • 复杂数据处理的自动化流程
  • 需要多个工具协作的任务
  • 减少与 LLM 的交互次数以优化性能

工具列表

  1. mcp_chain - 链式调用多个 MCP 服务器
  2. chainable_tools - 从所有 MCP 服务器发现工具
  3. discover_tools - 重新发现所有 MCP 服务器的工具

常见问题解答

  • 如何确保工具链的正确执行顺序? 确保 MCP Tool Chainer 是最后一个运行的 MCP 工具,否则需要重新运行发现工具。
  • 如何处理 JSON 数据提取失败? 如果 JsonPath 提取失败,将使用原始输入/输出。

使用教程

使用依赖

  • Node.js (v16 或更高版本)
  • npm

安装教程

从 npm 安装

# 安装
npm install @thirdstrandstudio/mcp-tool-chainer

# 或直接使用 npx
npx -y @thirdstrandstudio/mcp-tool-chainer

从源代码安装

# 克隆仓库
git clone https://github.com/thirdstrandstudio/mcp-tool-chainer.git
cd mcp-tool-chainer

# 安装依赖
npm install

# 构建包
npm run build

调试方式

# 启动服务器
node dist/index.js config.json

# 列出可用工具
node dist/index.js config.json discover_tools

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。