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.
# Install
npm install @thirdstrandstudio/mcp-tool-chainer
# Or use with npx directly
npx -y @thirdstrandstudio/mcp-tool-chainer
# 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
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.
{
"mcpServers": {
"mcp_tool_chainer": {
"command": "npx",
"args": ["-y", "@thirdstrandstudio/mcp-tool-chainer", "`claude_desktop_config.json` or `mcp.json`"],
"env": {}
}
}
}
{
"mcpServers": {
"mcp_tool_chainer": {
"command": "node",
"args": ["/path/to/mcp-tool-chainer/dist/index.js", "`claude_desktop_config.json` or `mcp.json`"],
"env": {}
}
}
}
The server implements these MCP tools:
mcp_chain
- Chain together multiple MCP serverschainable_tools
- Discover tools from all MCP serversdiscover_tools
- Rediscover tools from all MCP servers// 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\"}"
}
]
});
// 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}"
}
]
});
The tool supports AWS Step Functions-style InputPath and OutputPath features:
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.
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.
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.
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": []
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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