How our local MCP server hooks AI engines directly into the visual workspace
Understanding the Model Context Protocol stdio transport layer and connecting external AI assistants to manipulate canvas files.
01Bridging the gap between LLM chat interfaces and UI canvases
AI assistants like Claude and Antigravity are great at writing code in a text box, but they are blind to the graphical user interface. They cannot click buttons, draw nodes, or inspect the layout coordinates of a canvas. If a user asks the AI to "insert a caching layer between my API and database," the AI needs a standardized channel to programmatically inspect the active nodes, calculate the new connections, and write back the coordinates. The Model Context Protocol (MCP) solves this by providing a unified bridge.
02How stdio and JSON-RPC power local tool execution
Our local MCP server operates as a lightweight process communicating via standard input/output (stdio). When an AI client wants to call a tool, it writes a structured JSON-RPC message to the server's stdin. The server parses the request, performs the operation (such as adding a component or running a layout calculation), and writes a JSON-RPC response back to stdout. This architecture is fast, highly secure (as it runs locally on the user's machine), and requires no external network gateways.
03Exposing diagram manipulation tools to the AI
The MCP server exposes specific tools to the AI client. These tools act as API endpoints for the canvas. The AI can call tools to query the current node positions, trigger layout repairs, apply templates, and insert components. When a tool is invoked, the server recalculates the graph structure, saves the new state to a local session file, and signals the web frontend to reload the workspace, allowing the AI to edit the diagram in real-time as you chat.
04Configuring desktop clients for local integration
Connecting an AI assistant is straightforward. Both Claude Desktop and Antigravity read local configuration files (like `claude_desktop_config.json` or `mcp_config.json`). The config defines a list of server processes, specifying the command (e.g., "node") and the absolute path to the compiled server file. Once loaded, the AI client automatically registers the tools and makes them available within the chat interface, enabling instant system design capabilities.