KJDRAW / MCP INTEGRATION
MCP integration
Expose bounded CAD reads and reviewable proposals to an MCP client without giving the model file or approval authority.
Start a local stdio server
The MCP executable is included in the published 1.0.0-rc.4 package on npm's next channel. Verify the exact version before installing so later channel moves do not change your setup:
npm view @kanjieteam/kjdraw@1.0.0-rc.4 version
If your registry mirror does not return 1.0.0-rc.4, wait for it to synchronize or follow the source-checkout installation. Install the pinned version in a host-owned Node.js 22+ project:
npm install @kanjieteam/kjdraw@1.0.0-rc.4
node node_modules/@kanjieteam/kjdraw/bin/kjdraw-mcp.mjs --check-tool-schemas
Create empty proposals and results directories, then start the verified executable with absolute host-selected paths:
node /absolute/project/node_modules/@kanjieteam/kjdraw/bin/kjdraw-mcp.mjs --workspace /absolute/project --blank drawing.kjd --units millimeter --proposal-dir proposals --candidate-dir results
Use --input drawing.kjd or --input drawing.dxf instead of --blank to inspect an existing drawing. Relative drawing and output paths are resolved inside --workspace; the server rejects path escapes, symbolic-link traversal and conflicting output files. --candidate-dir is an explicit host policy that lets exact create proposals produce new KJD, DXF and SVG candidates. It does not let the model choose a path or overwrite the input.
For a persistent desktop-client connection, use the absolute installed script path in the client's stdio configuration instead of relying on a temporary package-manager cache. The AI client installer performs a safe user-level merge for supported clients.
Configure an MCP client
To see the protocol from a real host process before editing desktop-client configuration, run the maintained TypeScript MCP client starter. It performs initialize, tool discovery and a reviewable circle proposal against the packaged stdio server.
The exact outer configuration key varies by client. The server entry itself has this shape; replace every placeholder with a real absolute path selected by the host:
{
"command": "node",
"args": [
"/absolute/project/node_modules/@kanjieteam/kjdraw/bin/kjdraw-mcp.mjs",
"--workspace", "/absolute/project",
"--blank", "drawing.kjd",
"--units", "millimeter",
"--proposal-dir", "proposals",
"--candidate-dir", "results"
]
}
Restart the client after saving its configuration. Ask Use KJDraw to draw a circle with a 5 mm radius. A successful create flow calls a KJDraw proposal tool and reports a candidate-ready result with new candidate paths. The original host drawing remains unchanged.
Inspect one tool call
MCP clients perform this JSON-RPC exchange. It is useful for understanding logs and building a test harness; an end user does not type it into chat:
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"host-test","version":"1"}}}
{"jsonrpc":"2.0","method":"notifications/initialized"}
{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"cad_propose_circles","arguments":{"expectedRevision":0,"units":"millimeter","circles":[{"center":{"x":20,"y":20},"radius":5}]}}}
The proposal response has status: "awaiting-host-approval"; with the candidate-directory policy, the server can additionally materialize the exact create proposal as a new candidate set. There is no MCP approve, save, open or arbitrary-command tool. A trusted host owns review, authentication and any later mutation of an existing drawing.
Verify the boundary
Check all of these before treating a client as connected:
tools/listcontains KJDraw tools such ascad_read_drawingandcad_propose_circles.- The call uses the current drawing revision and canonical drawing units.
- The response contains structured proposal geometry, not only model prose.
- A create flow writes new candidates only under the host-selected directory.
- The input KJD or DXF bytes and revision remain unchanged until a trusted host applies an approved operation.
Run node node_modules/@kanjieteam/kjdraw/bin/kjdraw-mcp.mjs --check-tool-schemas to validate both supported unit profiles without starting a client. Continue with Agent workflows for proposal previews and approval handling, or Connect your model for direct provider adapters.