Foldkit DevTools MCP

Inspect, replay and drive a running Foldkit app's Model and Message history from an AI agent

Official · Foldkit TypeScript Local · stdio Developer tools

88 popularity score ★ 1.2k ↓ 23k/wk

Connect your client

Local (npm)

Add in one click

Opens the app, which asks before it adds the server.

Or add it by command or config

Claude CodeTerminal
claude mcp add foldkit-devtools -- npx -y @foldkit/devtools-mcp
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "foldkit-devtools": {
      "command": "npx",
      "args": [
        "-y",
        "@foldkit/devtools-mcp"
      ]
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "foldkit-devtools": {
      "command": "npx",
      "args": [
        "-y",
        "@foldkit/devtools-mcp"
      ]
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "foldkit-devtools": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@foldkit/devtools-mcp"
      ]
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.foldkit-devtools]
command = "npx"
args = ["-y", "@foldkit/devtools-mcp"]
Gemini CLITerminal
gemini mcp add --scope user foldkit-devtools npx -- -y @foldkit/devtools-mcp

Settings 4

FOLDKIT_PROJECT_ROOT Optional: Project directory to look for a relay in; defaults to the working directory.
FOLDKIT_DEVTOOLS_MCP_PORT Optional: Skips discovery and connects to this port; must match devToolsMcpPort in the Vite config. Needed on Windows. Without it the server tries 9988 when discovery finds nothing.
FOLDKIT_DEVTOOLS_MCP_HOST Optional: Overrides the hostname of the discovered relay or configured port.
FOLDKIT_DEVTOOLS_RELAY_DIRECTORY Optional: Registry directory; defaults to one under XDG_RUNTIME_DIR or the OS temp directory. Set it in both processes if they run in different sandboxes.

What it does

Foldkit DevTools MCP (@foldkit/devtools-mcp) is the Foldkit project's own server for debugging Foldkit applications while they run in development. Foldkit apps hold their state in a single Model that changes only through Messages; this server gives an agent the same view of that state that the in-browser DevTools panel gives a person.

Through it an agent can read the current Model or the Model after any retained history entry, narrow a read to one path, list and count Messages by tag or by the Model paths they changed, diff two past Models, read what init produced, and step the app back to an earlier state and then resume. If the app passes its Message Schema to the DevTools config, the agent can also look up that Schema and dispatch Messages, one at a time or in batches of 1 to 100, each decoded against the Schema before it reaches update.

It works in three parts: a browser bridge inside the app, a relay served by the Foldkit Vite plugin on the dev server, and this Node process, which the agent starts over stdio. The server finds the relay for its project directory through a per-user registry and a random token, and reconnects if the dev server restarts. In the source (src/tools.ts), foldkit_list_messages returns 50 entries by default and accepts a limit of up to 500.

What it needs

RuntimeNode.js 18+

Node.js 18 or later and npx. A Foldkit application (peer dependencies foldkit 0.165.0 or later and effect 4.0.0) built with the @foldkit/vite-plugin, its Vite dev server running, and the app open in a browser tab. DevTools must stay enabled (the default in development). Dispatch needs the app's Message Schema passed in its DevTools config. On Windows, a fixed devToolsMcpPort in vite.config.ts and the same value in FOLDKIT_DEVTOOLS_MCP_PORT.

Limits

Works only with Foldkit applications, and only in development: production builds leave out the relay and the browser bridge. It sees a Runtime only while the app is open in a browser tab. Without the Message Schema in the DevTools config, both dispatch tools reject every request; inspection and replay still work. Batch dispatch takes 1 to 100 Messages and other Messages can land between them. foldkit_list_messages returns 50 entries by default, at most 500. On Windows automatic discovery is unavailable and a fixed port must be set. When several relays match the project, the most recently started one is used unless runtime_id or settings pick another.

Who it suits

Suits developers building a Foldkit app who want an agent to check what the app is actually doing (state, Message history, Commands and Mounts) rather than guess from the code, and to reproduce a bug by replaying or dispatching Messages. It is published by the Foldkit project and runs locally with no account. It is no use for apps built on other frameworks, nor for production debugging. For writing Foldkit code itself, the project points to its skills and vendored source as the companion references.

Tools 15

foldkit_list_runtimes
Lists connected browser tabs and the ids used to target one.
foldkit_get_model
Reads the current Model, optionally one path, summarized unless expand is set.
foldkit_get_model_at
Reads the Model as it stood after a given history entry.
foldkit_get_init
Reads the initial Model plus the Commands and Mounts from the first render.
foldkit_get_runtime_state
Reports history bounds, current index, pause state and whether init was recorded.
foldkit_list_messages
Lists retained Messages with paging, tail reads and changed-path filters.
foldkit_count_messages_by_tag
Counts retained Messages per tag, without payloads.
foldkit_diff_models
Shows the path-level differences between the Models at two history indices.
foldkit_get_message
Reads one history entry with its Commands, Mounts, changed paths and Submodel chain.
foldkit_list_keyframes
Lists the retained states that can be replayed.
foldkit_replay_to_keyframe
Moves the app back to a retained state and pauses it there.
foldkit_resume
Returns a replayed app to live execution.
foldkit_get_message_schema
Describes the app's Message Schema as JSON Schema, by variant.
foldkit_dispatch_message
Sends one Message into the app after checking it against the Schema.
foldkit_dispatch_messages
Sends an ordered batch of 1 to 100 Messages, rejected whole if any is invalid.

Similar servers