Tool Chainer MCP server

Chains multiple MCP tools together in sequence, passing results between tools without sending large intermediate data back to the LLM, reducing token usage for complex workflows.
Back to servers
Setup instructions
Provider
Third Strand Studio
Release date
Mar 22, 2025
Language
TypeScript
Package
Stats
1.0K downloads
46 stars

MCP Tool Chainer is a specialized server that implements the Model Context Protocol (MCP) standard, allowing you to chain multiple MCP tools together in sequence. This reduces token usage by enabling sequential tool execution with result passing between tools, making complex workflows more efficient.

Installation Options

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

Configuration

Add the MCP Tool Chainer to your Claude Desktop or other MCP-compatible applications. Important: Configure this as the LAST MCP server to run to avoid unnecessary tool rediscovery.

Configuration for npm installation

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

Configuration for source installation

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

Available Tools

The server implements these MCP tools:

  1. mcp_chain - Chain together multiple MCP servers
  2. chainable_tools - Discover tools from all MCP servers
  3. discover_tools - Rediscover tools from all MCP servers

Usage Examples

Chaining 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",
      "toolArgs": "{\"xml\": CHAIN_RESULT, \"query\": \"//h1\"}"
    }
  ]
});

Using JsonPath with InputPath and OutputPath

// Fetch a webpage, extract specific content with XPath, then extract part of the result
const result = await callTool("mcp_chain", { 
  "mcpPath": [
    {
      "toolName": "mcp_fetch_fetch",
      "toolArgs": "{\"url\": \"https://api.example.com/data\"}"
    },
    {
      "toolName": "web_search",
      "toolArgs": "{\"search_term\": CHAIN_RESULT}",
      "inputPath": "$.results[0].title",     // Extract only the first result's title from previous output
      "outputPath": "$.snippets[*].text"     // Extract only the text snippets from the search results
    },
    {
      "toolName": "another_tool",
      "toolArgs": "{\"content\": CHAIN_RESULT}"
    }
  ]
});

JsonPath Support

The tool supports AWS Step Functions-style InputPath and OutputPath features:

  • inputPath: JsonPath expression to extract specific portions of the input before passing to a tool
  • outputPath: JsonPath expression to extract specific portions of the output before passing to the next tool

These features work only when the input/output is valid JSON. If JsonPath extraction fails, the original input/output is used.

For JsonPath syntax reference, see JsonPath Syntax.

Key Benefits

  • Reduced Token Usage: Avoid sending large intermediate results back to the LLM
  • Simplified Workflows: Create complex data processing pipelines with a single tool call
  • Improved Performance: Reduce latency by minimizing round-trips between the LLM and tools
  • Precise Data Flow Control: Extract only the data you need with JsonPath expressions

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "mcp_tool_chainer" '{"command":"npx","args":["-y","@thirdstrandstudio/mcp-tool-chainer","mcp.json"],"env":[]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

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

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

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

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later