@sverka/plugin-mcp 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/client.ts","../src/errors.ts","../src/index.ts"],"mappings":";;;;;;;qBAsBa,yBAAyB;mBACnB;EAEL,YAAA,kBAAkB;EAMxB,aAAa,iBAAiB;EAkB9B,SACJ,cACA,OAAO,SAAS,2BACf,QAAQ;EAgCL,WAAW;UAcH;;;;KChGJ;qBAMC,uBAAuB;WAChB;EAEN,YAAA,iBAAiB,MAAM,oBAAoB;WAO9C,MAAM;;;;YCJL;WAEG;WACA;WACA;WACA;WACA,MAAM,SAAS;WACf;;WAGA;WACA;WACA;;iBAGE;WACN,kBAAkB;;;;;;;;wBASb,gBACd,QAAQ,kBACP;WAA0B,OAAO"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/client.ts","../src/errors.ts","../src/index.ts"],"mappings":";;;;;;;qBA0Ba,yBAAyB;mBACnB;EAEL,YAAA,kBAAkB;EAMxB,aAAa,iBAAiB;EAwB9B,SACJ,cACA,OAAO,SAAS,2BACf,QAAQ;EAkCL,WAAW;UAcH;;;;KC5GJ;qBAGC,uBAAuB;WAChB;EAEN,YAAA,iBAAiB,MAAM,oBAAoB;WAO9C,MAAM;;;;YCDL;WAEG;WACA;WACA;WACA;WACA,MAAM,SAAS;WACf;;WAGA;WACA;WACA;;iBAGE;WACN,kBAAkB;;;;;;;;wBASb,gBACd,QAAQ,kBACP;WAA0B,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/errors.ts","../src/client.ts","../src/index.ts"],"sourcesContent":["// MCP plugin errors. Spec 23 — §\"Error handling\".\n\nexport type MCPPluginErrorCode =\n | \"CONNECT_FAILED\"\n | \"TOOL_NOT_FOUND\"\n | \"TOOL_CALL_FAILED\"\n | \"TRANSPORT_ERROR\";\n\nexport class MCPPluginError extends Error {\n override readonly cause: unknown;\n\n constructor(message: string, code: MCPPluginErrorCode, cause?: unknown) {\n super(message);\n this.name = \"MCPPluginError\";\n this.code = code;\n this.cause = cause;\n }\n\n readonly code: MCPPluginErrorCode;\n}\n","// MCP client pool — lazy connect, multi-server namespacing, transport selection.\n// Spec 23 — §\"Data models\", §\"Connection lifecycle\", §\"Transport selection\".\n\nimport { Client } from \"@modelcontextprotocol/sdk/client/index.js\";\nimport { StdioClientTransport } from \"@modelcontextprotocol/sdk/client/stdio.js\";\nimport { StreamableHTTPClientTransport } from \"@modelcontextprotocol/sdk/client/streamableHttp.js\";\nimport { SSEClientTransport } from \"@modelcontextprotocol/sdk/client/sse.js\";\nimport type { ToolDefinition, ToolResult, ToolProvider } from \"@sverka/compiler\";\nimport { MCPPluginError } from \"./errors.js\";\nimport type { MCPServerConfig } from \"./index.js\";\n\ninterface ServerEntry {\n readonly config: MCPServerConfig;\n client?: Client;\n connected: boolean;\n}\n\n/**\n * Pool of MCP clients, one per configured server. Connections are lazy:\n * a server's `Client.connect()` runs only on first access (listTools or\n * callTool). Tool names are namespaced `<server>.<tool>`.\n */\nexport class MCPClientPool implements ToolProvider {\n private readonly entries = new Map<string, ServerEntry>();\n\n constructor(servers: readonly MCPServerConfig[]) {\n for (const config of servers) {\n this.entries.set(config.name, { config, connected: false });\n }\n }\n\n async listTools(): Promise<readonly ToolDefinition[]> {\n const all: ToolDefinition[] = [];\n for (const entry of this.entries.values()) {\n const client = await this.ensureConnected(entry);\n const response = await client.listTools();\n for (const tool of response.tools) {\n all.push({\n name: `${entry.config.name}.${tool.name}`,\n ...(tool.description !== undefined ? { description: tool.description } : {}),\n ...(tool.inputSchema !== undefined\n ? { inputSchema: tool.inputSchema as Readonly<Record<string, unknown>> }\n : {}),\n });\n }\n }\n return all;\n }\n\n async callTool(\n name: string,\n args?: Readonly<Record<string, unknown>>,\n ): Promise<ToolResult> {\n const { serverName, toolName } = splitNamespaced(name);\n const entry = this.entries.get(serverName);\n if (!entry) {\n throw new MCPPluginError(\n `unknown MCP server '${serverName}' for tool '${name}'`,\n \"TOOL_NOT_FOUND\",\n );\n }\n const client = await this.ensureConnected(entry);\n let response;\n try {\n response = await client.callTool({ name: toolName, arguments: args });\n } catch (err) {\n throw new MCPPluginError(\n `MCP server '${serverName}' tool '${toolName}' call failed`,\n \"TOOL_CALL_FAILED\",\n err,\n );\n }\n if (response.isError) {\n throw new MCPPluginError(\n `MCP server '${serverName}' tool '${toolName}' returned an error`,\n \"TOOL_CALL_FAILED\",\n );\n }\n return {\n content: response.content as ToolResult[\"content\"],\n ...(response.isError !== undefined ? { isError: response.isError as boolean } : {}),\n };\n }\n\n async dispose(): Promise<void> {\n for (const entry of this.entries.values()) {\n if (entry.connected && entry.client) {\n try {\n await entry.client.close();\n } catch {\n // best-effort: ignore per-client close errors (Spec 23).\n }\n }\n delete entry.client;\n entry.connected = false;\n }\n }\n\n private async ensureConnected(entry: ServerEntry): Promise<Client> {\n if (entry.connected && entry.client) {\n return entry.client;\n }\n const client = await connectServer(entry.config);\n entry.client = client;\n entry.connected = true;\n return client;\n }\n}\n\nfunction splitNamespaced(name: string): { serverName: string; toolName: string } {\n const dot = name.indexOf(\".\");\n if (dot < 0) {\n throw new MCPPluginError(\n `tool name '${name}' is not namespaced as '<server>.<tool>'`,\n \"TOOL_NOT_FOUND\",\n );\n }\n return { serverName: name.slice(0, dot), toolName: name.slice(dot + 1) };\n}\n\n/**\n * Create a connected Client for a server config. Selects the transport and\n * runs `Client.connect()`. Throws `MCPPluginError(CONNECT_FAILED)` on failure.\n * For HTTP servers, Streamable HTTP is tried first; on any connect failure it\n * falls back to SSE on a fresh client (Spec 23 — §\"Transport selection\").\n */\nasync function connectServer(config: MCPServerConfig): Promise<Client> {\n if (config.transport === \"stdio\") {\n const transport = new StdioClientTransport({\n command: config.command,\n ...(config.args !== undefined ? { args: [...config.args] } : {}),\n ...(config.env !== undefined ? { env: { ...config.env } } : {}),\n ...(config.cwd !== undefined ? { cwd: config.cwd } : {}),\n });\n return connectClient(config.name, transport);\n }\n // HTTP: try Streamable HTTP first, fall back to SSE on a fresh client.\n const url = new URL(config.url);\n try {\n const transport = new StreamableHTTPClientTransport(url);\n return await connectClient(config.name, transport);\n } catch {\n // Streamable HTTP failed (e.g. 4xx) — retry with SSE on a fresh client.\n const sseTransport = new SSEClientTransport(url);\n return connectClient(config.name, sseTransport);\n }\n}\n\nasync function connectClient(name: string, transport: unknown): Promise<Client> {\n const client = new Client(\n { name: \"sverka-mcp\", version: \"0.0.0\" },\n { capabilities: {} },\n );\n try {\n await client.connect(transport as Parameters<typeof client.connect>[0]);\n } catch (err) {\n throw new MCPPluginError(\n `failed to connect to MCP server '${name}'`,\n \"CONNECT_FAILED\",\n err,\n );\n }\n return client;\n}\n","// @sverka/plugin-mcp — MCP plugin transport. Spec 23.\n//\n// Loads external MCP (Model Context Protocol) servers as Sverka plugins.\n// `createMCPPlugin(config)` returns a SverkaPlugin with a `tools` facet that\n// lazily connects to one or more MCP servers (stdio or Streamable HTTP with\n// SSE fallback) and exposes their tools with `<server>.<tool>` namespacing.\n\nimport type { SverkaPlugin, ToolProvider } from \"@sverka/compiler\";\nimport { MCPClientPool } from \"./client.js\";\nimport { MCPPluginError } from \"./errors.js\";\n\nexport { MCPClientPool } from \"./client.js\";\nexport { MCPPluginError, type MCPPluginErrorCode } from \"./errors.js\";\n\nexport type MCPServerConfig =\n | {\n readonly name: string;\n readonly transport: \"stdio\";\n readonly command: string;\n readonly args?: readonly string[];\n readonly env?: Readonly<Record<string, string>>;\n readonly cwd?: string;\n }\n | {\n readonly name: string;\n readonly transport: \"http\";\n readonly url: string;\n };\n\nexport interface MCPPluginConfig {\n readonly servers: readonly MCPServerConfig[];\n}\n\n/**\n * Create a Sverka plugin that fronts one or more MCP servers. The returned\n * plugin exposes a `tools` facet (ToolProvider) that lazily connects to the\n * configured servers on first tool access. Tool names are namespaced\n * `<server>.<tool>` to avoid collisions across servers.\n */\nexport function createMCPPlugin(\n config: MCPPluginConfig,\n): SverkaPlugin & { readonly tools: ToolProvider } {\n const pool = new MCPClientPool(config.servers);\n const name = config.servers.length === 1 ? config.servers[0]?.name ?? \"mcp\" : \"mcp\";\n return {\n name,\n apiVersion: \"sverka.dev/v1\",\n capabilities: {\n \"mcp.tools.list\": \"native\",\n \"mcp.tools.call\": \"native\",\n },\n tools: pool,\n };\n}\n"],"mappings":";;;;;AAQA,IAAa,iBAAb,cAAoC,MAAM;CACxC;CAEA,YAAY,SAAiB,MAA0B,OAAiB;EACtE,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,QAAQ;CACf;CAEA;AACF;;;;;;;;ACGA,IAAa,gBAAb,MAAmD;CACjD,0BAA2B,IAAI,IAAyB;CAExD,YAAY,SAAqC;EAC/C,KAAK,MAAM,UAAU,SACnB,KAAK,QAAQ,IAAI,OAAO,MAAM;GAAE;GAAQ,WAAW;EAAM,CAAC;CAE9D;CAEA,MAAM,YAAgD;EACpD,MAAM,MAAwB,CAAC;EAC/B,KAAK,MAAM,SAAS,KAAK,QAAQ,OAAO,GAAG;GAEzC,MAAM,WAAW,OAAM,MADF,KAAK,gBAAgB,KAAK,EAAA,CACjB,UAAU;GACxC,KAAK,MAAM,QAAQ,SAAS,OAC1B,IAAI,KAAK;IACP,MAAM,GAAG,MAAM,OAAO,KAAK,GAAG,KAAK;IACnC,GAAI,KAAK,gBAAgB,KAAA,IAAY,EAAE,aAAa,KAAK,YAAY,IAAI,CAAC;IAC1E,GAAI,KAAK,gBAAgB,KAAA,IACrB,EAAE,aAAa,KAAK,YAAiD,IACrE,CAAC;GACP,CAAC;EAEL;EACA,OAAO;CACT;CAEA,MAAM,SACJ,MACA,MACqB;EACrB,MAAM,EAAE,YAAY,aAAa,gBAAgB,IAAI;EACrD,MAAM,QAAQ,KAAK,QAAQ,IAAI,UAAU;EACzC,IAAI,CAAC,OACH,MAAM,IAAI,eACR,uBAAuB,WAAW,cAAc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AAE,IAAI,CAAC;GAC9D,GAAI,OAAO,QAAQ,KAAA,IAAY,EAAE,KAAK,EAAE,GAAG,OAAO,IAAI,EAAE,IAAI,CAAC;GAC7D,GAAI,OAAO,QAAQ,KAAA,IAAY,EAAE,KAAK,OAAO,IAAI,IAAI,CAAC;EACxD,CAAC;EACD,OAAO,cAAc,OAAO,MAAM,SAAS;CAC7C;CAEA,MAAM,MAAM,IAAI,IAAI,OAAO,GAAG;CAC9B,IAAI;EACF,MAAM,YAAY,IAAI,8BAA8B,GAAG;EACvD,OAAO,MAAM,cAAc,OAAO,MAAM,SAAS;CACnD,QAAQ;EAEN,MAAM,eAAe,IAAI,mBAAmB,GAAG;EAC/C,OAAO,cAAc,OAAO,MAAM,YAAY;CAChD;AACF;AAEA,eAAe,cAAc,MAAc,WAAqC;CAC9E,MAAM,SAAS,IAAI,OACjB;EAAE,MAAM;EAAc,SAAS;CAAQ,GACvC,EAAE,cAAc,CAAC,EAAE,CACrB;CACA,IAAI;EACF,MAAM,OAAO,QAAQ,SAAiD;CACxE,SAAS,KAAK;EACZ,MAAM,IAAI,eACR,oCAAoC,KAAK,IACzC,kBACA,GACF;CACF;CACA,OAAO;AACT;;;;;;;;;AC5HA,SAAgB,gBACd,QACiD;CACjD,MAAM,OAAO,IAAI,cAAc,OAAO,OAAO;CAE7C,OAAO;EACL,MAFW,OAAO,QAAQ,WAAW,IAAI,OAAO,QAAQ,EAAE,EAAE,QAAQ,QAAQ;EAG5E,YAAY;EACZ,cAAc;GACZ,kBAAkB;GAClB,kBAAkB;EACpB;EACA,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/errors.ts","../src/client.ts","../src/index.ts"],"sourcesContent":["// MCP plugin errors. Spec 23 — §\"Error handling\".\n\nexport type MCPPluginErrorCode =\n \"CONNECT_FAILED\" | \"TOOL_NOT_FOUND\" | \"TOOL_CALL_FAILED\" | \"TRANSPORT_ERROR\";\n\nexport class MCPPluginError extends Error {\n override readonly cause: unknown;\n\n constructor(message: string, code: MCPPluginErrorCode, cause?: unknown) {\n super(message);\n this.name = \"MCPPluginError\";\n this.code = code;\n this.cause = cause;\n }\n\n readonly code: MCPPluginErrorCode;\n}\n","// MCP client pool — lazy connect, multi-server namespacing, transport selection.\n// Spec 23 — §\"Data models\", §\"Connection lifecycle\", §\"Transport selection\".\n\nimport { Client } from \"@modelcontextprotocol/sdk/client/index.js\";\nimport { StdioClientTransport } from \"@modelcontextprotocol/sdk/client/stdio.js\";\nimport { StreamableHTTPClientTransport } from \"@modelcontextprotocol/sdk/client/streamableHttp.js\";\nimport { SSEClientTransport } from \"@modelcontextprotocol/sdk/client/sse.js\";\nimport type {\n ToolDefinition,\n ToolResult,\n ToolProvider,\n} from \"@sverka/compiler\";\nimport { MCPPluginError } from \"./errors.js\";\nimport type { MCPServerConfig } from \"./index.js\";\n\ninterface ServerEntry {\n readonly config: MCPServerConfig;\n client?: Client;\n connected: boolean;\n}\n\n/**\n * Pool of MCP clients, one per configured server. Connections are lazy:\n * a server's `Client.connect()` runs only on first access (listTools or\n * callTool). Tool names are namespaced `<server>.<tool>`.\n */\nexport class MCPClientPool implements ToolProvider {\n private readonly entries = new Map<string, ServerEntry>();\n\n constructor(servers: readonly MCPServerConfig[]) {\n for (const config of servers) {\n this.entries.set(config.name, { config, connected: false });\n }\n }\n\n async listTools(): Promise<readonly ToolDefinition[]> {\n const all: ToolDefinition[] = [];\n for (const entry of this.entries.values()) {\n const client = await this.ensureConnected(entry);\n const response = await client.listTools();\n for (const tool of response.tools) {\n all.push({\n name: `${entry.config.name}.${tool.name}`,\n ...(tool.description !== undefined\n ? { description: tool.description }\n : {}),\n ...(tool.inputSchema !== undefined\n ? {\n inputSchema: tool.inputSchema as Readonly<\n Record<string, unknown>\n >,\n }\n : {}),\n });\n }\n }\n return all;\n }\n\n async callTool(\n name: string,\n args?: Readonly<Record<string, unknown>>,\n ): Promise<ToolResult> {\n const { serverName, toolName } = splitNamespaced(name);\n const entry = this.entries.get(serverName);\n if (!entry) {\n throw new MCPPluginError(\n `unknown MCP server '${serverName}' for tool '${name}'`,\n \"TOOL_NOT_FOUND\",\n );\n }\n const client = await this.ensureConnected(entry);\n let response;\n try {\n response = await client.callTool({ name: toolName, arguments: args });\n } catch (err) {\n throw new MCPPluginError(\n `MCP server '${serverName}' tool '${toolName}' call failed`,\n \"TOOL_CALL_FAILED\",\n err,\n );\n }\n if (response.isError) {\n throw new MCPPluginError(\n `MCP server '${serverName}' tool '${toolName}' returned an error`,\n \"TOOL_CALL_FAILED\",\n );\n }\n return {\n content: response.content as ToolResult[\"content\"],\n ...(response.isError !== undefined\n ? { isError: response.isError as boolean }\n : {}),\n };\n }\n\n async dispose(): Promise<void> {\n for (const entry of this.entries.values()) {\n if (entry.connected && entry.client) {\n try {\n await entry.client.close();\n } catch {\n // best-effort: ignore per-client close errors (Spec 23).\n }\n }\n delete entry.client;\n entry.connected = false;\n }\n }\n\n private async ensureConnected(entry: ServerEntry): Promise<Client> {\n if (entry.connected && entry.client) {\n return entry.client;\n }\n const client = await connectServer(entry.config);\n entry.client = client;\n entry.connected = true;\n return client;\n }\n}\n\nfunction splitNamespaced(name: string): {\n serverName: string;\n toolName: string;\n} {\n const dot = name.indexOf(\".\");\n if (dot < 0) {\n throw new MCPPluginError(\n `tool name '${name}' is not namespaced as '<server>.<tool>'`,\n \"TOOL_NOT_FOUND\",\n );\n }\n return { serverName: name.slice(0, dot), toolName: name.slice(dot + 1) };\n}\n\n/**\n * Create a connected Client for a server config. Selects the transport and\n * runs `Client.connect()`. Throws `MCPPluginError(CONNECT_FAILED)` on failure.\n * For HTTP servers, Streamable HTTP is tried first; on any connect failure it\n * falls back to SSE on a fresh client (Spec 23 — §\"Transport selection\").\n */\nasync function connectServer(config: MCPServerConfig): Promise<Client> {\n if (config.transport === \"stdio\") {\n const transport = new StdioClientTransport({\n command: config.command,\n ...(config.args !== undefined ? { args: [...config.args] } : {}),\n ...(config.env !== undefined ? { env: { ...config.env } } : {}),\n ...(config.cwd !== undefined ? { cwd: config.cwd } : {}),\n });\n return connectClient(config.name, transport);\n }\n // HTTP: try Streamable HTTP first, fall back to SSE on a fresh client.\n const url = new URL(config.url);\n try {\n const transport = new StreamableHTTPClientTransport(url);\n return await connectClient(config.name, transport);\n } catch {\n // Streamable HTTP failed (e.g. 4xx) — retry with SSE on a fresh client.\n const sseTransport = new SSEClientTransport(url);\n return connectClient(config.name, sseTransport);\n }\n}\n\nasync function connectClient(\n name: string,\n transport: unknown,\n): Promise<Client> {\n const client = new Client(\n { name: \"sverka-mcp\", version: \"0.0.0\" },\n { capabilities: {} },\n );\n try {\n await client.connect(transport as Parameters<typeof client.connect>[0]);\n } catch (err) {\n throw new MCPPluginError(\n `failed to connect to MCP server '${name}'`,\n \"CONNECT_FAILED\",\n err,\n );\n }\n return client;\n}\n","// @sverka/plugin-mcp — MCP plugin transport. Spec 23.\n//\n// Loads external MCP (Model Context Protocol) servers as Sverka plugins.\n// `createMCPPlugin(config)` returns a SverkaPlugin with a `tools` facet that\n// lazily connects to one or more MCP servers (stdio or Streamable HTTP with\n// SSE fallback) and exposes their tools with `<server>.<tool>` namespacing.\n\nimport type { SverkaPlugin, ToolProvider } from \"@sverka/compiler\";\nimport { MCPClientPool } from \"./client.js\";\nimport { MCPPluginError } from \"./errors.js\";\n\nexport { MCPClientPool } from \"./client.js\";\nexport { MCPPluginError, type MCPPluginErrorCode } from \"./errors.js\";\n\nexport type MCPServerConfig =\n | {\n readonly name: string;\n readonly transport: \"stdio\";\n readonly command: string;\n readonly args?: readonly string[];\n readonly env?: Readonly<Record<string, string>>;\n readonly cwd?: string;\n }\n | {\n readonly name: string;\n readonly transport: \"http\";\n readonly url: string;\n };\n\nexport interface MCPPluginConfig {\n readonly servers: readonly MCPServerConfig[];\n}\n\n/**\n * Create a Sverka plugin that fronts one or more MCP servers. The returned\n * plugin exposes a `tools` facet (ToolProvider) that lazily connects to the\n * configured servers on first tool access. Tool names are namespaced\n * `<server>.<tool>` to avoid collisions across servers.\n */\nexport function createMCPPlugin(\n config: MCPPluginConfig,\n): SverkaPlugin & { readonly tools: ToolProvider } {\n const pool = new MCPClientPool(config.servers);\n const name =\n config.servers.length === 1 ? (config.servers[0]?.name ?? \"mcp\") : \"mcp\";\n return {\n name,\n apiVersion: \"sverka.dev/v1\",\n capabilities: {\n \"mcp.tools.list\": \"native\",\n \"mcp.tools.call\": \"native\",\n },\n tools: pool,\n };\n}\n"],"mappings":";;;;;AAKA,IAAa,iBAAb,cAAoC,MAAM;CACxC;CAEA,YAAY,SAAiB,MAA0B,OAAiB;EACtE,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,QAAQ;CACf;CAEA;AACF;;;;;;;;ACUA,IAAa,gBAAb,MAAmD;CACjD,0BAA2B,IAAI,IAAyB;CAExD,YAAY,SAAqC;EAC/C,KAAK,MAAM,UAAU,SACnB,KAAK,QAAQ,IAAI,OAAO,MAAM;GAAE;GAAQ,WAAW;EAAM,CAAC;CAE9D;CAEA,MAAM,YAAgD;EACpD,MAAM,MAAwB,CAAC;EAC/B,KAAK,MAAM,SAAS,KAAK,QAAQ,OAAO,GAAG;GAEzC,MAAM,WAAW,OAAM,MADF,KAAK,gBAAgB,KAAK,EAAA,CACjB,UAAU;GACxC,KAAK,MAAM,QAAQ,SAAS,OAC1B,IAAI,KAAK;IACP,MAAM,GAAG,MAAM,OAAO,KAAK,GAAG,KAAK;IACnC,GAAI,KAAK,gBAAgB,KAAA,IACrB,EAAE,aAAa,KAAK,YAAY,IAChC,CAAC;IACL,GAAI,KAAK,gBAAgB,KAAA,IACrB,EACE,aAAa,KAAK,YAGpB,IACA,CAAC;GACP,CAAC;EAEL;EACA,OAAO;CACT;CAEA,MAAM,SACJ,MACA,MACqB;EACrB,MAAM,EAAE,YAAY,aAAa,gBAAgB,IAAI;EACrD,MAAM,QAAQ,KAAK,QAAQ,IAAI,UAAU;EACzC,IAAI,CAAC,OACH,MAAM,IAAI,eACR,u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,OAAO,IAAI,EAAE,IAAI,CAAC;GAC9D,GAAI,OAAO,QAAQ,KAAA,IAAY,EAAE,KAAK,EAAE,GAAG,OAAO,IAAI,EAAE,IAAI,CAAC;GAC7D,GAAI,OAAO,QAAQ,KAAA,IAAY,EAAE,KAAK,OAAO,IAAI,IAAI,CAAC;EACxD,CAAC;EACD,OAAO,cAAc,OAAO,MAAM,SAAS;CAC7C;CAEA,MAAM,MAAM,IAAI,IAAI,OAAO,GAAG;CAC9B,IAAI;EACF,MAAM,YAAY,IAAI,8BAA8B,GAAG;EACvD,OAAO,MAAM,cAAc,OAAO,MAAM,SAAS;CACnD,QAAQ;EAEN,MAAM,eAAe,IAAI,mBAAmB,GAAG;EAC/C,OAAO,cAAc,OAAO,MAAM,YAAY;CAChD;AACF;AAEA,eAAe,cACb,MACA,WACiB;CACjB,MAAM,SAAS,IAAI,OACjB;EAAE,MAAM;EAAc,SAAS;CAAQ,GACvC,EAAE,cAAc,CAAC,EAAE,CACrB;CACA,IAAI;EACF,MAAM,OAAO,QAAQ,SAAiD;CACxE,SAAS,KAAK;EACZ,MAAM,IAAI,eACR,oCAAoC,KAAK,IACzC,kBACA,GACF;CACF;CACA,OAAO;AACT;;;;;;;;;AC9IA,SAAgB,gBACd,QACiD;CACjD,MAAM,OAAO,IAAI,cAAc,OAAO,OAAO;CAG7C,OAAO;EACL,MAFA,OAAO,QAAQ,WAAW,IAAK,OAAO,QAAQ,EAAE,EAAE,QAAQ,QAAS;EAGnE,YAAY;EACZ,cAAc;GACZ,kBAAkB;GAClB,kBAAkB;EACpB;EACA,OAAO;CACT;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sverka/plugin-mcp",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Sverka MCP plugin — expose external MCP servers as Sverka tool providers",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,7 +33,7 @@
33
33
  "typecheck": "tsc --noEmit"
34
34
  },
35
35
  "dependencies": {
36
- "@sverka/compiler": "^0.1.6",
36
+ "@sverka/compiler": "^0.1.8",
37
37
  "@modelcontextprotocol/sdk": "1.30.0"
38
38
  },
39
39
  "devDependencies": {