Problem Solved: Traditional MCP implementations expose all tools directly, consuming 40-80% of the context window before any actual work begins. The hierarchical router reduces this to <1% while maintaining full functionality.
The Context Window Problem
Traditional MCP Architecture
When MCP clients connect to servers with many tools, the context window gets consumed by tool definitions:- Claude Code: 82,000 tokens consumed by MCP tools (41% of context)
- Industry consensus: 20-40 tools before performance degrades
- Cursor hard limit: 40 tools maximum
- Critical failures: 80+ tools cause suboptimal responses
Root Cause
MCP clients calltools/list to discover available tools, and servers respond with complete tool definitions including:
- Tool name
- Description (often 100+ characters)
- Input schema (JSON Schema objects)
- Parameter descriptions
- Examples and constraints
The Hierarchical Router Solution
Architecture Overview
Instead of exposing all tools directly, the satellite exposes only 2 meta-tools:Token Reduction
Before (Traditional):- 150 tools × 500 tokens = 75,000 tokens
- 37.5% of 200k context consumed
- 2 tools × 686 tokens = 1372 tokens consumed
- Result: 0.686% of context window used
- Token Reduction: 98.3%
Meta-Tool Specifications
Tool 1: discover_mcp_tools
Purpose: Search for available tools across all connected MCP servers using natural language queries. Definition:- Uses Fuse.js for fuzzy full-text search
- Searches across tool names, descriptions, and server names
- Returns results ranked by relevance score
- Search time: 2-5ms for 100+ tools
- Queries UnifiedToolDiscoveryManager for tool cache
Tool 2: execute_mcp_tool
Purpose: Execute a discovered tool by its path returned fromdiscover_mcp_tools.
Definition:
- Parses
tool_pathfrom external format (server:tool) to internal format (server-tool) - Looks up tool in unified cache to determine transport type
- Routes to appropriate handler (stdio or HTTP/SSE)
- Returns result in MCP content format
Complete User Flow
Step 1: Client Connects
Step 2: Client Discovers Available Tools
Step 3: User Asks for GitHub Tools
The AI agent (Claude) decides it needs GitHub tools:Step 4: User Executes Discovered Tool
The AI agent decides to usegithub:create_issue:
Format Conversion
The satellite converts between user-facing format (serverName:toolName) and internal routing format (serverName-toolName) transparently during tool discovery and execution.
See Tool Discovery - Namespacing Strategy for complete details on naming conventions and format conversion logic.
Search Implementation
Fuse.js Configuration
Search Performance
- Index Build: On-demand per search (no stale cache)
- Search Time: 2-5ms for 100+ tools
- Memory: Zero duplication (queries UnifiedToolDiscoveryManager directly)
- Accuracy: Handles typos, partial matches, fuzzy matching
Single Source of Truth
ToolSearchService queries UnifiedToolDiscoveryManager.getAllTools() directly for every search:- Always up-to-date (no cache invalidation needed)
- No memory duplication
- Automatic reflection of tool changes
Why Tool Notifications Are Irrelevant
The Question
“Should we implement notifications/tools/list_changed when tools are added or removed?”
The Answer
NO. The MCP client only sees 2 static meta-tools that NEVER change:discover_mcp_tools✅ Always availableexecute_mcp_tool✅ Always available
- New MCP servers installed → Search index updates automatically
- MCP servers removed → Search index updates automatically
- Tools discovered from new servers → Search index updates automatically
- ✅ Backend sends configuration update to satellite
- ✅ Satellite spawns new MCP server process (if stdio)
- ✅ Tool discovery runs automatically
- ✅ Search index refreshed (next search uses new tools)
- ❌ Client is NOT notified (doesn’t need to be)
discover_mcp_tools, the new tools are automatically included in search results. No notification needed.
Performance Characteristics
Token Consumption
| Metric | Traditional | Hierarchical | Reduction |
|---|---|---|---|
| Tools Exposed | 150 | 2 | 98.7% |
| Tokens Consumed | 75,000 | 1372 | 98.2% |
| Context Available | 62.5% | 99.3% | +36.8% |
Search Performance
- Discovery Latency: 2-5ms (including Fuse.js index build)
- Execution Latency: <1ms (routing overhead only)
- Memory Overhead: ~1KB per cached tool
- Scalability: No degradation up to 500+ tools
Real-World Impact
Claude Code Example:- Before: 82,000 tokens (41%) consumed by MCP tools
- After: 1372 tokens (0.686%) consumed by meta-tools
- Result: 80,628 tokens freed for actual work
Implementation Status
Status: ✅ Fully OperationalBoth meta-tools are implemented and production-ready:
discover_mcp_tools: Full-text search with Fuse.jsexecute_mcp_tool: Complete routing for stdio and HTTP/SSE transports
Code Locations
Core Implementation:/services/satellite/src/core/mcp-server-wrapper.ts- Meta-tool handlers/services/satellite/src/services/tool-search-service.ts- Search implementation/services/satellite/src/services/unified-tool-discovery-manager.ts- Tool cache
setupMcpServer()- Registers 2 meta-tools instead of all toolshandleDiscoverTools()- Implements discovery logichandleExecuteTool()- Implements execution routing
Benefits Summary
For Users:- 95%+ more context available for actual work
- Natural language tool discovery
- No performance degradation with many tools
- Transparent - works like any MCP server
- Simple 2-tool interface
- Automatic tool discovery
- No client modifications needed
- Standard MCP protocol compliance
- Scales to hundreds of tools
- No memory explosion
- Fast search performance
- Easy to monitor and debug
Status-Based Tool Filtering
The hierarchical router integrates with status tracking to hide tools from unavailable servers and provide clear error messages when unavailable tools are executed. See Status Tracking - Tool Filtering for complete filtering logic, execution blocking rules, and status values.Related Documentation
- Tool Discovery Implementation - Internal tool caching and discovery
- Status Tracking - Tool filtering by server status
- Recovery System - How offline servers auto-recover
- MCP Transport Protocols - How clients connect
- Process Management - stdio server lifecycle
- Architecture Overview - Complete satellite design

