# TODO: Multi-Server Orchestration (Startup)
This document outlines the requirements for instantiating and managing multiple MCP servers automatically when the `robotics-webapp` backend starts.
## π Goal
Ensure all required specialized MCP servers (Robotics, VR, Unitree, etc.) are launched and healthy before the user begins an agentic session, reducing initial latency and tool discovery errors.
---
## π Startup Orchestration
- [ ] **Automated Initialization**:
- Modify the backend startup sequence to instantiate a cluster of MCP servers.
- Integration point: `robotics-webapp/backend/main.py` (or equivalent).
- [ ] **Reserved Port Range**:
- Use "out-of-the-way" ports to avoid conflicts with system services.
- **Target Range**: `13330` to `13350`.
- Implement a port allocator that assigns a unique port from this range to each server (e.g., `robotics: 13330`, `unity: 13331`).
## π οΈ Service Management
- [ ] **Process Lifecycle**:
- Use `Subprocess` or a process manager to launch servers.
- Implement "Zombie Protection": ensure servers are terminated when the main webapp shuts down.
- [ ] **Health Checks**:
- Implement a startup probe that waits for each server's `/health` endpoint (if HTTP) or `list_tools` (if stdio) before marking the system as ready.
- [ ] **Parallel Launch**:
- Use `asyncio.gather` to launch servers in parallel rather than sequentially to optimize startup time.
## π Frontend Integration
- [ ] **Launcher Service Update**:
- Update `appLauncherService.ts` to reflect the status of these pre-instantiated servers.
- Provide a "System Health" dashboard in the frontend showing the status of each orchestrator-assigned port.
---
## π Reference
See [AGENT_TO_AGENT_HANDOFF.md](file:///d:/Dev/repos/mcp-central-docs/docs/patterns/AGENT_TO_AGENT_HANDOFF.md) in the `mcp-central-docs` repository for architectural context on why these servers must be available for behavioral delegation.