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:
CHAIN_RESULT
placeholderinputPath
and outputPath
parametersThis server implements the following MCP tools:
mcp_chain
- Chain together multiple MCP serverschainable_tools
- Discover tools from all MCP servers so the mcp_chain tool can be useddiscover_tools
- Rediscover tools from all MCP servers# 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
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
:
{
"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": {}
}
}
}
Replace /path/to/mcp-tool-chainer
with the actual path to your repository.
// 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}"
}
]
});
MCP Tool Chainer now 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.
# Install dependencies
npm install
# Start the server
node dist/index.js config.json
# List available tools
node dist/index.js config.json discover_tools
This MCP server is licensed under the MIT License.
Created by Third Strand Studio
{
"mcpServers": {
"mcp_tool_chainer": {
"env": {},
"args": [
"-y",
"@thirdstrandstudio/mcp-tool-chainer",
"`claude_desktop_config.json` or `mcp.json`"
],
"command": "npx"
}
}
}
Seamless access to top MCP servers powering the future of AI integration.