Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:1mcp app Agent Server Manager Facade

From Leeroopedia
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

  1. Use the facade as a singleton via `getOrCreateInstance` to ensure consistent state
  2. Register cleanup callbacks for owned subprocess settlement before shutdown
  3. Delegate capability routing through the connection manager's outbound connections
  4. Wire instruction aggregation and lazy loading orchestrators after construction
  5. Synchronize MCP server lifecycle from connected clients after sync-mode startup

Related Pages

Implemented By

Uses Heuristics

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment