State Bridge
FreeNot checkedBridges Zustand stores over WebSocket, enabling MCP-capable AI to inspect and manipulate live application state.
About
Bridges Zustand stores over WebSocket, enabling MCP-capable AI to inspect and manipulate live application state.
README
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.
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
Install State Bridge in Claude Desktop, Claude Code & Cursor
unyly install state-bridge-mcpInstalls into Claude Desktop, Claude Code, Cursor & VS Code — handles npx, uvx and build-from-source repos for you.
First time? Get the CLI: curl -fsSL https://unyly.org/install | sh
Or configure manually
Run in your terminal:
claude mcp add state-bridge-mcp -- npx -y github:jonjoe/mcp-state-bridgeFAQ
Is State Bridge MCP free?
Yes, State Bridge MCP is free — one-click install via Unyly at no cost.
Does State Bridge need an API key?
No, State Bridge runs without API keys or environment variables.
Is State Bridge hosted or self-hosted?
A hosted option is available: Unyly runs the server in the cloud, no local setup required.
How do I install State Bridge in Claude Desktop, Claude Code or Cursor?
Open State Bridge on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
by modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
by xuzexin-hzCompare State Bridge with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All ai MCPs
