@frontmcp/react 1.9.6 → 1.9.7

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 (3) hide show
  1. package/README.md +195 -172
  2. package/esm/package.json +14 -11
  3. package/package.json +14 -11
package/README.md CHANGED
@@ -1,93 +1,135 @@
1
1
  # @frontmcp/react
2
2
 
3
- React hooks, components, and AI SDK integration for [FrontMCP](https://frontmcp.dev). Build AI-agent-powered UIs with idiomatic React patterns.
3
+ `@frontmcp/react` runs a FrontMCP server inside a React app. You build the server with `create()`, in the same process, and `FrontMcpProvider` connects a client to it. Components call its tools, read its resources and get its prompts with hooks, and can add tools of their own while they're mounted, so a model can fill in a card, move around the app or read its state. Use it to make a React app something an agent can drive. To build the UI a tool shows inside an AI host such as ChatGPT or Claude, use [`@frontmcp/ui`](https://www.npmjs.com/package/@frontmcp/ui) instead.
4
4
 
5
- ## Installation
5
+ [![npm](https://img.shields.io/npm/v/@frontmcp/react.svg)](https://www.npmjs.com/package/@frontmcp/react) [![License](https://img.shields.io/npm/l/@frontmcp/react.svg)](https://github.com/agentfront/frontmcp/blob/main/LICENSE)
6
+
7
+ ## Install
6
8
 
7
9
  ```bash
8
10
  npm install @frontmcp/react react react-dom
9
11
  ```
10
12
 
11
- `@frontmcp/sdk` and `@frontmcp/utils` are bundled as dependencies and installed automatically.
12
-
13
- Optional peer dependencies:
13
+ - `react` and `react-dom` 18 or 19 are peer dependencies.
14
+ - `@frontmcp/sdk` and `@frontmcp/utils` come with it, at the same version. `@frontmcp/react` re-exports what an app needs from the SDK (`create`, `connect` and its variants, the decorators and their function forms, the context classes, and `z`), so you don't import `@frontmcp/sdk` yourself. npm 7 and later also install its peer `@frontmcp/lazy-zod`, and `zod` with it.
15
+ - `react-router-dom` 7 is an optional peer, needed only for `@frontmcp/react/router`.
16
+ - In the browser, a bundler that follows the `browser` export condition, such as Vite, picks the SDK's browser build ([Running in a browser](https://frontmcp.dev/reference/react#running-in-a-browser)). In Node, for tests or server rendering, use Node.js 24 or later.
14
17
 
15
- - `zod` (^4.0.0) — for type-safe schemas with `mcpComponent` and `useDynamicTool`
16
- - `react-router-dom` (^7.0.0) — for `/router` entry point
18
+ ## Usage
17
19
 
18
- ## Entry Points
20
+ A tool, the server, and a component that calls it:
19
21
 
20
- | Import | Purpose |
21
- | ------------------------ | ------------------------------------------------------------------------- |
22
- | `@frontmcp/react` | Provider, hooks, components, ServerRegistry, and SDK re-exports |
23
- | `@frontmcp/react/ai` | AI SDK integration (`useAITools`, `useTools`, `createToolCallHandler`) |
24
- | `@frontmcp/react/router` | React Router bridge (`useRouterBridge`, navigation tools, route resource) |
25
- | `@frontmcp/react/state` | State management integration (Redux, Valtio, generic, store adapters) |
26
- | `@frontmcp/react/api` | API client integration (OpenAPI, custom HTTP clients) |
22
+ ```tsx
23
+ import { create, FrontMcpProvider, Tool, ToolContext, useCallTool, z } from '@frontmcp/react';
27
24
 
28
- ## Quick Start
25
+ @Tool({ name: 'greet', description: 'Greet someone by name', inputSchema: { name: z.string() } })
26
+ class GreetTool extends ToolContext {
27
+ async execute({ name }: { name: string }) {
28
+ return { message: `Hello, ${name}!` };
29
+ }
30
+ }
29
31
 
30
- ```tsx
31
- import { create, FrontMcpProvider, useCallTool } from '@frontmcp/react';
32
+ const server = await create({ info: { name: 'my-app', version: '1.0.0' }, tools: [GreetTool] });
32
33
 
33
- const server = await create({
34
- info: { name: 'my-app', version: '1.0.0' },
35
- tools: [GreetTool],
36
- });
34
+ function Greeter() {
35
+ const [greet, { data, loading, error }] = useCallTool<{ name: string }, { structuredContent?: { message: string } }>(
36
+ 'greet',
37
+ );
37
38
 
38
- function App() {
39
39
  return (
40
- <FrontMcpProvider server={server}>
41
- <GreetButton />
42
- </FrontMcpProvider>
40
+ <div>
41
+ <button disabled={loading} onClick={() => greet({ name: 'Ada' })}>
42
+ Greet
43
+ </button>
44
+ {data?.structuredContent && <p>{data.structuredContent.message}</p>}
45
+ {error && <p role="alert">{error.message}</p>}
46
+ </div>
43
47
  );
44
48
  }
45
49
 
46
- function GreetButton() {
47
- const [callTool, { data, loading }] = useCallTool('greet');
50
+ export function App() {
48
51
  return (
49
- <button onClick={() => callTool({ name: 'World' })} disabled={loading}>
50
- {data ? String(data) : 'Greet'}
51
- </button>
52
+ <FrontMcpProvider server={server}>
53
+ <Greeter />
54
+ </FrontMcpProvider>
52
55
  );
53
56
  }
54
57
  ```
55
58
 
56
- No need to install `@frontmcp/sdk` separately -- `@frontmcp/react` re-exports `create`, `connect`, decorators, and context classes.
57
-
58
- ## SDK Re-exports
59
-
60
- `@frontmcp/react` re-exports the most commonly used SDK symbols so you can use a single import:
61
-
62
- - **Factory**: `create`, `connect`, `connectOpenAI`, `connectClaude`, `connectVercelAI`
63
- - **Decorators**: `Tool`, `Resource`, `ResourceTemplate`, `Prompt`, `App`, `FrontMcp`, `Plugin`, `Adapter`
64
- - **Context Classes**: `ToolContext`, `ResourceContext`, `PromptContext`, `ExecutionContextBase`
65
- - **Protocol Types**: `CallToolResult`, `ReadResourceResult`, `GetPromptResult`, etc.
66
-
67
- ## Provider
59
+ Clicking the button shows `Hello, Ada!`. `useCallTool()` returns `[call, state, reset]`, and `data` is the MCP result the client got, so the tool's return value is in `data.structuredContent`. A tool that fails comes back as a result with `isError: true` in `data`; `error` is set only when the call couldn't be made, such as `FrontMCP not connected`. Decorators need `"experimentalDecorators": true` in `tsconfig.json`.
60
+
61
+ ### Entry points
62
+
63
+ | Import | What's in it |
64
+ | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
65
+ | `@frontmcp/react` | `FrontMcpProvider`, the hooks, the components, `mcpComponent`, `serverRegistry`, `DynamicRegistry` and `bindDynamicTools`, the store adapters, and the SDK re-exports listed above. |
66
+ | `@frontmcp/react/state` | `useStoreResource`, `useReduxResource`, `useValtioResource`: expose a store from inside a component. |
67
+ | `@frontmcp/react/api` | `useApiClient`, `parseOpenApiSpec`, `createFetchClient`: register OpenAPI operations as tools. |
68
+ | `@frontmcp/react/ai` | `useAITools`, `useTools`, `createToolCallHandler`: hand the server's tools to an AI SDK. |
69
+ | `@frontmcp/react/router` | `useRouterBridge`, `createRouterEntries`, and the `navigate`, `go_back` and `route://current` entries. Needs `react-router-dom` 7. |
70
+
71
+ ### `FrontMcpProvider`
72
+
73
+ | Prop | Default | Description |
74
+ | ----------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------- |
75
+ | `server` | | **Required.** The server from `create()`. |
76
+ | `name` | `"default"` | The server's name in `serverRegistry`, which hooks without a `server` option use. |
77
+ | `servers` | | More servers, by name. Hooks reach them with `{ server: 'name' }`. |
78
+ | `components` | | Components for `DynamicRenderer`, by URI, like `{ 'component://Card': Card }`. |
79
+ | `stores` | | Store adapters to expose as resources and tools ([Exposing app state](#exposing-app-state)). |
80
+ | `dynamicToolApps` | | The app that components' tools join, by server name. Only for a server with several apps. |
81
+ | `autoConnect` | `true` | Connect on mount. With `false`, call `connect()` from `useFrontMcp()`. |
82
+ | `onConnected` | | Called once the client is connected and the lists are loaded. |
83
+ | `onError` | | Called when connecting fails, and when the server refuses a tool a component registers. Without it, a refusal is a warning. |
84
+
85
+ ### Hooks
86
+
87
+ Every hook takes `{ server: 'name' }` to use one of the provider's other `servers`.
88
+
89
+ | Hook | Returns |
90
+ | ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
91
+ | `useFrontMcp(name?)` | `{ name, server, client, status, error, tools, resources, resourceTemplates, prompts, registry, connect }` |
92
+ | `useCallTool(name, options?)` | `[call, { data, loading, error, called }, reset]`. Options: `onSuccess`, `onError`, `resetOnToolChange`. |
93
+ | `useReadResource(uri, options?)` | Reads on mount: `{ data, loading, error, refetch }`. Without a URI, `[read, state]` to read on demand. |
94
+ | `useGetPrompt(name, options?)` | `[getPrompt, { data, loading, error }]` |
95
+ | `useListTools()`, `useListPrompts()` | The server's tools or prompts, kept current. |
96
+ | `useListResources()` | `{ resources, resourceTemplates }` |
97
+ | `useStoreResource(uri)` | `{ data, loading, error, refetch }` for a `state://` resource, read again whenever the server says it changed. |
98
+ | `useDynamicTool(options)` | Registers a tool while the component is mounted ([below](#giving-the-model-a-tool-from-a-component)). |
99
+ | `useDynamicResource(options)` | Registers a resource, `{ uri, name, description?, mimeType?, read }`, while the component is mounted. |
100
+ | `useComponentTree({ rootRef, uri?, ... })` | Registers a resource (`react://component-tree` by default) that describes the DOM under `rootRef`, named by each element's `data-component`. |
101
+
102
+ ### Giving the model a tool from a component
68
103
 
69
104
  ```tsx
70
- import { FrontMcpProvider } from '@frontmcp/react';
71
-
72
- <FrontMcpProvider server={server} autoConnect>
73
- <App />
74
- </FrontMcpProvider>;
105
+ import { useDynamicTool, z } from '@frontmcp/react';
106
+
107
+ export function Cart({ isLoggedIn }: { isLoggedIn: boolean }) {
108
+ useDynamicTool({
109
+ name: 'add_to_cart',
110
+ description: 'Add an item to the shopping cart',
111
+ schema: z.object({ itemId: z.string(), quantity: z.number().optional() }),
112
+ execute: async ({ itemId, quantity }) => {
113
+ addToCart(itemId, quantity ?? 1);
114
+ return { content: [{ type: 'text', text: 'Added to cart' }] };
115
+ },
116
+ enabled: isLoggedIn,
117
+ });
118
+
119
+ return <div>Cart</div>;
120
+ }
75
121
  ```
76
122
 
77
- The provider manages the MCP client lifecycle. It supports multi-server setups, `autoConnect`, and provider-level store adapters.
123
+ The input is checked against `schema` before `execute` runs, and `execute` gets it typed. A raw JSON Schema in `inputSchema` works too. The provider registers the tool with the server as a real tool, through `server.registerTool()`, so its calls run through the server's flow (plugin hooks, authorities, `availableWhen`) and every client sees it, an in-page agent through [`@frontmcp/plugin-webmcp`](https://www.npmjs.com/package/@frontmcp/plugin-webmcp) included. A name the server already has is refused and reported through the provider's `onError`.
78
124
 
79
- ## Agent Components
125
+ ### Letting a model show a component
80
126
 
81
- ### mcpComponent (Recommended)
82
-
83
- Type-safe factory that wraps a React component + zod schema into an MCP-registered component:
127
+ `mcpComponent()` wraps a component so that a model can show it: while it's mounted it registers a tool, and the tool's input, checked against `schema`, becomes the component's props.
84
128
 
85
129
  ```tsx
86
- import { z } from 'zod';
87
-
88
- import { mcpComponent } from '@frontmcp/react';
130
+ import { mcpComponent, z } from '@frontmcp/react';
89
131
 
90
- const WeatherCard = mcpComponent(
132
+ export const WeatherCard = mcpComponent(
91
133
  ({ city, temp }) => (
92
134
  <div>
93
135
  <h2>{city}</h2>
@@ -96,170 +138,151 @@ const WeatherCard = mcpComponent(
96
138
  ),
97
139
  {
98
140
  name: 'show_weather',
99
- description: 'Display weather data',
141
+ description: 'Show the weather for a city',
100
142
  schema: z.object({ city: z.string(), temp: z.number() }),
101
- fallback: <p>Loading...</p>,
143
+ fallback: <p>Waiting for weather data…</p>,
102
144
  },
103
145
  );
104
146
 
105
- // Use like a normal component
106
- <WeatherCard />;
147
+ // Render it like any component: <WeatherCard />
107
148
  ```
108
149
 
109
- ### Table Mode
110
-
111
- When `component` is `null` and `columns` is provided, renders a `<table>`:
150
+ Props you pass yourself, like `<WeatherCard city="Oslo" />`, render right away and are merged over the model's. Call `mcpComponent()` at module level, not inside a component. The first argument can also be a lazy import wrapped in `mcpLazy(() => import('./HeavyChart'))`, or `null` with a `columns` option for a plain table, where the tool takes `{ rows: [...] }`:
112
151
 
113
152
  ```tsx
114
- const OrderTable = mcpComponent(null, {
153
+ export const OrderTable = mcpComponent(null, {
115
154
  name: 'show_orders',
155
+ description: 'Show a list of orders',
116
156
  schema: z.object({ id: z.string(), product: z.string(), price: z.number() }),
117
157
  columns: [
118
158
  { key: 'id', header: 'Order ID' },
119
159
  { key: 'product', header: 'Product' },
120
- { key: 'price', header: 'Price', render: (v) => `$${v}` },
160
+ { key: 'price', header: 'Price', render: (value) => `$${value}` },
121
161
  ],
122
162
  });
123
163
  ```
124
164
 
125
- ## Hooks
165
+ ### Components
126
166
 
127
- ### Core Hooks
167
+ | Component | Description |
168
+ | -------------------------------------- | ---------------------------------------------------------------------------------------------- |
169
+ | `ToolForm` | A form generated from a tool's `inputSchema`. Unstyled, or your own fields with `renderField`. |
170
+ | `PromptForm` | A form generated from a prompt's arguments. |
171
+ | `ResourceViewer` | Shows a read result, `{ contents }`. |
172
+ | `OutputDisplay` | Shows a tool or prompt result as text or indented JSON. |
173
+ | `DynamicRenderer`, `ComponentRegistry` | Render a tree of `{ type, props?, children? }` nodes with components registered by URI. |
174
+ | `readDomById`, `readDomBySelector` | Read the page as a resource result, for a resource template. |
175
+ | `AgentContent`, `AgentSearch` | Deprecated: use `mcpComponent()`. |
128
176
 
129
- | Hook | Description |
130
- | --------------------------------- | ---------------------------------------------- |
131
- | `useCallTool(name, options?)` | Call an MCP tool with typed input/output |
132
- | `useReadResource(uri?, options?)` | Lazy or auto-fetch resource reading |
133
- | `useGetPrompt(name, options?)` | Fetch an MCP prompt by name |
134
- | `useListTools(options?)` | Reactive tool list from the registry |
135
- | `useListResources(options?)` | Reactive resource and template lists |
136
- | `useListPrompts(options?)` | Reactive prompt list |
137
- | `useStoreResource(uri, options?)` | Subscribe to `state://` URIs with live updates |
177
+ ### Exposing app state
138
178
 
139
- ### Dynamic Hooks
140
-
141
- | Hook | Description |
142
- | ----------------------------- | -------------------------------------------------------- |
143
- | `useDynamicTool(options)` | Register an MCP tool on mount, unregister on unmount |
144
- | `useDynamicResource(options)` | Register an MCP resource on mount, unregister on unmount |
145
- | `useComponentTree(options)` | Expose the DOM subtree under a ref as an MCP resource |
146
-
147
- All hooks accept `{ server: 'name' }` to target a specific server in multi-server setups.
148
-
149
- ### useDynamicTool with Zod
179
+ Each adapter in the provider's `stores` becomes a resource with the whole state (`state://<name>`), a resource per selector (`state://<name>/<selector>`) and a tool per action (`<name>_<action>`):
150
180
 
151
181
  ```tsx
152
- import { z } from 'zod';
153
-
154
- useDynamicTool({
155
- name: 'add_to_cart',
156
- description: 'Add item to shopping cart',
157
- schema: z.object({
158
- itemId: z.string(),
159
- quantity: z.number().optional(),
160
- }),
161
- execute: async (args) => {
162
- // args is typed as { itemId: string; quantity?: number }
163
- addToCart(args.itemId, args.quantity ?? 1);
164
- return { content: [{ type: 'text', text: 'Added to cart' }] };
165
- },
166
- enabled: isLoggedIn,
167
- });
168
- ```
169
-
170
- Also supports raw JSON Schema via `inputSchema` for backward compatibility.
182
+ import { createStore, FrontMcpProvider, reduxStore, valtioStore } from '@frontmcp/react';
171
183
 
172
- The provider registers each dynamic tool with the server as a real tool (`server.registerTool()`), so it runs through the server's flows (plugin hooks, authorities, `availableWhen`) and every client sees it — including in-browser agents through `@frontmcp/plugin-webmcp`. A name a server tool already has is reported through the provider's `onError` instead of shadowing that tool. On a server with several apps, say which app dynamic tools join with the provider's `dynamicToolApps` (by server name) or a tool's own `app` option.
184
+ const stores = [
185
+ reduxStore({
186
+ store: todoStore,
187
+ selectors: { todos: (state) => (state as { todos: unknown[] }).todos },
188
+ actions: { addTodo: (text) => ({ type: 'todos/add', text }) },
189
+ }),
190
+ valtioStore({ proxy: settings, subscribe, paths: { userName: 'user.name' } }),
191
+ createStore({ name: 'counter', getState: getCounter, subscribe: onCounterChange }),
192
+ ];
173
193
 
174
- ## State Management
194
+ export function Root() {
195
+ return (
196
+ <FrontMcpProvider server={server} stores={stores}>
197
+ <App />
198
+ </FrontMcpProvider>
199
+ );
200
+ }
201
+ ```
175
202
 
176
- `@frontmcp/react/state` exposes your application state as MCP resources and actions as tools.
203
+ `reduxStore` names its store `redux` unless you pass `name`, and dispatches what each action creator returns. `valtioStore` defaults to `valtio`; pass it `subscribe` from `valtio/utils`. Keep the `stores` array outside the component. To expose a store only while a component is mounted, use the hooks from `@frontmcp/react/state` with the same options: `useReduxResource()`, `useValtioResource()`, and `useStoreResource()`, which takes `createStore()`'s options. That `useStoreResource()` registers a store; the one from `@frontmcp/react` reads a `state://` resource.
177
204
 
178
- ### Hook-based (inside components)
205
+ ### Registering API operations as tools
179
206
 
180
207
  ```tsx
181
- import { useReduxResource, useValtioResource } from '@frontmcp/react/state';
208
+ import { createFetchClient, parseOpenApiSpec, useApiClient } from '@frontmcp/react/api';
182
209
 
183
- useReduxResource({
184
- store: reduxStore,
185
- selectors: { todos: (s) => s.todos },
186
- actions: { addTodo: (text) => ({ type: 'ADD_TODO', payload: text }) },
187
- });
210
+ const operations = parseOpenApiSpec(openApiDocument);
211
+ const client = createFetchClient();
212
+
213
+ export function ApiTools() {
214
+ useApiClient({ baseUrl: 'https://api.example.com', operations, client });
215
+ return null;
216
+ }
188
217
  ```
189
218
 
190
- ### Provider-level Store Adapters
219
+ Each operation becomes a tool named `api_<operationId>` (set `prefix` to change `api`). `client` takes any `HttpClient`, an object with `request({ method, url, headers, body? })`, so you can use axios or a client that adds auth headers.
191
220
 
192
- Register stores directly on `FrontMcpProvider` without hooks:
221
+ ### Handing the tools to an AI SDK
193
222
 
194
223
  ```tsx
195
- import { createStore, FrontMcpProvider, reduxStore, valtioStore } from '@frontmcp/react';
224
+ import { useAITools } from '@frontmcp/react/ai';
196
225
 
197
- <FrontMcpProvider
198
- server={server}
199
- stores={[
200
- reduxStore({
201
- store,
202
- selectors: { count: (s) => s.count },
203
- actions: { inc: () => increment() },
204
- }),
205
- valtioStore({
206
- proxy,
207
- subscribe,
208
- paths: { userName: 'user.name' },
209
- }),
210
- createStore({
211
- name: 'custom',
212
- getState,
213
- subscribe: customSubscribe,
214
- }),
215
- ]}
216
- >
217
- <App />
218
- </FrontMcpProvider>;
226
+ export function useOpenAITools() {
227
+ const { tools, callTool, loading } = useAITools('openai');
228
+ return { tools, callTool, ready: !loading && tools !== null };
229
+ }
219
230
  ```
220
231
 
221
- ## API Client
232
+ `tools` is the server's tool list, components' tools included, in the platform's format; `callTool(name, args)` runs a tool and converts its result. `useAITools()` takes `"openai"`, `"claude"`, `"langchain"`, `"vercel-ai"` or `"raw"`. `useTools(platform)`, for `"openai"`, `"claude"` or `"vercel-ai"`, returns `processToolCalls(calls)` instead, which runs a batch of the model's tool calls and returns the messages to send back. Outside React, `createToolCallHandler(server, platform)` gives you the same `callTool`. Keep API keys on a server of your own.
233
+
234
+ ### Letting a model move around the app
222
235
 
223
- `@frontmcp/react/api` registers OpenAPI operations as MCP tools with a pluggable HTTP client.
236
+ Put the router entries into the server, and call `useRouterBridge()` in a component inside both the router and the provider:
224
237
 
225
238
  ```tsx
226
- import { createFetchClient, parseOpenApiSpec, useApiClient } from '@frontmcp/react/api';
239
+ import { BrowserRouter, Route, Routes } from 'react-router-dom';
227
240
 
228
- useApiClient({
229
- baseUrl: 'https://api.example.com',
230
- operations: parseOpenApiSpec(spec),
231
- client: createFetchClient(),
232
- });
241
+ import { create, FrontMcpProvider } from '@frontmcp/react';
242
+ import { createRouterEntries, useRouterBridge } from '@frontmcp/react/router';
243
+
244
+ const { tools, resources } = createRouterEntries();
245
+ const server = await create({ info: { name: 'my-app', version: '1.0.0' }, tools, resources });
246
+
247
+ function RouterBridge() {
248
+ useRouterBridge();
249
+ return null;
250
+ }
251
+
252
+ export function App() {
253
+ return (
254
+ <BrowserRouter>
255
+ <FrontMcpProvider server={server}>
256
+ <RouterBridge />
257
+ <Routes>
258
+ <Route path="/home" element={<h1>Home</h1>} />
259
+ <Route path="/settings" element={<h1>Settings</h1>} />
260
+ </Routes>
261
+ </FrontMcpProvider>
262
+ </BrowserRouter>
263
+ );
264
+ }
233
265
  ```
234
266
 
235
- ## Components
267
+ The server then has the `navigate` tool (`{ path, replace? }`), the `go_back` tool and the `route://current` resource. `useRouterBridge()` only connects React Router to them; without it mounted, they answer `Router bridge not connected`.
236
268
 
237
- | Component | Description |
238
- | ------------------- | ---------------------------------------------------- |
239
- | `ToolForm` | Auto-generates forms from tool `inputSchema` |
240
- | `PromptForm` | Generates forms from prompt arguments |
241
- | `ResourceViewer` | Displays `ReadResourceResult` contents |
242
- | `OutputDisplay` | Renders tool/prompt output as formatted JSON or text |
243
- | `DynamicRenderer` | Recursively renders `ComponentNode` trees |
244
- | `ComponentRegistry` | Maps URI protocols to React components |
269
+ ## Docs
245
270
 
246
- ## Router Integration
271
+ - [`@frontmcp/react` reference](https://frontmcp.dev/reference/react): the provider, `serverRegistry`, stores, running in a browser, testing in Node
272
+ - [React hooks](https://frontmcp.dev/reference/react/hooks): every hook, including `/state`, `/api` and `/ai`
273
+ - [React components](https://frontmcp.dev/reference/react/components): `mcpComponent()`, forms, `DynamicRenderer`, DOM resources, router tools
274
+ - [`create()`](https://frontmcp.dev/reference/sdk/create): building the server the provider connects to
247
275
 
248
- ```tsx
249
- import { useRouterBridge } from '@frontmcp/react/router';
276
+ ## Related packages
250
277
 
251
- function App() {
252
- useRouterBridge(); // Registers NavigateTool, GoBackTool, CurrentRouteResource
253
- return <Outlet />;
254
- }
255
- ```
278
+ - [`@frontmcp/sdk`](https://www.npmjs.com/package/@frontmcp/sdk): the server framework; `create()`, tools, resources and prompts come from it.
279
+ - [`@frontmcp/plugin-webmcp`](https://www.npmjs.com/package/@frontmcp/plugin-webmcp): offers the server's tools, components' tools included, to in-browser agents.
280
+ - [`@frontmcp/ui`](https://www.npmjs.com/package/@frontmcp/ui): React components and hooks for widgets that render inside an AI host.
256
281
 
257
- ## AI Integration
282
+ ## Contributing
258
283
 
259
- ```tsx
260
- import { createToolCallHandler, useAITools, useTools } from '@frontmcp/react/ai';
261
- ```
284
+ Source: [`libs/react`](https://github.com/agentfront/frontmcp/tree/main/libs/react). Issues and pull requests are welcome; see [CONTRIBUTING.md](https://github.com/agentfront/frontmcp/blob/main/CONTRIBUTING.md).
262
285
 
263
286
  ## License
264
287
 
265
- Apache-2.0
288
+ Apache-2.0. See [LICENSE](https://github.com/agentfront/frontmcp/blob/main/LICENSE).
package/esm/package.json CHANGED
@@ -1,25 +1,28 @@
1
1
  {
2
2
  "name": "@frontmcp/react",
3
- "version": "1.9.6",
4
- "description": "React hooks, components, and AI SDK integration for FrontMCP",
3
+ "version": "1.9.7",
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",
7
7
  "license": "Apache-2.0",
8
8
  "keywords": [
9
+ "frontmcp",
9
10
  "mcp",
11
+ "model-context-protocol",
10
12
  "react",
11
13
  "hooks",
14
+ "agent",
15
+ "webmcp",
12
16
  "ai",
13
- "tools",
14
17
  "openai",
15
18
  "claude",
16
19
  "vercel-ai",
17
- "agentfront",
18
- "frontmcp"
20
+ "agentfront"
19
21
  ],
20
22
  "repository": {
21
23
  "type": "git",
22
- "url": "git+https://github.com/agentfront/frontmcp.git"
24
+ "url": "git+https://github.com/agentfront/frontmcp.git",
25
+ "directory": "libs/react"
23
26
  },
24
27
  "bugs": {
25
28
  "url": "https://github.com/agentfront/frontmcp/issues"
@@ -86,9 +89,9 @@
86
89
  "node": ">=24.0.0"
87
90
  },
88
91
  "peerDependencies": {
89
- "@frontmcp/lazy-zod": "1.9.6",
90
- "@frontmcp/sdk": "1.9.6",
91
- "@frontmcp/utils": "1.9.6",
92
+ "@frontmcp/lazy-zod": "1.9.7",
93
+ "@frontmcp/sdk": "1.9.7",
94
+ "@frontmcp/utils": "1.9.7",
92
95
  "react": "^18.0.0 || ^19.0.0",
93
96
  "react-dom": "^18.0.0 || ^19.0.0",
94
97
  "react-router-dom": "^7.0.0"
@@ -102,8 +105,8 @@
102
105
  }
103
106
  },
104
107
  "dependencies": {
105
- "@frontmcp/sdk": "1.9.6",
106
- "@frontmcp/utils": "1.9.6"
108
+ "@frontmcp/sdk": "1.9.7",
109
+ "@frontmcp/utils": "1.9.7"
107
110
  },
108
111
  "devDependencies": {
109
112
  "typescript": "^5.9.3"
package/package.json CHANGED
@@ -1,25 +1,28 @@
1
1
  {
2
2
  "name": "@frontmcp/react",
3
- "version": "1.9.6",
4
- "description": "React hooks, components, and AI SDK integration for FrontMCP",
3
+ "version": "1.9.7",
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",
7
7
  "license": "Apache-2.0",
8
8
  "keywords": [
9
+ "frontmcp",
9
10
  "mcp",
11
+ "model-context-protocol",
10
12
  "react",
11
13
  "hooks",
14
+ "agent",
15
+ "webmcp",
12
16
  "ai",
13
- "tools",
14
17
  "openai",
15
18
  "claude",
16
19
  "vercel-ai",
17
- "agentfront",
18
- "frontmcp"
20
+ "agentfront"
19
21
  ],
20
22
  "repository": {
21
23
  "type": "git",
22
- "url": "git+https://github.com/agentfront/frontmcp.git"
24
+ "url": "git+https://github.com/agentfront/frontmcp.git",
25
+ "directory": "libs/react"
23
26
  },
24
27
  "bugs": {
25
28
  "url": "https://github.com/agentfront/frontmcp/issues"
@@ -86,9 +89,9 @@
86
89
  "node": ">=24.0.0"
87
90
  },
88
91
  "peerDependencies": {
89
- "@frontmcp/lazy-zod": "1.9.6",
90
- "@frontmcp/sdk": "1.9.6",
91
- "@frontmcp/utils": "1.9.6",
92
+ "@frontmcp/lazy-zod": "1.9.7",
93
+ "@frontmcp/sdk": "1.9.7",
94
+ "@frontmcp/utils": "1.9.7",
92
95
  "react": "^18.0.0 || ^19.0.0",
93
96
  "react-dom": "^18.0.0 || ^19.0.0",
94
97
  "react-router-dom": "^7.0.0"
@@ -102,8 +105,8 @@
102
105
  }
103
106
  },
104
107
  "dependencies": {
105
- "@frontmcp/sdk": "1.9.6",
106
- "@frontmcp/utils": "1.9.6"
108
+ "@frontmcp/sdk": "1.9.7",
109
+ "@frontmcp/utils": "1.9.7"
107
110
  },
108
111
  "devDependencies": {
109
112
  "typescript": "^5.9.3"