diff --git a/tools/server/webui/src/lib/components/app/index.ts b/tools/server/webui/src/lib/components/app/index.ts index 9d53544295..20a7918790 100644 --- a/tools/server/webui/src/lib/components/app/index.ts +++ b/tools/server/webui/src/lib/components/app/index.ts @@ -35,7 +35,6 @@ export { default as ChatSettingsFooter } from './chat/ChatSettings/ChatSettingsF export { default as ChatSettingsFields } from './chat/ChatSettings/ChatSettingsFields.svelte'; export { default as ChatSettingsImportExportTab } from './chat/ChatSettings/ChatSettingsImportExportTab.svelte'; export { default as ChatSettingsParameterSourceIndicator } from './chat/ChatSettings/ChatSettingsParameterSourceIndicator.svelte'; -export { default as McpSettingsSection } from './mcp/McpSettingsSection.svelte'; export { default as ChatSidebar } from './chat/ChatSidebar/ChatSidebar.svelte'; export { default as ChatSidebarConversationItem } from './chat/ChatSidebar/ChatSidebarConversationItem.svelte'; @@ -76,6 +75,7 @@ export { default as ModelsSelector } from './models/ModelsSelector.svelte'; // MCP export { default as McpSelector } from './mcp/McpSelector.svelte'; +export { default as McpSettingsSection } from './mcp/McpSettingsSection.svelte'; // Server diff --git a/tools/server/webui/src/lib/mcp/host-manager.ts b/tools/server/webui/src/lib/mcp/host-manager.ts index 84df0afd32..9fbf5f55b7 100644 --- a/tools/server/webui/src/lib/mcp/host-manager.ts +++ b/tools/server/webui/src/lib/mcp/host-manager.ts @@ -1,11 +1,24 @@ /** - * MCPHostManager - Agregator wielu połączeń MCP. + * MCPHostManager - Multi-server MCP connection aggregator * - * Zgodnie z architekturą MCP, Host: - * - Koordynuje wiele instancji Client (MCPServerConnection) - * - Agreguje tools/resources/prompts ze wszystkich serwerów - * - Routuje tool calls do odpowiedniego serwera - * - Zarządza lifecycle wszystkich połączeń + * Implements the "Host" role in MCP architecture, coordinating multiple server + * connections and providing a unified interface for tool operations. + * + * **Architecture & Relationships:** + * - **MCPHostManager** (this class): Host-level coordination layer + * - Coordinates multiple Client instances (MCPServerConnection) + * - Aggregates tools from all connected servers + * - Routes tool calls to the appropriate server + * - Manages lifecycle of all connections + * + * - **MCPServerConnection**: Individual server connection wrapper + * - **agenticStore**: Uses MCPHostManager for tool execution in agentic loops + * + * **Key Responsibilities:** + * - Parallel server initialization and shutdown + * - Tool name conflict detection and resolution + * - OpenAI-compatible tool definition generation + * - Automatic tool-to-server routing */ import { MCPServerConnection, type ToolExecutionResult } from './server-connection'; @@ -44,12 +57,7 @@ export interface ServerStatus { } /** - * MCPHostManager manages multiple MCP server connections. - * - * This corresponds to the "Host" role in MCP architecture: - * - Coordinates multiple Client instances (MCPServerConnection) - * - Aggregates tools from all connected servers - * - Routes tool calls to the appropriate server + * Manages multiple MCP server connections and provides unified tool access. */ export class MCPHostManager { private connections = new Map(); diff --git a/tools/server/webui/src/lib/mcp/server-connection.ts b/tools/server/webui/src/lib/mcp/server-connection.ts index 52337ba5f3..7070070136 100644 --- a/tools/server/webui/src/lib/mcp/server-connection.ts +++ b/tools/server/webui/src/lib/mcp/server-connection.ts @@ -1,10 +1,19 @@ /** - * MCPServerConnection - Wrapper na SDK Client dla pojedynczego serwera MCP. + * MCPServerConnection - Single MCP server connection wrapper * - * Zgodnie z architekturą MCP: - * - Jeden MCPServerConnection = jedno połączenie = jeden SDK Client - * - Izolacja między serwerami - każdy ma własny transport i capabilities - * - Własny lifecycle (connect, disconnect) + * Wraps the MCP SDK Client for a single server connection. Each instance represents + * one isolated connection with its own transport, capabilities, and lifecycle. + * + * **Architecture:** + * - One MCPServerConnection = one connection = one SDK Client + * - Server isolation - each has its own transport and capabilities + * - Independent lifecycle (connect, disconnect) + * + * **Key Responsibilities:** + * - Transport creation (WebSocket, StreamableHTTP, SSE) + * - Tool discovery and caching + * - Tool execution with abort support + * - Connection state management */ import { Client } from '@modelcontextprotocol/sdk/client'; @@ -55,8 +64,7 @@ export interface ToolExecutionResult { } /** - * Represents a single connection to an MCP server. - * Wraps the SDK Client and provides a clean interface for tool operations. + * Wraps the MCP SDK Client and provides a clean interface for tool operations. */ export class MCPServerConnection { private client: Client;