cad
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| CADMCP_WORKSPACE | No | 修改工程图 SVG 预览和发布文件的输出目录(默认 ~/cadmcp/)。 | ~/cadmcp/ |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
CAD-MCP:用"设计规格 (spec)"驱动 SolidWorks / Creo 建模与出图。你写 spec,平台编译成原生模型。
标准流程:
cad_list_targets → 确认 CAD 与版本;cad_change_begin(project) 开启变更会话(所有写操作都在隔离工作区)。
零件:cad_build_part(spec)。用 parameters 定义驱动参数,尺寸写表达式(如 "L-2*e")。 孔用 type=tapped/counterbore/clearance/simple + 公制规格(M6),不要自己算底孔/沉孔尺寸。 为装配定位建 CS_ 坐标系基准(references),装配只认命名坐标系,不选面不选边。 与外购件对接的孔用 mount 特征(item=库编码),自动按接口开孔并生成 CS_。
装配:涉及气缸、电机、丝杠、螺栓受力时先 cad_calc 选型(生成计算书),再 cad_search_library 查标准件/外购件 → cad_build_assembly(spec),组件 source 用 part:/lib:/asm:。
每个零件/装配都要出图:cad_build_drawing(spec)。看返回的 rules/findings,有 error 必须修。
修改:cad_set_parameters 改参数,依赖它的装配和工程图会自动重建。
cad_validate → cad_check_interference → cad_export_bom → cad_change_commit(revision)。 不满意可 cad_checkpoint / cad_change_rollback。
规则:单位 mm/deg/kg;不要覆盖原始文件(平台会拒绝);遇到错误先读 error.hint。
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| cad_list_targetsA | 列出可用的 CAD 目标(CAD 类型、版本、节点、状态)。 |
| cad_select_targetC | 设置默认 CAD 目标(新变更会话使用)。 |
| cad_get_capabilitiesA | 查询目标对各能力的支持级别(full/partial/none)。不支持的能力不要尝试。 |
| cad_change_beginB | 开启变更会话:创建隔离工作区(可复制已有设计文件进来),后续所有建模/修改都在其中。 |
| cad_change_statusB | 当前会话:模型列表、检查点、提交门禁状态。 |
| cad_checkpointB | 打检查点(工作区快照),之后可回滚到这里。 |
| cad_change_rollbackA | 回滚到检查点(0 = 会话开始)。之后的修改会丢弃。 |
| cad_change_commitA | 把工作区发布为新修订版本(不可覆盖)。门禁(再生无错、规则无 error、图纸无 error)不通过会被拒绝。 description 为更改内容(写进图纸更改记录表;首版可省略),by 为更改人。图纸标题栏自动写入版本号。 |
| cad_build_partA | 按零件 spec 建模(新建或按同名覆盖重建)。返回尺寸、质量、孔标注、设计规则检查结果。 基准:草图在 XY(Z=0),实体向 +Z;面名 top/bottom/front(-Y)/back(+Y)/left(-X)/right(+X)。 |
| cad_build_assemblyB | 按装配 spec 建装配:组件用 CS_ 坐标系对齐定位(align → to + offset/rotate),可线性阵列。返回 BOM 和初步干涉。 |
| cad_build_drawingA | 按出图 spec 生成工程图:自动选图幅比例、视图、总体尺寸、孔坐标与孔标注、技术要求、标题栏、明细表,并做出图检查。 |
| cad_set_parametersA | 修改模型驱动参数(值或表达式),自动重建该模型及依赖它的装配/工程图。 |
| cad_get_modelC | 读取模型:spec、解析结果摘要、规则发现、(装配)BOM、(图纸)尺寸清单。 |
| cad_build_frameA | 铝型材机架:给 name/part_no/title、width/depth/height(外形 mm)、profile(默认 PRF-4040)、 levels(横梁层中心高度,默认底层+顶层)、bracket(角码,默认 BRK-4040),生成立柱+横梁装配并建模。 返回下料清单 cut_list、型材总长、BOM(含角码/T 螺母/螺钉)。之后可用 asm: 把机架装进总装, 或在其上加安装板(坐标原点在机架底面中心)。 construction="welded" 生成方管焊接机架(section 默认 SHS40x3,feet 地脚板),作为一个焊接件零件, 返回切割清单;之后可 cad_build_drawing 出焊接件图(焊缝符号、切割清单、焊接技术要求)。 |
| cad_inspect_existingA | 读出工作区中现有模型(旧零件/装配/工程图):特征树(压缩状态、父子关系)、全部尺寸全名与数值、 方程式与全局变量、自定义属性、材料、质量,以及引用它的装配/工程图(used_by)。 文件须先用 cad_change_begin(project, sources=[...]) 复制进工作区;file 为工作区内相对路径。 |
| cad_edit_existingA | 修改现有模型。edits 为指令列表: {"op":"set_dimension","name":"D1@凸台-拉伸1","value":20} / {"op":"set_variable","name":"pitch","value":180} / {"op":"suppress","feature":"圆角1","suppressed":true} / {"op":"set_property","name":"Description","value":"..."} / {"op":"set_material","material":"AL6061-T6"}。 先校验(名称存在、方程式驱动的尺寸要改变量、变化幅度);dry_run=true 只校验。执行后重建,出错不保存; 成功则返回改前改后对比(尺寸/质量/包围盒),并自动更新引用它的装配和工程图、检查悬空标注。 每次修改前自动建检查点(rollback_to)。发布后可用 cad_change_writeback 回写原位置。 |
| cad_change_writebackA | 把已发布版本中修改过的源文件回写到原位置(共享盘 / PDM 检出目录)。confirm=false 只列出计划; 原文件先备份到发布目录 _writeback_backup;原文件期间被别人改过(冲突)、只读(PDM 未检出)、 或不在 policy.writeback_allow 中的都不会覆盖。平台新建的文件不回写,需按公司流程入库。 |
| cad_calcA | 选型计算,返回带公式过程的计算书与推荐型号(有变更会话时计算书存入工作区并随版本发布)。 cylinder: load_kg 或 force_N, orientation horizontal|vertical, stroke_mm, pressure_MPa=0.5, direction push|pull screw_drive: load_kg, stroke_mm, speed_mm_s, accel_time_s=0.2, orientation, lead_mm(可选), screw_diameter_mm=16 belt_drive: load_kg, stroke_mm, speed_mm_s, accel_time_s=0.2, pulley_pd_mm=30 bolt: size(M6), count, grade 8.8|10.9|12.9, tension_N, shear_N 先算再建模:用 selection 结果选标准件(cad_search_library)和定尺寸。 |
| cad_search_libraryA | 搜索标准件/外购件库。返回编码、参数和可用的命名基准。装配中用 source="lib:?L=600"。 |
| cad_open_existingB | 打开已有设计文件(版本保护:新版本 CAD 默认只读打开旧版本文件,旧版本 CAD 拒绝打开新文件)。 |
| cad_validateC | 运行设计规则与出图检查,返回提交门禁状态。 |
| cad_check_interferenceD | 装配干涉检查。 |
| cad_export_bomB | 导出装配 BOM(CSV,UTF-8 BOM 便于 Excel 打开)。 |
| cad_exportC | 导出文件到会话 out/ 目录。 |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 24 tools
Most tools are clearly separated by resource and action (targets, change session, build part/assembly/drawing/frame, calc, library, export). A few pairs overlap mildly: cad_open_existing vs cad_inspect_existing, cad_validate vs cad_check_interference, and cad_export vs cad_export_bom, plus cad_change_status partially duplicates cad_get_model's summary role. Descriptions do help disambiguate these, so misselection risk is low but not zero.
All names share a cad_ prefix and snake_case, which is good. However, the ordering convention is mixed: most are verb_noun (cad_build_part, cad_get_model, cad_list_targets), while the session group is noun_verb (cad_change_begin, cad_change_commit, cad_change_rollback). The grouping is readable and intentional, but it is a deviation from the dominant pattern.
24 tools is at the upper bound, but the domain is genuinely broad: target selection, isolated change sessions with checkpoints/rollback, part/assembly/drawing/frame modeling, existing-model editing, validation, library search, engineering calc, and export/writeback. Each tool maps to a real workflow step, though a couple (export_bom vs export, change_status vs get_model) could be folded together.
The surface covers the full modeling lifecycle: begin session, build, edit, inspect, parameterize, validate, checkpoint/rollback, commit, writeback, and export. Gaps are minor: no explicit delete/rename of workspace models, no dedicated checkpoint listing or cleanup, and drawing output is only reachable via the generic export tool. Agents can work around these.