ExMCP.ServerManager (ex_mcp v0.1.0)
View SourceManages multiple MCP server connections.
The ServerManager provides a centralized way to:
- Start and stop multiple MCP servers
- Route requests to appropriate servers
- Monitor server health
- Handle server lifecycle
Summary
Functions
Returns a specification to start this module under a supervisor.
Discovers and starts servers based on configuration.
Gets information about a specific server.
Lists all managed servers.
Routes a request to the appropriate server.
Starts the server manager.
Starts a new MCP server.
Stops a running MCP server.
Types
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec discover_and_start(GenServer.server()) :: {:ok, [String.t()]} | {:error, any()}
Discovers and starts servers based on configuration.
@spec get_server(GenServer.server(), String.t()) :: {:ok, map()} | {:error, :not_found}
Gets information about a specific server.
@spec list_servers(GenServer.server()) :: [ %{name: String.t(), pid: pid(), status: atom()} ]
Lists all managed servers.
@spec route_request(GenServer.server(), String.t(), any()) :: {:ok, any()} | {:error, any()}
Routes a request to the appropriate server.
Starts the server manager.
@spec start_server(GenServer.server(), server_spec()) :: {:ok, pid()} | {:error, any()}
Starts a new MCP server.
@spec stop_server(GenServer.server(), String.t()) :: :ok | {:error, :not_found}
Stops a running MCP server.