Expand description
MCP server so AI agents (Claude Code etc.) can co-edit live: Streamable HTTP transport (JSON-RPC 2.0
over HTTP POST /mcp on 127.0.0.1:initialize, ping, tools/list, tools/call,
resources/list, resources/read (project json, style summary, notes) and answers JSON
(no SSE stream needed for request/response). Tool calls are forwarded to the UI thread as ToolCalls
(the App executes them on the next frame against the live project, with undo, and replies through the
oneshot sender); ctx.request_repaint() wakes the UI. Tool definitions (names, descriptions, JSON schemas)
live in tools.rs — the App matches on the same names.
Connect from Claude Code: claude mcp add --transport http simple-editor http://127.0.0.1:7337/mcp
Modules§
- tools
- The MCP tool catalogue — the single source of truth for tool names/arguments.
mcp/mod.rsserves it (tools/listwith JSON schemas built fromARGS);ui/app.rsexecutes calls bynamewith exactly these arguments (unknown tool → error “unknown tool”). Keep both in sync with this table.
Structs§
- Server
- Tool
Call - One tool invocation forwarded to the UI thread; reply with Ok(result json) or Err(message).
Constants§
- CRC_
TABLE 🔒 - MAX_
BODY 🔒 - MAX_
CONNS 🔒 - READ_
TIMEOUT 🔒
Functions§
- adler32 🔒
- call_
tool 🔒 - Forward one tool call to the UI thread and wait for the reply.
- claude_
code_ command - The
claude mcp addcommand line shown in the settings UI. - crc32 🔒
- dispatch 🔒
- One JSON-RPC request → response (None for notifications).
- handle_
connection 🔒 - handle_
post 🔒 - Handle a POST body (single request or batch). None = nothing to send back (notifications only) → 202.
- origin_
ok 🔒 - png_
encode - Encode an RGBA frame as PNG (store-only zlib) for the
render.frametool. - rpc_err 🔒
- session_
id 🔒 - write_
chunk 🔒 - write_
response 🔒