@unified-llm/core
Version:
Unified LLM interface (in-memory).
42 lines • 1.83 kB
TypeScript
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import type { MCPServerConfig, McpTool } from "../../types/index.js";
export type SetupMcpClientsAndToolsOptions = {
mcpServers?: MCPServerConfig[];
clientName?: string;
clientVersion?: string;
};
export type SetupMcpClientsAndToolsResult = {
/**
* 接続済みMCPクライアント。呼び出し側で必ずcloseしてください(finally推奨)。
* Connected MCP clients; callers must close them (finally recommended).
*/
mcpClients: Client[];
/**
* MCPから取得した tool 定義(中立形)。provider側でOpenAI/Anthropic/Google形式に変換する。
* Tool definitions fetched from MCP (neutral shape), converted by providers to OpenAI/Anthropic/Google formats.
*/
mcpTools: McpTool[];
/**
* tool名 -> そのtoolを提供するMCPクライアント
* tool name -> MCP client that provides the tool
*/
toolNameToClient: Map<string, Client>;
/**
* tool名 -> そのtoolを許可したサーバー設定(デバッグ用途)
* tool name -> server config that allowed the tool (debugging)
*/
toolNameToServer: Map<string, MCPServerConfig>;
};
/**
* MCP クライアントを接続し、MCPの tools を収集する(プロバイダー非依存)。
* Connect MCP clients and collect MCP tools (provider-agnostic).
*
* - allowedTools によるフィルタ
* - Filter by allowedTools
* - tool名の衝突検出(複数サーバー間)
* - Detect tool name collisions across servers
* - 失敗時のクリーンアップ
* - Cleanup on failure
*/
export declare function setupMcpClientsAndTools(options: SetupMcpClientsAndToolsOptions): Promise<SetupMcpClientsAndToolsResult>;
//# sourceMappingURL=setup-mcp-tools.d.ts.map