TM

thirdstrandstudio/mcp-tool-chainer

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

57 stars 10 forks 质量 66 趋势 13MIT

一个MCP(模型上下文协议)服务器,将调用链链连接到其他MCP工具,通过允许顺序执行工具并传递结果,减少令牌使用。设计用于解决https://github.

概览

一个MCP(模型上下文协议)服务器,将调用链链连接到其他MCP工具,通过允许顺序执行工具并传递结果,减少令牌使用。设计用于解决https://github.com/modelcontextprotocol/specification/issues/215 - 将多个MCP工具按顺序串联 - 使用占位符将一个工具的结果作为输入传递给另一个工具CHAIN_RESULT - 使用JsonPath过滤和提取特定数据,输入路径和输出路径参数 - 从配置好的MCP服务器自动发现工具 - 与单个工具调用相比,令牌使用最小 该服务器实现了以下MCP工具: 1. mcp_chain - 将多个MCP服务器串联起来 2.chainable_tools - 从所有MCP服务器中发现工具,以便使用mcp_chain工具 3.discover_tools - 重新发现所有MCP服务器的工具 确保它是最后一个运行的MCP,否则它将不得不重新运行发现 请将以下内容添加到您的claude_desktop_config.json或MCP。

概述(AI 翻译)

一个MCP(模型上下文协议)服务器,将调用链链连接到其他MCP工具,通过允许工具顺序执行并传递结果,减少令牌使用。 设计用来解决https://github.com/modelcontextprotocol/specification/issues/215

步骤函数,比如 JSON 路径:

特色

  • 将多个MCP工具按顺序串联
  • 通过 CHAIN_RESULT 占位符将一个工具的结果作为输入传递给另一个工具
  • 使用带有inputPath和outputPath参数的JsonPath过滤和提取特定数据
  • 从配置好的MCP服务器自动发现工具
  • 与单个工具调用相比,令牌使用量极低

工具

该服务器实现了以下MCP工具:

  1. mcp_chain - 将多个MCP服务器串联起来
  2. chainable_tools - 从所有MCP服务器中发现工具,以便使用mcp_chain工具
  3. discover_tools - 重新发现所有MCP服务器的工具

安装

先决条件

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

从 npm 安装

从源头安装

使用 Claude 桌面、光标等

确保它是最后一个运行的MCP,否则它将不得不重新运行发现

在你的“claude_desktop_config上添加以下内容。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCP Tool Chainer

An MCP (Model Context Protocol) server that chains calls to other MCP tools, reducing token usage by allowing sequential tool execution with result passing. Designed to solve https://github.com/modelcontextprotocol/specification/issues/215

Step function like JSON paths:

Features

  • Chain multiple MCP tools together in sequence
  • Pass results from one tool as input to another tool using CHAIN_RESULT placeholder
  • Filter and extract specific data using JsonPath with inputPath and outputPath parameters
  • Automatic tool discovery from configured MCP servers
  • Minimal token usage compared to individual tool calls

Tools

This server implements the following MCP tools:

  1. mcp_chain - Chain together multiple MCP servers
  2. chainable_tools - Discover tools from all MCP servers so the mcp_chain tool can be used
  3. discover_tools - Rediscover tools from all MCP servers

Installation

Prerequisites

  • Node.js (v16 or later)
  • npm

Installing from npm

# Install
npm install @thirdstrandstudio/mcp-tool-chainer

# Or use with npx directly
npx -y @thirdstrandstudio/mcp-tool-chainer

Installing from source

# Clone the repository
git clone https://github.com/thirdstrandstudio/mcp-tool-chainer.git
cd mcp-tool-chainer

# Install dependencies
npm install

# Build the package
npm run build

Usage with Claude Desktop, Cursor etc

ENSURE IT IS THE LAST MCP TO RUN OTHERWISE IT WILL HAVE TO RUN DISCOVERY AGAIN

Add the following to your claude_desktop_config.json or mcp.json:

If installed from npm globally

{
  "mcpServers": {
    "mcp_tool_chainer": {
      "command": "npx",
      "args": ["-y", "@thirdstrandstudio/mcp-tool-chainer", "`claude_desktop_config.json` or `mcp.json`"],
      "env": {}
    }
  }
}

If installed from source

{
  "mcpServers": {
    "mcp_tool_chainer": {
      "command": "node",
      "args": ["/path/to/mcp-tool-chainer/dist/index.js", "`claude_desktop_config.json` or `mcp.json`"],
      "env": {}
    }
  }
}

Replace /path/to/mcp-tool-chainer with the actual path to your repository.

Examples

Chain Browser and XPath Tools

// Fetch a webpage and then extract specific content with XPath
const result = await callTool("mcp_chain", { 
  "mcpPath": [
    {
      "toolName": "mcp_browser_mcp_fetch_url",
      "toolArgs": "{\"url\": \"https://example.com\"}"
    },
    {
      "toolName": "mcp_xpath_xpath",
在 GitHub 查看完整 README

安装

npx -y @thirdstrandstudio/mcp-tool-chainer `claude_desktop_config.json` or `mcp.json`
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "mcp_tool_chainer": { "command": "npx", "args": ["-y", "@thirdstrandstudio/mcp-tool-chainer", "`claude_desktop_config.json` or `mcp.json`"], "env": {} } } }