Letting AI Write Code Against Your Drawings: The mlightcad MCP Server
说明与用途
AI 通过统一的脚本 API 编写 JavaScript 操作 CAD 绘图,消除了工具泛滥问题,并成功完成 BOM 提取、标题块解析和图纸拆分等任务。
问题
Providing AI with a vast set of discrete CAD tools leads to tool‑sprawl and limits flexibility for complex drawing tasks.
结果
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.
工作流
- 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.
证据
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.
- 记录日期: 2026-10-25T10:41:15.228Z