Skip to main content
@frontmcp/react/state bridges your application state with MCP. State slices become MCP resources that agents can read, and actions become MCP tools that agents can call.

useStoreResource

The generic hook that works with any state management library. useReduxResource and useValtioResource are thin wrappers around it.

What Gets Registered

Options

Live Updates

When the store changes, the main resource’s read function automatically returns fresh state. The hook subscribes to your store and notifies the DynamicRegistry on every change so consumers re-read the latest value.

useReduxResource

A thin wrapper for Redux stores. Automatically binds getState, subscribe, and wraps action creators to auto-dispatch.

Options


useValtioResource

A thin wrapper for Valtio proxies. Supports deep path selectors with dot notation.

Options

You must pass valtio’s subscribe function yourself since valtio is an optional peer dependency. Import it from valtio/utils.

Provider-Level Store Adapters

Instead of using hooks inside components, you can register stores directly on the FrontMcpProvider via the stores prop. This is useful when you want store registration to happen once at the top level.

reduxStore

Adapter factory for Redux stores. Wraps action creators to auto-dispatch.

valtioStore

Adapter factory for Valtio proxies. Supports deep path selectors.

createStore

Generic pass-through adapter for any custom store.

StoreAdapter Interface

All adapter factories return a StoreAdapter:
You can also create a StoreAdapter directly without using a factory.