CADCraft
Operate CADCraft through its structured automation interface. Preserve the user's requested drafting workflow and target drawing.
Protocol reference
Read the relevant sections of references/control-protocol.md before constructing calls. This is the downloaded upstream protocol, captured on 2026-11-02.
Useful sections: the
method table (top of the document),
Panel docking,
Command-line replies, and
Interface language. Relative links inside the downloaded document (e.g.
) refer to upstream documentation; resolve them against
https://github.com/storytold/cadcraft/blob/main/docs/
when needed. The document is short and does not list individual drawing commands: discover them at runtime with
instead of inventing command IDs or parameters.
Locate the executables
and
may not be on
even when CADCraft is installed. Discover them before assuming anything is missing, and never invent a path — search for it:
- PATH:
command -v cadcraft cadcraft-cli
(POSIX) or where cadcraft cadcraft-cli
(Windows).
- macOS: look for in and , or run
mdfind -name CADCraft.app
; the binary inside is the desktop app.
- Linux / Windows: check the usual install locations and the target of any desktop or Start-Menu shortcut.
- missing is not a blocker. The control port speaks plain line-delimited JSON over loopback TCP and needs no bridge: send one request per line, e.g.
{"id":1,"method":"cmdline.input","params":{"text":"circle 0,0 5"}}
, and match replies by and . A short script in any language covers every method.
Select the session
- For a user's open drawing or visible application, use an existing CADCraft MCP bridge or control session. A headless session has its own in-process drawings and cannot edit the user's live window.
- For unattended processing of files, use headless MCP ().
- Discover available CADCraft tools and installed executables first. If the required connection or executable is missing, report the concrete prerequisite; creating this skill does not install CADCraft or register an MCP server.
Start a desktop session with
(or
CADCRAFT_CONTROL_PORT=PORT
); it listens on
. Bridge it with:
sh
cadcraft-cli mcp --connect 127.0.0.1:PORT
Reuse a running session when possible and keep TCP on loopback. The upstream protocol documents no authentication handshake or file-access roots; if the installed version requires a token or roots, follow its
output rather than guessing.
Use
to point the app at a private, isolated profile for automation (an explicitly empty value disables workspace reads and writes). Do not edit the user's
directly.
Inspect, edit, and verify
Inspect before editing:
for counts, extents, layers, styles, blocks, layouts, selection, and undo state;
for the UI state, active view, and any pending "Save changes?" prompt (
);
for the current prompt. The app may restore or already hold drawings you did not create.
Two ways to edit:
- Command line — behaves exactly like a user typing: it starts commands by name or alias and answers prompts (points , relative , polar , distances, keywords, empty = Enter). Spaces act as Enter except at text prompts. runs a multi-line script; sends Enter or Escape. Always return the command line to the idle prompt (Escape) before the next unrelated operation.
- Engine commands —
engine.execute {command, params}
runs any command with JSON parameters and never opens a dialog. Look up IDs, parameter docs, and enablement via .
A refused command-line entry (unknown command, invalid input) still replies
;
always check the field and
of the reply.
without a string
fails with
.
Use
only when interactive menu behavior is intended.
defaults to world coordinates;
,
, and
use screen points and reach every widget.
only queues key events — poll
or
for the resulting focus or state before the next action. Use
(exact-match filters on
,
,
) to find controls instead of guessing coordinates.
Panel layout (
,
, panel IDs
,
,
,
; the
is protected) is invoked through
and does not edit document contents. Change layout, theme, or interface language only when the task requires it.
Verify visually and structurally: re-run
(entities carry handles and geometry) and render with
— a headless render that frames the whole drawing by default (
keeps the current view) and returns
, or pass
.
captures the app window and needs a presented frame.
File access and output
- Desktop control: / / .
- Save output as DXF or DWG: with and … set what Save As suggests for new drawings; also accepts and directly.
- Report successful saves and the exact output path and format/version. Do not overwrite the user's source drawing unless asked; save a copy under a new name.
Timeouts and uncertain outcomes
The server waits up to 60 s for the app to answer. A timeout reply carries
:
- — the request was cancelled and will never run; resending is safe.
- — the app had already started it and may still change the drawing (its late result is discarded). Inspect with before resending any mutation.
After a disconnect or any other unclear failure, inspect drawing and undo state before retrying. Stop and report unresolved state if inspection cannot determine whether replay is safe.