DevToolsServer
A local server that lets an agent inspect and control a running
effect/ui app over MCP, and shows its sessions on a page.
Pages that build DevTools.layer with the server's URL send it their
MessageLog as Wire frames on /log, and take requests on /control.
Any process can send frames to /log with MessageLog.socket, so a
server render shows up as a session too. Agents connect to /mcp, a
Streamable HTTP MCP endpoint.
The server holds an Inspector of its own, so the read tools answer from
its copy of the log: they keep working after the tab reloads or closes, and
cover server-rendered sessions. The control tools go to the page.
Open the server's URL to inspect the newest session and follow live updates.
This read-only page also supports terminal apps using DevToolsHeadless.layer.
| Tool | Does |
|---|---|
list_sessions |
the sessions held, whether each is connected, controllable and paused |
list_instances |
the instances of a session, with the state of their Command runs |
list_entries |
entry summaries with declared payload fields and optional field filtering |
count_entries |
entries by entry and message _tag |
get_entry |
one entry's Wire frame |
get_chain |
the causal chain of an entry |
get_state |
an instance's Model, props and query results, now or at an entry |
diff_state |
what an entry changed in its instance's Model |
show_entry |
paints the page as it was at an entry |
resume |
shows the live page again |
get_message_schema |
the JSON Schema of the messages an instance accepts, with an example of each |
dispatch |
sends messages to an instance, when dispatch is on |
wait |
waits for the Command runs started since an entry to end |
The page then needs the URL: DevTools.layer({ server: "http://127.0.0.1:4774" }).
The effect-ui-devtools bin runs the same server.
Example Running the server without Vite
import { NodeRuntime } from "@effect/platform-node"import { DevToolsServer } from "@effect/ui-devtools/node"import { Layer } from "effect"
NodeRuntime.runMain(Layer.launch(DevToolsServer.layer({ dispatch: true })))Constants
The port the server listens on unless told otherwise. It's fixed, so a project can commit the MCP entry that points at it.
Signature
declare const defaultPort: 4774Constructors
Layers
Serves the page, /mcp, /log, /control and /watch on 127.0.0.1
at port.
Details
It listens on loopback only, and has no option to listen elsewhere.
/mcp rejects requests that carry an Origin header, and the WebSocket
routes accept only loopback origins, so a web page cannot reach the tools
or pose as an app. There is no token: any local user can connect, as they
can to a Vite dev server.
A session is one mounted root, so a reload starts a new one. Tools that
take a session default to the newest connected one. A session can be
controlled while the tab that mounted it is open.
Signature
declare function layer(options?: Options): Layer<never, ServeError>