Skip to main content
DesignJS exposes a bidirectional Model Context Protocol (MCP) server that AI coding agents — Claude Code, Cursor, Codex, and any MCP-compatible client — connect to over stdio using JSON-RPC 2.0. Each tool call travels from your agent through the MCP server, across a local WebSocket bridge on 127.0.0.1:29170, and into the live GrapesJS canvas running in your browser. Responses follow the same path in reverse, arriving as JSON wrapped in MCP text content blocks.

How agents call tools

Every tool call is a standard MCP tools/call request. The arguments object maps directly to the tool’s input schema. Results are returned as a single text content block containing a JSON string — parse it to get the typed response object.
tool call example
tool result
All tool results are JSON-encoded strings inside the text content block. Your agent must parse the text field to access the structured response.

Transport

DesignJS uses the stdio transport defined by the MCP specification. The MCP server process (@designjs/mcp-server) is launched by your IDE or agent runner as a child process. Communication happens over the process’s stdin and stdout streams — no HTTP port is exposed by the MCP server itself (the WebSocket bridge on port 29170 is internal).

All 20+ tools

Tool categories

Read tools only observe the canvas state — they are safe to call at any time and produce no side effects. Use them to gather context before deciding what to change. Write tools mutate the canvas. Changes are reflected in the editor immediately and are persisted to .designjs.json (Cmd+S or 30-second autosave). All write operations are reversible through the editor’s undo history.

Data types

Two shared types appear across multiple tools. ComponentNode — the recursive node returned by get_tree: ArtboardData — returned by create_artboard and list_artboards: