Skip to main content
Glama
jonjoe

state-bridge-mcp

by jonjoe

state-bridge-mcp

MCP server + client SDK for bridging Zustand stores over WebSocket. Lets any MCP-capable AI inspect and manipulate your app's live state.

How it works

┌─────────────┐   WebSocket   ┌──────────────┐   stdio   ┌──────────┐
│  Your App   │──────────────▶│  MCP Server  │◀─────────▶│  Claude  │
│  (client)   │◀──────────────│  (server)    │           │          │
└─────────────┘               └──────────────┘           └──────────┘

The server runs as an MCP server (launched by Claude, Cursor, etc.) and opens a WebSocket port. Your app connects as a client and exposes its Zustand stores. The AI can then list stores, read state, write state, and call actions.

Related MCP server: redux-mcp

Installation

npm install state-bridge-mcp

Server Setup

Add to your .mcp.json (or equivalent MCP config):

{
  "mcpServers": {
    "app-state": {
      "command": "npx",
      "args": ["state-bridge-mcp"]
    }
  }
}

Custom port

{
  "mcpServers": {
    "app-state": {
      "command": "npx",
      "args": ["state-bridge-mcp", "--port", "9000"]
    }
  }
}

Or via environment variable: STATE_BRIDGE_PORT=9000

Default port: 8098

Client Usage

import { createStateBridge } from 'state-bridge-mcp/client';
import { useSessionStore, useAppStore } from './store';

const bridge = createStateBridge({
  stores: {
    session: useSessionStore,
    app: useAppStore,
  },
  url: 'ws://localhost:8098',
});

// Later, to tear down:
bridge.stop();

React Native (Android emulator)

For Android emulator, use 10.0.2.2 to reach the host machine:

const bridge = createStateBridge({
  stores: { session: useSessionStore, app: useAppStore },
  url: 'ws://10.0.2.2:8098',
});

Client Config

Option

Type

Default

Description

stores

Record<string, StoreEntry>

required

Named map of Zustand stores

url

string

ws://localhost:8098

WebSocket URL of the MCP server

reconnectInterval

number

3000

Auto-reconnect interval in ms. 0 to disable.

onConnect

() => void

Called when WebSocket opens

onDisconnect

() => void

Called when WebSocket closes

MCP Tools

Once connected, the AI has access to these tools:

Tool

Description

connection_status

Check if a client app is connected

list_stores

List all stores and their top-level state keys

get_state

Read state from a store (supports dot-paths like settings.theme)

set_state

Write a value at a dot-path (supports arbitrary depth)

call_action

Invoke a store action function by name

Store Compatibility

Any object with getState() and setState() works. Zustand stores satisfy this out of the box:

type StoreEntry = {
  getState: () => Record<string, unknown>;
  setState: (partial: Record<string, unknown>) => void;
};

License

MIT

Available Tools

5 tools
call_actionB

Invoke a store action function by name (e.g. "clearHistory", "setActiveTab")

ParametersJSON Schema
NameRequiredDescriptionDefault
argsNoArguments to pass to the action
storeYesStore name
actionYesAction function name

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description only mentions 'invoke', which implies execution but does not disclose side effects, return values, or potential destructive behavior. With no annotations, the agent has no clues about read-only or mutation nature, leaving significant behavioral uncertainty.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The single-sentence description is concise and front-loaded with the key purpose. It is efficient but could expand slightly without becoming verbose, e.g., by noting return behavior.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with three string parameters and no nested objects or output schema, the description covers the basic function. However, it omits important context like error handling, return value (e.g., result or void), and when to choose this over sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema descriptions cover all 3 parameters (store, action, args) with basic labels. The description adds example action names, providing slight extra context. However, the overall parameter semantics are minimal and rely heavily on the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool invokes a store action function by name, with specific examples like 'clearHistory' and 'setActiveTab'. This distinguishes it from sibling tools like get_state (read-only) and set_state (direct value mutation).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives. For instance, it does not clarify when to use call_action over set_state for state changes, or if certain actions are reserved. Absence of usage context forces the agent to guess.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

connection_statusB

Check if a client app is connected via WebSocket

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It only says it is a check (read), but does not disclose what happens if not connected, side effects, or response format. More detail is needed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that front-loads the purpose. Every word is necessary and there is no wasted space.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, so the description should explain the return value or behavior. It does not, leaving the agent uncertain about what the tool returns upon invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist, so baseline 4 applies. The description adds nothing beyond the schema, but none is needed since there are no parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it checks if a client app is connected via WebSocket, with a specific verb and resource. It distinguishes itself from sibling tools like call_action or set_state which perform different operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is given on when to use this tool versus alternatives. The description only states what it does, not when to prefer it over other tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_stateA

Read state from a Zustand store. Optionally provide a dot-path to read a specific slice.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathNoDot-path to a specific value (e.g. "activeSessionId")
storeYesStore name (e.g. "app", "session")

TDQS

A3.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full behavioral burden. It only states reading state, but does not disclose error handling (e.g., store not found), return format, or side effects. It is minimally transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise (one sentence) and front-loaded with the core action. Every word is functional with no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read tool with two parameters and no output schema, the description is complete enough. It could mention the return value format (e.g., full state object if no path), but this is minor given the tool's simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds context beyond the schema by explaining that 'path' allows reading a specific slice and that it is optional. Schema coverage is 100%, but the description reinforces and clarifies parameter usage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it reads state from a Zustand store, with optional dot-path for specific slices. It distinguishes from siblings like 'set_state' (write) and 'list_stores' (list stores), making its purpose precise.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for reading state, but provides no explicit guidance on when to use this tool versus alternatives (e.g., 'list_stores' for store names). No when-not-to-use or prerequisite information.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_storesA

List all Zustand stores and their top-level state keys

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral transparency. It indicates the tool is read-only and returns data, but does not disclose potential traits like pagination, performance impact, or authorization requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no redundant information. Every word is essential for communicating purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (no parameters, no output schema), the description adequately covers purpose and basic behavior. It lacks details on output format but is sufficient for basic invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so the description does not need to add parameter meaning. The baseline is 4 per guidelines.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool lists all Zustand stores and their top-level state keys, using a specific verb ('List') and resource ('Zustand stores'), and it distinguishes from sibling tools like 'get_state' which likely focuses on individual stores.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for listing stores, but provides no explicit guidance on when to use this tool versus alternatives such as 'get_state' or 'call_action'. No when-not or context is given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

set_stateA

Write a value to a Zustand store at the given path

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesDot-path to set (e.g. "settings.theme")
storeYesStore name
valueNoValue to set

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions 'Write' implying mutation, but does not disclose whether values are merged or overwritten, required permissions, error handling, or side effects. This is insufficient for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single concise sentence of 13 words that directly states the tool's purpose. No redundant information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple set operation with 3 parameters and no output schema, the description covers the basic purpose. However, it lacks context on behavior (merge vs overwrite), error scenarios, or requirements for store existence, leaving gaps for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with descriptions for all three parameters. The description adds no further semantics beyond 'Write a value to a Zustand store at the given path', which does not clarify parameter constraints or formatting beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Write', the resource 'Zustand store', and the mechanism 'at the given path'. It distinguishes from sibling tools like get_state (read) and call_action (invoke) by explicitly indicating a write operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for setting state values, but lacks explicit guidance on when to use this tool versus alternatives, no prerequisites mentioned, and no when-not conditions. The context from sibling names helps, but the tool definition does not provide direct guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updatesv1.0.0
    • First observedcall_action
    • First observedconnection_status
    • First observedget_state
    • First observedlist_stores
    • First observedset_state

TDQS

A3.8/5.0
Disambiguation5/5

Each tool addresses a distinct concern: actions, connections, reading state, listing stores, and writing state. No overlap or ambiguity between tools.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern in snake_case (e.g., get_state, list_stores), making them predictable and easy to understand.

Tool Count5/5

With 5 tools, the set is well-scoped for a state management bridge, covering all essential operations without unnecessary bloat.

Completeness4/5

The tools cover core state operations (list, get, set, actions) and a connection check. Missing subscription or store creation, but these are minor gaps for the intended purpose.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jonjoe/mcp-state-bridge'

If you have feedback or need assistance with the MCP directory API, please join our Discord server