@webmcp-auto-ui/sdk 2.5.31 → 2.5.32

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webmcp-auto-ui/sdk",
3
- "version": "2.5.31",
3
+ "version": "2.5.32",
4
4
  "description": "Skills CRUD, HyperSkill format, Svelte 5 stores",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "type": "module",
@@ -226,7 +226,7 @@ function createCanvasVanilla() {
226
226
  // All these mutate the SAME _servers list; `mcpUrl` targets the primary
227
227
  // entry, creating one if none exists. Apps can equivalently call
228
228
  // addDataServer({primary: true}) + setDataServerMeta(name, ...) directly.
229
- function ensurePrimary(url?: string): DataServer {
229
+ function ensurePrimary(url?: string): DataServer | undefined {
230
230
  let p = primaryServer();
231
231
  if (p) {
232
232
  if (url && p.url !== url) {
@@ -234,10 +234,13 @@ function createCanvasVanilla() {
234
234
  }
235
235
  return _servers.find((s) => s.primary)!;
236
236
  }
237
- // Create a placeholder primary with a stable name derived from the URL.
238
- const nm = url ? new URL(url, 'http://local').host || url : 'primary';
237
+ // Refuse to create a placeholder primary without a real URL empty-URL
238
+ // ghosts caused MultiMcpBridge to POST to the current page origin, yielding
239
+ // a 405 storm (SvelteKit treats POST / as a form action).
240
+ if (!url) return undefined;
241
+ const nm = new URL(url, 'http://local').host || url;
239
242
  _servers = [..._servers, {
240
- name: nm, url: url ?? '', kind: 'data', enabled: true, connected: false, primary: true,
243
+ name: nm, url, kind: 'data', enabled: true, connected: false, primary: true,
241
244
  }];
242
245
  return _servers[_servers.length - 1]!;
243
246
  }
@@ -250,6 +253,7 @@ function createCanvasVanilla() {
250
253
 
251
254
  function setMcpConnecting(connecting: boolean): void {
252
255
  const p = ensurePrimary();
256
+ if (!p) return;
253
257
  _servers = _servers.map((s) => s.name === p.name ? { ...s, connecting } : s);
254
258
  notify();
255
259
  }
@@ -269,6 +273,7 @@ function createCanvasVanilla() {
269
273
  return;
270
274
  }
271
275
  const p = ensurePrimary();
276
+ if (!p) return;
272
277
  const newName = name && name.length > 0 ? name : p.name;
273
278
  _servers = _servers.map((s) => s.name === p.name
274
279
  ? { ...s, name: newName, connected: true, connecting: false, tools: tools ?? s.tools ?? [], error: undefined }
@@ -278,6 +283,7 @@ function createCanvasVanilla() {
278
283
 
279
284
  function setMcpError(err: string): void {
280
285
  const p = ensurePrimary();
286
+ if (!p) return;
281
287
  _servers = _servers.map((s) => s.name === p.name
282
288
  ? { ...s, connected: false, connecting: false, error: err }
283
289
  : s);
@@ -452,7 +458,7 @@ function createCanvasVanilla() {
452
458
  set llm(v: LLMId) { _llm = v; notify(); },
453
459
  get mcpUrl() { return primaryServer()?.url ?? ''; },
454
460
  set mcpUrl(v: string) { setMcpUrl(v); },
455
- get mcpConnected() { return primaryServer()?.connected ?? false; },
461
+ get mcpConnected() { return _servers.some((s) => s.connected); },
456
462
  get mcpConnecting() { return anyConnecting(); },
457
463
  get mcpName() { return displayName(); },
458
464
  get mcpTools() { return unionTools(); },