Map of server names to their configurations
Optionaloptions: CreateServerRegistryOptions
Options for registry creation
Options for creating a server registry.
Optionalcwd?: stringWorking directory for spawned processes (default: process.cwd())
Optionaldialects?: Dialect[]Dialects controlling which servers to spawn.
Optionalenv?: Record<string, string>Base environment for all servers. If provided, process.env is NOT included (caller has full control). If omitted, process.env is used as the base (default behavior).
ServerRegistry instance with config, server map, connect method, and close function
// Fast server start (does NOT wait for readiness)
const registry = createServerRegistry({
'echo': { command: 'node', args: ['server.ts'] },
});
// Connect when needed (waits for MCP handshake)
const client = await registry.connect('echo');
// Cleanup (closes all clients AND processes)
await registry.close();
Create a registry of MCP servers from configuration.
Fast start: Returns immediately after processes are created. Use
registry.connect()for lazy MCP connection.