Principle:1mcp app Agent Server Manager Facade
| Knowledge Sources | |
|---|---|
| Domains | Software_Architecture, MCP_Protocol |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
Pattern that coordinates multiple specialized server management components (connections, templates, lifecycle, configuration) behind a single facade with capability routing and instruction aggregation.
Description
The Server Manager Facade provides a unified interface to a set of subsystems that would otherwise have complex interdependencies. It delegates to a ConnectionManager for transport lifecycle, a TemplateServerManager for per-client template instantiation, an MCPServerLifecycleManager for start/stop/restart operations, and a TemplateConfigurationManager for configuration reprocessing. Clients interact only with the facade, which routes requests to the correct subsystem and coordinates cross-cutting concerns like capability aggregation, instruction rendering, and schema boundary initialization.
Usage
Use this principle when:
- Multiple subsystems need coordinated access to shared server state
- Capability routing must aggregate tools, resources, and prompts from all connected backends
- Template servers require per-client instantiation with context-aware configuration
- Hot-reload operations need a single entry point for adding, removing, and modifying servers
Theoretical Basis
The facade exposes a simplified interface over a set of collaborators:
// Abstract structure (NOT real implementation)
class ServerManager {
private connectionManager: ConnectionManager;
private templateServerManager: TemplateServerManager;
private lifecycleManager: MCPServerLifecycleManager;
// Facade delegates to subsystems
loadMcpServer(name, config) { /* delegates to lifecycle + loading pipeline */ }
unloadMcpServer(name) { /* delegates to lifecycle + connection cleanup */ }
getCapabilities() { /* delegates to connectionManager */ }
}
Practical Guide
- Use the facade as a singleton via `getOrCreateInstance` to ensure consistent state
- Register cleanup callbacks for owned subprocess settlement before shutdown
- Delegate capability routing through the connection manager's outbound connections
- Wire instruction aggregation and lazy loading orchestrators after construction
- Synchronize MCP server lifecycle from connected clients after sync-mode startup