MCP Client Manager
A client manager for the Model Context Protocol (MCP) that provides a simple way to manage multiple MCP clients connected to different servers.
接入你的智能体
發布者自己的指令。不是 PlugMCP 端點。
用我們的金鑰與日誌託管一份副本。
npx -y @automatalabs/[email protected]Claude Code 沒有本機指令的安裝連結。複製下方指令並在終端機中執行。
claude mcp add automatalabs-mcp-client-manager -- npx -y @automatalabs/mcp-client-manager@1.0.5在終端機中執行。
{ "mcpServers": { "automatalabs-mcp-client-manager": { "command": "npx", "args": [ "-y", "@automatalabs/[email protected]" ] } }}claude_desktop_config.json
遠端 URL 還是本機指令? 兩種安裝方式的差異
來自發布者
A client manager for the Model Context Protocol (MCP) that provides a simple way to manage multiple MCP clients connected to different servers.
A client manager for the Model Context Protocol (MCP) that handles multiple connections and provides a simple unified API
npm install @modelcontextprotocol/client-manager
import { MCPClientManager } from '@modelcontextprotocol/client-manager';
import { WebSocketTransport } from '@modelcontextprotocol/sdk/client/websocket.js';
// Create a manager with auto-reconnect enabled
const manager = new MCPClientManager({
autoReconnect: true,
defaultTimeout: 10000
});
// Connect to a server
const transport = new WebSocketTransport('ws://localhost:3000');
const clientId = await manager.addServer(transport, 'local-server');
// List available tools from all connected servers
const tools = await manager.listTools();
console.log('Available tools:', tools);
// Call a tool on any server that provides it
const result = await manager.callTool('my-tool', { param: 'value' });
console.log('Tool result:', result);
// Connect to multiple servers
const server1Id = await manager.addServer(
new WebSocketTransport('ws://server1:3000'),
'server-1'
);
const server2Id = await manager.addServer(
new WebSocketTransport('ws://server2:3000'),
'server-2'
);
// You can work with specific servers using their IDs
const server1Tools = await manager.getClient(server1Id).listTools();
// Or use the unified API to work with all servers
const allTools = await manager.listTools();
// Listen for connection errors
manager.on('connectionError', ({ serverName, error }) => {
console.error(`Failed to connect to ${serverName}:`, error);
});
// Listen for transport closures
manager.on('transportClosed', ({ clientId, serverName }) => {
console.warn(`Connection to ${serverName} closed`);
});
// Listen for operation errors
manager.on('operationError', ({ operation, clientId, serverName, error }) => {
console.error(`Error during ${operation} on ${serverName}:`, error);
});
The MCPClientManager constructor accepts a configuration object with these options:
constructor(config: Partial<MCPClientManagerConfig> = {})
Creates a new MCPClientManager instance with the given configuration.
async addServer(transport: ClientTransport, serverName: string, clientConfig?: Partial<ClientConfig>): Promise<ClientIdentifier>async reconnectClient(clientId: ClientIdentifier): Promise<boolean>removeClient(id: ClientIdentifier): booleanisClientHealthy(clientId: ClientIdentifier): booleanlistServerNames(): string[]hasServer(serverName: string): booleangetClientInfo(id: ClientIdentifier): Omit<ClientInfo, 'client'> | undefinedgetClientIdByServerName(serverName: string): ClientIdentifier | undefinedlistClientIds(): ClientIdentifier[]async listPrompts(timeout?: number): Promise<unknown[]>async getPrompt(promptName: string, args?: PromptParams, timeout?: number): Promise<unknown>async listResources(timeout?: number): Promise<unknown[]>async readResource(resourceUri: string, timeout?: number): Promise<unknown>async listTools(timeout?: number): Promise<unknown[]>async callTool(toolName: string, args?: Record<string, unknown>, timeout?: number): Promise<ToolResponse>serverAdded: Emitted when a server is successfully addedconnectionError: Emitted when there's an error connecting to a servertransportError: Emitted when there's an error with a transporttransportClosed: Emitted when a transport is closedclientReconnected: Emitted when a client is successfully reconnectedreconnectionError: Emitted when there's an error reconnecting a clientcloseError: Emitted when there's an error closing a transportclientRemoved: Emitted when a client is removedoperationError: Emitted when there's an error during an operationMIT
A client manager for the Model Context Protocol (MCP) that handles multiple connections and provides a simple unified API
{ "mcpServers": { "automatalabs-mcp-client-manager": { "command": "npx", "args": [ "-y", "@automatalabs/[email protected]" ] } }}工具
尚無工具清單。遠端伺服器會在首次健康檢查後取得工具清單。
常見問題
在本頁複製適用於 Cursor、Claude Desktop、Claude Code 或 VS Code 的 stdio 設定。它使用發布者的安裝方式,而不是 PlugMCP 代理伺服器。
這筆記錄未列出必要的環境變數。
@automatalabs/mcp Client Manager 透過 stdio 在本機執行。
上次檢查時間:2026-11-16。 A client manager for the Model Context Protocol (MCP) that handles multiple connections and provides a simple unified API