@webmcp-auto-ui/core 0.4.0 → 0.5.0

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.
Files changed (2) hide show
  1. package/README.md +13 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -8,6 +8,10 @@ W3C WebMCP Draft 2026-03-27 polyfill and MCP Streamable HTTP client. Pure TypeSc
8
8
 
9
9
  **McpClient** — connects to MCP servers over Streamable HTTP (SSE). Handles `initialize`, `tools/list`, and `tools/call`.
10
10
 
11
+ **McpMultiClient** — manages simultaneous connections to multiple MCP servers. Aggregates tool lists and routes `callTool` to the correct server. Useful for apps that connect to several data sources at once (e.g. flex with multi-MCP).
12
+
13
+ **Prompt caching** — the `cache_control` property is applied on the tools array (not individual tools) to work correctly with Anthropic's prompt caching. This fix ensures cache hits when the tool set is stable across requests.
14
+
11
15
  **createToolGroup** — registers a named group of tools on `navigator.modelContext`. Aborting the group unregisters all tools at once — useful for component lifecycle cleanup.
12
16
 
13
17
  **sanitizeSchema** — strips JSON Schema keywords that Anthropic's API rejects (`oneOf`, `anyOf`, `allOf`, `$ref`, `if/then/else`). Applied automatically before any LLM call.
@@ -30,6 +34,7 @@ npm install @webmcp-auto-ui/core
30
34
  import {
31
35
  initializeWebMCPPolyfill,
32
36
  McpClient,
37
+ McpMultiClient,
33
38
  createToolGroup,
34
39
  textResult, jsonResult,
35
40
  listenForAgentCalls,
@@ -52,9 +57,17 @@ const init = await client.connect();
52
57
  const tools = await client.listTools();
53
58
  const result = await client.callTool('my_tool', { arg: 'value' });
54
59
 
60
+ // Multi-server connections
61
+ const multi = new McpMultiClient();
62
+ await multi.addServer('https://mcp1.example.com/mcp');
63
+ await multi.addServer('https://mcp2.example.com/mcp');
64
+ const allTools = multi.listAllTools(); // aggregated from all servers
65
+ const result = await multi.callTool('query_sql', { sql: 'SELECT 1' }); // routes to correct server
66
+
55
67
  // Cleanup
56
68
  stop();
57
69
  group.abort();
70
+ await multi.disconnectAll();
58
71
  ```
59
72
 
60
73
  ## Types
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webmcp-auto-ui/core",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "W3C WebMCP polyfill + MCP Streamable HTTP client — zero dependencies, framework-agnostic",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "author": "jb@media.mit.edu",