Letting AI Write Code Against Your Drawings: The mlightcad MCP Server
Description and use
AI is given a unified scripting API to write JavaScript for CAD drawings, eliminating tool sprawl and successfully handling BOM extraction, title block parsing, and sheet splitting.
Problem
Providing AI with a vast set of discrete CAD tools leads to tool‑sprawl and limits flexibility for complex drawing tasks.
Outcome
All three tested drawing‑processing tasks—BOM extraction, title block parsing, and sheet splitting—completed successfully using the scripting approach, demonstrating its practicality and scalability.
Workflow
- 1. Agent receives natural language task description.
- 2. Agent writes a JavaScript script using the cad API (cad.entities, cad.measure, cad.edit, cad.file.saveDxf).
- 3. Agent calls execute_cad_script via MCP.
- 4. Script runs in a sandboxed Chromium instance, manipulating the drawing.
- 5. Result (e.g., DXF file or preview) is returned to the agent.
- 6. Agent formats and presents the output to the user.
Evidence
Instead of exposing every CAD operation as a separate tool, we give the agent a scripting API and let it write JavaScript to perform the actual work.
All three worked.
The server uses stdio and launches Chromium through Playwright when the first tool call arrives.
- Record date: 2026-10-25T10:41:15.228Z