mcp-recursive-delegate-server
A TypeScript-based intermediary MCP service facilitating remote execution by invoking other MCP clients. This design allows for sophisticated task offloading and context management across nested layers. It natively supports concurrent processing and map-reduce patterns.
Author

tanevanwifferen
Quick Info
Actions
Tags
Configuration Notice
This implementation requires initial setup; contributions to simplify the configuration process are welcomed via PRs.
MCP Inception Service
This utility enables an executing MCP client to invoke and manage another MCP client instance, effectively creating a nested agent architecture. Key benefits include delegating complex operations and mitigating constraints on the primary context window.
This service is built upon TypeScript and functions as a hybrid MCP server/client.
- Integrates functionality derived from mcp-client-cli.
- Provides mechanisms for context window offloading.
- Facilitates task delegation to subordinate agents.
- Features built-in capabilities for parallel and map-reduce task execution.
Functional Tools
Tool Set
execute_mcp_client: Sends a direct query to an external LLM system, completely bypassing the reporting of intermediate reasoning steps, and returns only the final answer.- Parameter:
question(Required). - Output: The final result, stripping all contextual overhead.
execute_parallel_mcp_client: Manages the concurrent execution of a primary prompt across a collection of input strings. For example, retrieving the current time for six distinct global locations (e.g., London, Paris, Tokyo).- Parameter:
mainPrompt(The instruction to execute for each item). - Parameter:
inputs(An array of strings, one for each parallel execution). - Operates concurrently on each input item.
- Note: Dependency on this specific PR is required for this functionality.
execute_map_reduce_mcp_client: Executes a process across multiple items concurrently (Map phase), followed by a sequential consolidation of the results into a singular output (Reduce phase).- Parameter:
mapPrompt(Template using{item}for per-item processing). - Parameter:
reducePrompt(Template using{accumulator}and{result}for aggregation). - Parameter:
items(The collection of data to process). - Optional Parameter:
initialValue(Starting point for the accumulator). - Workflow: Parallel mapping, followed by sequential reduction.
- Use Case Example: Analyzing several documents and generating a unified summary of key findings.
Implementation Details
Prerequisites
- Install
mcp-client-cli. - Ensure the associated configuration file (
~/.llm/config.json) is set up with necessary MCP endpoint definitions. - Create a shell script to manage environment activation and execution of the
llmbinary:
#!/bin/bash
source ./venv/bin/activate
llm --no-confirmations
Installation Steps
Install Node package dependencies:
npm install
Build the production server artifact:
npm run build
For active development with automatic recompilation:
npm run watch
Deployment
To integrate this service with the Claude Desktop environment, update your configuration file:
MacOS Location: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows Location: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"mcp-inception": {
"command": "node",
"args": ["~/Documents/Cline/MCP/mcp-inception/build/index.js"], // Path to the compiled output
"disabled": false,
"autoApprove": [],
"env": {
"MCP_INCEPTION_EXECUTABLE": "./run_llm.sh", // Reference to the startup script above
"MCP_INCEPTION_WORKING_DIR": "/path/to/mcp-client-cli/workspace"
}
}
}
}
Diagnostic Assistance
Debugging inter-process communication via stdio can be complex. We recommend utilizing the official MCP Inspector, accessible via a package script:
npm run inspector
This command will launch the Inspector, providing a local URL to a browser interface for inspecting communication streams.
