Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MCP Server

NullCad includes an in-process Model Context Protocol (MCP) server (HTTP+SSE), letting an AI agent read and create geometry in the currently open document.

How it works

The MCP server runs as a background tokio task inside the application. Mutations requested by an agent are funnelled back to the egui main thread via a channel, so they go through the same operation system as any other edit — every agent-driven change is undoable and recorded in the audit trail, exactly like Lua plugin edits or manual drawing.

Enabling the server

The MCP server’s settings (enable/disable, port) are available in the application settings and persist with the document.

Connecting an agent

Once enabled, point an MCP-compatible client at the server’s HTTP+SSE endpoint to give an agent access to:

  • Reading document info, layers, and geometry.
  • Creating and modifying geometry (points, lines, polylines, polygons, circles, arcs, rectangles, text).
  • Reading and changing the current selection.

The tool surface mirrors the Lua plugin API’s ctx methods (see Lua Plugins) — both are implemented against the same underlying operation builders (mcp/tools.rs), so behavior (units, coordinate conventions, rotation direction) is consistent between the two integration paths.

Why in-process?

Running the MCP server inside the application (rather than as a separate process talking to a file) means an agent is always working against the live, in-memory document state — including unsaved changes — and its edits appear immediately in the UI, just like a human’s.