@frontmcp/react 1.12.0 → 1.12.2

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/ai/index.js CHANGED
@@ -428,7 +428,7 @@ function useResolvedServer(serverName) {
428
428
  // libs/react/src/ai/useAITools.ts
429
429
  function useAITools(platform, options) {
430
430
  const { entry } = useResolvedServer(options?.server);
431
- const server = entry?.server ?? null;
431
+ const client = entry?.client ?? null;
432
432
  const toolInfos = entry?.tools ?? [];
433
433
  const status = entry?.status ?? "idle";
434
434
  const [formattedTools, setFormattedTools] = (0, import_react4.useState)(null);
@@ -461,11 +461,11 @@ function useAITools(platform, options) {
461
461
  }, [toolInfos, platform, status]);
462
462
  const callTool = (0, import_react4.useCallback)(
463
463
  async (name, args) => {
464
- if (!server) {
465
- throw new Error("FrontMCP server not available");
464
+ if (status !== "connected" || !client) {
465
+ throw new Error("FrontMCP not connected");
466
466
  }
467
467
  try {
468
- const rawResult = await server.callTool(name, args);
468
+ const rawResult = await client.callTool(name, args);
469
469
  return (0, import_sdk.formatResultForPlatform)(rawResult, platform);
470
470
  } catch (err) {
471
471
  const error2 = err instanceof Error ? err : new Error(String(err));
@@ -473,7 +473,7 @@ function useAITools(platform, options) {
473
473
  throw error2;
474
474
  }
475
475
  },
476
- [server, platform]
476
+ [client, status, platform]
477
477
  );
478
478
  return { tools: formattedTools, callTool, loading, error };
479
479
  }
@@ -3,7 +3,8 @@
3
3
  *
4
4
  * Reads raw MCP tools from the ServerRegistry, formats them via
5
5
  * `formatToolsForPlatform()`, and provides a `callTool` handler that
6
- * executes via `server.callTool()` + `formatResultForPlatform()`.
6
+ * executes through the connected client that listed them (`client.callTool()`,
7
+ * with its identity and session) + `formatResultForPlatform()`.
7
8
  *
8
9
  * Supports multi-server via `options.server`.
9
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"useAITools.d.ts","sourceRoot":"","sources":["../../src/ai/useAITools.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAmD,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAGlG,OAAO,KAAK,EAAsD,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEpG,UAAU,cAAc;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,WAAW,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAC,CAAC,CAAC,CA0D5G"}
1
+ {"version":3,"file":"useAITools.d.ts","sourceRoot":"","sources":["../../src/ai/useAITools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAmD,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAGlG,OAAO,KAAK,EAAsD,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEpG,UAAU,cAAc;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,WAAW,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAC,CAAC,CAAC,CA0D5G"}
package/api/index.js CHANGED
@@ -438,6 +438,7 @@ function parseOpenApiSpec(spec) {
438
438
  if (!paths) return [];
439
439
  const operations = [];
440
440
  const usedIds = /* @__PURE__ */ new Set();
441
+ const nextSuffixes = /* @__PURE__ */ new Map();
441
442
  for (const [path, pathItem] of Object.entries(paths)) {
442
443
  if (!pathItem || typeof pathItem !== "object") continue;
443
444
  for (const method of HTTP_METHODS) {
@@ -446,8 +447,9 @@ function parseOpenApiSpec(spec) {
446
447
  const rawOperationId = operation["operationId"];
447
448
  let operationId = typeof rawOperationId === "string" ? rawOperationId : `${method}_${path.replace(/[^a-zA-Z0-9]/g, "_")}`;
448
449
  if (usedIds.has(operationId)) {
449
- let suffix = 1;
450
+ let suffix = nextSuffixes.get(operationId) ?? 1;
450
451
  while (usedIds.has(`${operationId}_${suffix}`)) suffix++;
452
+ nextSuffixes.set(operationId, suffix + 1);
451
453
  operationId = `${operationId}_${suffix}`;
452
454
  }
453
455
  usedIds.add(operationId);
@@ -1 +1 @@
1
- {"version":3,"file":"parseOpenApiSpec.d.ts","sourceRoot":"","sources":["../../src/api/parseOpenApiSpec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAyD,MAAM,aAAa,CAAC;AA8BvG,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,EAAE,CA4G9E"}
1
+ {"version":3,"file":"parseOpenApiSpec.d.ts","sourceRoot":"","sources":["../../src/api/parseOpenApiSpec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAyD,MAAM,aAAa,CAAC;AA8BvG,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,EAAE,CA+G9E"}
package/esm/ai/index.mjs CHANGED
@@ -400,7 +400,7 @@ function useResolvedServer(serverName) {
400
400
  // libs/react/src/ai/useAITools.ts
401
401
  function useAITools(platform, options) {
402
402
  const { entry } = useResolvedServer(options?.server);
403
- const server = entry?.server ?? null;
403
+ const client = entry?.client ?? null;
404
404
  const toolInfos = entry?.tools ?? [];
405
405
  const status = entry?.status ?? "idle";
406
406
  const [formattedTools, setFormattedTools] = useState(null);
@@ -433,11 +433,11 @@ function useAITools(platform, options) {
433
433
  }, [toolInfos, platform, status]);
434
434
  const callTool = useCallback2(
435
435
  async (name, args) => {
436
- if (!server) {
437
- throw new Error("FrontMCP server not available");
436
+ if (status !== "connected" || !client) {
437
+ throw new Error("FrontMCP not connected");
438
438
  }
439
439
  try {
440
- const rawResult = await server.callTool(name, args);
440
+ const rawResult = await client.callTool(name, args);
441
441
  return formatResultForPlatform(rawResult, platform);
442
442
  } catch (err) {
443
443
  const error2 = err instanceof Error ? err : new Error(String(err));
@@ -445,7 +445,7 @@ function useAITools(platform, options) {
445
445
  throw error2;
446
446
  }
447
447
  },
448
- [server, platform]
448
+ [client, status, platform]
449
449
  );
450
450
  return { tools: formattedTools, callTool, loading, error };
451
451
  }
package/esm/api/index.mjs CHANGED
@@ -410,6 +410,7 @@ function parseOpenApiSpec(spec) {
410
410
  if (!paths) return [];
411
411
  const operations = [];
412
412
  const usedIds = /* @__PURE__ */ new Set();
413
+ const nextSuffixes = /* @__PURE__ */ new Map();
413
414
  for (const [path, pathItem] of Object.entries(paths)) {
414
415
  if (!pathItem || typeof pathItem !== "object") continue;
415
416
  for (const method of HTTP_METHODS) {
@@ -418,8 +419,9 @@ function parseOpenApiSpec(spec) {
418
419
  const rawOperationId = operation["operationId"];
419
420
  let operationId = typeof rawOperationId === "string" ? rawOperationId : `${method}_${path.replace(/[^a-zA-Z0-9]/g, "_")}`;
420
421
  if (usedIds.has(operationId)) {
421
- let suffix = 1;
422
+ let suffix = nextSuffixes.get(operationId) ?? 1;
422
423
  while (usedIds.has(`${operationId}_${suffix}`)) suffix++;
424
+ nextSuffixes.set(operationId, suffix + 1);
423
425
  operationId = `${operationId}_${suffix}`;
424
426
  }
425
427
  usedIds.add(operationId);
package/esm/index.mjs CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  } from "@frontmcp/sdk";
29
29
  import { z as z2 } from "@frontmcp/sdk";
30
30
  import { Event, FrontMcpEvent, event, frontMcpEvent } from "@frontmcp/sdk";
31
- import { ToolContext, ResourceContext, PromptContext, ExecutionContextBase } from "@frontmcp/sdk";
31
+ import { ToolContext, ResourceContext, PromptContext, EventContext, ExecutionContextBase } from "@frontmcp/sdk";
32
32
 
33
33
  // libs/react/src/registry/ServerRegistry.ts
34
34
  function sameListing(a, b) {
@@ -1480,11 +1480,9 @@ function DynamicRenderer({ tree, registry, fallback }) {
1480
1480
  function renderNode(node, registry, fallback, index) {
1481
1481
  const Component = registry.resolve(node.type) ?? fallback ?? "div";
1482
1482
  const childElements = renderChildren(node.children, registry, fallback);
1483
- return React2.createElement(
1484
- Component,
1485
- { ...node.props, key: `dynamic-${index}` },
1486
- ...childElements
1487
- );
1483
+ const props = { ...node.props, key: `dynamic-${index}` };
1484
+ delete props["dangerouslySetInnerHTML"];
1485
+ return React2.createElement(Component, props, ...childElements);
1488
1486
  }
1489
1487
  function renderChildren(children, registry, fallback) {
1490
1488
  if (children === void 0 || children === null) {
@@ -2112,6 +2110,7 @@ export {
2112
2110
  DynamicRegistry,
2113
2111
  DynamicRenderer,
2114
2112
  Event,
2113
+ EventContext,
2115
2114
  ExecutionContextBase,
2116
2115
  FrontMcp,
2117
2116
  FrontMcpAdapter,
package/esm/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontmcp/react",
3
- "version": "1.12.0",
3
+ "version": "1.12.2",
4
4
  "description": "Run a FrontMCP server inside a React app: provider, hooks, components and AI SDK integration",
5
5
  "author": "AgentFront <info@agentfront.dev>",
6
6
  "homepage": "https://frontmcp.dev/reference/react",
@@ -89,9 +89,9 @@
89
89
  "node": ">=24.0.0"
90
90
  },
91
91
  "peerDependencies": {
92
- "@frontmcp/lazy-zod": "1.12.0",
93
- "@frontmcp/sdk": "1.12.0",
94
- "@frontmcp/utils": "1.12.0",
92
+ "@frontmcp/lazy-zod": "1.12.2",
93
+ "@frontmcp/sdk": "1.12.2",
94
+ "@frontmcp/utils": "1.12.2",
95
95
  "react": "^18.0.0 || ^19.0.0",
96
96
  "react-dom": "^18.0.0 || ^19.0.0",
97
97
  "react-router-dom": "^7.0.0"
@@ -105,8 +105,8 @@
105
105
  }
106
106
  },
107
107
  "dependencies": {
108
- "@frontmcp/sdk": "1.12.0",
109
- "@frontmcp/utils": "1.12.0"
108
+ "@frontmcp/sdk": "1.12.2",
109
+ "@frontmcp/utils": "1.12.2"
110
110
  },
111
111
  "devDependencies": {
112
112
  "typescript": "^5.9.3"
@@ -479,6 +479,16 @@ function createRouteChangedEvent(name = ROUTE_CHANGED_EVENT) {
479
479
  }
480
480
 
481
481
  // libs/react/src/router/navigate.tool.ts
482
+ function isApplicationPath(path) {
483
+ if ([...path].some((char) => char === "\\" || char < " " || char === "\x7F")) return false;
484
+ const location = globalThis.location;
485
+ if (!location) return true;
486
+ try {
487
+ return new URL(path, location.href).origin === location.origin;
488
+ } catch {
489
+ return false;
490
+ }
491
+ }
482
492
  var NavigateTool = class {
483
493
  static toolName = "navigate";
484
494
  static description = "Navigate to a URL path in the application";
@@ -502,6 +512,16 @@ var NavigateTool = class {
502
512
  ]
503
513
  };
504
514
  }
515
+ if (!isApplicationPath(args.path)) {
516
+ return {
517
+ content: [
518
+ {
519
+ type: "text",
520
+ text: `Not navigated to ${JSON.stringify(args.path)}: give a path in this application, without another origin, a backslash or a control character.`
521
+ }
522
+ ]
523
+ };
524
+ }
505
525
  navigate(args.path, { replace: args.replace });
506
526
  return {
507
527
  content: [{ type: "text", text: `Navigated to ${args.path}` }]
package/index.d.ts CHANGED
@@ -18,7 +18,8 @@ export { Tool, FrontMcpTool, tool, frontMcpTool, Resource, FrontMcpResource, res
18
18
  export { z } from '@frontmcp/sdk';
19
19
  export { Event, FrontMcpEvent, event, frontMcpEvent } from '@frontmcp/sdk';
20
20
  export type { EventOccurrence, EventDeliveryMode, EventPublishOptions, EventPublishResult } from '@frontmcp/sdk';
21
- export { ToolContext, ResourceContext, PromptContext, ExecutionContextBase } from '@frontmcp/sdk';
21
+ export type { EventSubscriber, EventOccurrenceOf, EventSubscriptionRef, EventUnsubscribeReason, EventCheckItem, EventCheckResult, EventCheckLimits, } from '@frontmcp/sdk';
22
+ export { ToolContext, ResourceContext, PromptContext, EventContext, ExecutionContextBase } from '@frontmcp/sdk';
22
23
  export type { GetPromptResult, ReadResourceResult, CallToolResult, ListToolsResult, ListResourcesResult, ListResourceTemplatesResult, ListPromptsResult, TextContent, ImageContent, PromptMessage, } from '@frontmcp/sdk';
23
24
  export type { FrontMcpContextValue, ResolvedServer, FrontMcpStatus, ToolInfo, ResourceInfo, ResourceTemplateInfo, PromptInfo, ToolState, ResourceState, PromptState, UseCallToolOptions, UseCallToolReturn, ComponentNode, FieldRenderProps, DynamicToolDef, DynamicResourceDef, StoreAdapter, McpColumnDef, } from './types';
24
25
  export { ServerRegistry, serverRegistry } from './registry';
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACzG,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvH,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjE,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,wBAAwB,EACxB,MAAM,EACN,cAAc,EACd,MAAM,EACN,cAAc,EACd,GAAG,EACH,WAAW,EACX,QAAQ,EACR,OAAO,EACP,eAAe,EACf,MAAM,EACN,cAAc,GACf,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAGlC,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC3E,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGjH,OAAO,EAAE,WAAW,EAAE,eAAe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AAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGxE,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
package/index.js CHANGED
@@ -38,6 +38,7 @@ __export(index_exports, {
38
38
  DynamicRegistry: () => DynamicRegistry,
39
39
  DynamicRenderer: () => DynamicRenderer,
40
40
  Event: () => import_sdk5.Event,
41
+ EventContext: () => import_sdk6.EventContext,
41
42
  ExecutionContextBase: () => import_sdk6.ExecutionContextBase,
42
43
  FrontMcp: () => import_sdk3.FrontMcp,
43
44
  FrontMcpAdapter: () => import_sdk3.FrontMcpAdapter,
@@ -1567,11 +1568,9 @@ function DynamicRenderer({ tree, registry, fallback }) {
1567
1568
  function renderNode(node, registry, fallback, index) {
1568
1569
  const Component = registry.resolve(node.type) ?? fallback ?? "div";
1569
1570
  const childElements = renderChildren(node.children, registry, fallback);
1570
- return import_react17.default.createElement(
1571
- Component,
1572
- { ...node.props, key: `dynamic-${index}` },
1573
- ...childElements
1574
- );
1571
+ const props = { ...node.props, key: `dynamic-${index}` };
1572
+ delete props["dangerouslySetInnerHTML"];
1573
+ return import_react17.default.createElement(Component, props, ...childElements);
1575
1574
  }
1576
1575
  function renderChildren(children, registry, fallback) {
1577
1576
  if (children === void 0 || children === null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontmcp/react",
3
- "version": "1.12.0",
3
+ "version": "1.12.2",
4
4
  "description": "Run a FrontMCP server inside a React app: provider, hooks, components and AI SDK integration",
5
5
  "author": "AgentFront <info@agentfront.dev>",
6
6
  "homepage": "https://frontmcp.dev/reference/react",
@@ -89,9 +89,9 @@
89
89
  "node": ">=24.0.0"
90
90
  },
91
91
  "peerDependencies": {
92
- "@frontmcp/lazy-zod": "1.12.0",
93
- "@frontmcp/sdk": "1.12.0",
94
- "@frontmcp/utils": "1.12.0",
92
+ "@frontmcp/lazy-zod": "1.12.2",
93
+ "@frontmcp/sdk": "1.12.2",
94
+ "@frontmcp/utils": "1.12.2",
95
95
  "react": "^18.0.0 || ^19.0.0",
96
96
  "react-dom": "^18.0.0 || ^19.0.0",
97
97
  "react-router-dom": "^7.0.0"
@@ -105,8 +105,8 @@
105
105
  }
106
106
  },
107
107
  "dependencies": {
108
- "@frontmcp/sdk": "1.12.0",
109
- "@frontmcp/utils": "1.12.0"
108
+ "@frontmcp/sdk": "1.12.2",
109
+ "@frontmcp/utils": "1.12.2"
110
110
  },
111
111
  "devDependencies": {
112
112
  "typescript": "^5.9.3"
package/router/index.js CHANGED
@@ -516,6 +516,16 @@ function createRouteChangedEvent(name = ROUTE_CHANGED_EVENT) {
516
516
  }
517
517
 
518
518
  // libs/react/src/router/navigate.tool.ts
519
+ function isApplicationPath(path) {
520
+ if ([...path].some((char) => char === "\\" || char < " " || char === "\x7F")) return false;
521
+ const location = globalThis.location;
522
+ if (!location) return true;
523
+ try {
524
+ return new URL(path, location.href).origin === location.origin;
525
+ } catch {
526
+ return false;
527
+ }
528
+ }
519
529
  var NavigateTool = class {
520
530
  static toolName = "navigate";
521
531
  static description = "Navigate to a URL path in the application";
@@ -539,6 +549,16 @@ var NavigateTool = class {
539
549
  ]
540
550
  };
541
551
  }
552
+ if (!isApplicationPath(args.path)) {
553
+ return {
554
+ content: [
555
+ {
556
+ type: "text",
557
+ text: `Not navigated to ${JSON.stringify(args.path)}: give a path in this application, without another origin, a backslash or a control character.`
558
+ }
559
+ ]
560
+ };
561
+ }
542
562
  navigate(args.path, { replace: args.replace });
543
563
  return {
544
564
  content: [{ type: "text", text: `Navigated to ${args.path}` }]
@@ -1 +1 @@
1
- {"version":3,"file":"navigate.tool.d.ts","sourceRoot":"","sources":["../../src/router/navigate.tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,qBAAa,YAAY;IACvB,MAAM,CAAC,QAAQ,CAAC,QAAQ,cAAc;IACtC,MAAM,CAAC,QAAQ,CAAC,WAAW,+CAA+C;IAC1E,MAAM,CAAC,QAAQ,CAAC,WAAW;;;;;;;;;;;;;MAOzB;WAEW,OAAO,CAAC,IAAI,EAAE;QACzB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;CAkBhE"}
1
+ {"version":3,"file":"navigate.tool.d.ts","sourceRoot":"","sources":["../../src/router/navigate.tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmBH,qBAAa,YAAY;IACvB,MAAM,CAAC,QAAQ,CAAC,QAAQ,cAAc;IACtC,MAAM,CAAC,QAAQ,CAAC,WAAW,+CAA+C;IAC1E,MAAM,CAAC,QAAQ,CAAC,WAAW;;;;;;;;;;;;;MAOzB;WAEW,OAAO,CAAC,IAAI,EAAE;QACzB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;CA6BhE"}