cad-mcp
cad-mcp
一个向 LLM 公开针对 STEP 文件进行 CAD 几何推理的 MCP 服务器。放入一个 STEP 文件,用自然语言询问几何问题,即可获得可验证的答案。基于 build123d (由 OCCT 提供支持) 和 MCP Python SDK 构建。可与 Claude Code 在本地运行。
安装
需要 Python 3.12,支持 arm64 (Apple Silicon) 或 x86-64。
git clone https://github.com/your-org/cad-mcp.git
cd cad-mcp
python3.12 -m venv venv
venv/bin/pip install -r requirements.txt对安装进行冒烟测试:
venv/bin/python smoke_test.py # loads bracket.step, checks bbox
venv/bin/python verify_server.py # connects over MCP stdio, calls all tools运行
当 Claude Code 打开此目录时,服务器会自动启动(已包含 .mcp.json)。如需手动启动:
venv/bin/python server.py要连接不同的 STEP 文件,只需在任何工具调用中传入其绝对路径即可 — 无需重启服务器。
工具
工具 | 返回值 |
| 树状结构的零件/装配体层级 |
| 边界框 (mm) 和体积 (mm³) |
| 圆柱孔:位置、直径、深度 (mm) |
| 零件参考点之间的欧几里得距离 (mm) |
| 质量 (kg)、质心 (mm)、惯性矩 (kg·mm²) |
演示
在连接了 MCP 服务器的 Claude Code 中,针对 fixtures/bracket.step(100 × 60 × 10 mm 铝制支架,四个 M5 间隙孔)提出的五个问题。
bracket.step 是单个零件还是装配体?
工具:list_assembly_tree
{
"root": {
"type": "part",
"name": "part_root",
"part_id": "root",
"children": []
}
}单个零件。part_id: "root" 会被传递给所有其他工具。
总体尺寸和体积是多少?
工具:get_part_dimensions
{
"part_id": "root",
"bbox_mm": { "x": 100.0, "y": 60.0, "z": 10.0 },
"volume_mm3": 59117.5266
}100 × 60 × 10 mm。体积为净体积(仅材料)— 总量减去四个孔的体积。
有多少个孔,尺寸是多少?
工具:find_holes
{
"holes": [
{ "center_x_mm": -42.0, "center_y_mm": -22.0, "center_z_mm": 0.0,
"diameter_mm": 5.3, "depth_mm": 10.0, "axis": [0.0, 0.0, 1.0] },
{ "center_x_mm": 42.0, "center_y_mm": -22.0, "center_z_mm": 0.0,
"diameter_mm": 5.3, "depth_mm": 10.0, "axis": [0.0, 0.0, 1.0] },
{ "center_x_mm": -42.0, "center_y_mm": 22.0, "center_z_mm": 0.0,
"diameter_mm": 5.3, "depth_mm": 10.0, "axis": [0.0, 0.0, 1.0] },
{ "center_x_mm": 42.0, "center_y_mm": 22.0, "center_z_mm": 0.0,
"diameter_mm": 5.3, "depth_mm": 10.0, "axis": [0.0, 0.0, 1.0] }
]
}四个 M5 间隙(5.3 mm)通孔,位于角落,均垂直于 XY 平面。
角落到角落的空间对角线距离是多少?
工具:measure_distance,参数为 selector_a: "bbox_min", selector_b: "bbox_max"
{
"distance_mm": 117.047,
"point_a": { "part_id": "root", "selector": "bbox_min",
"x_mm": -50.0, "y_mm": -30.0, "z_mm": 0.0 },
"point_b": { "part_id": "root", "selector": "bbox_max",
"x_mm": 50.0, "y_mm": 30.0, "z_mm": 10.0 }
}√(100² + 60² + 10²) = 117.047 mm。为了可追溯性,包含了解析出的两个点。
铝制材料的质量和质心是多少?
工具:get_mass_properties,参数为 density_kg_m3: 2700.0
{
"mass_kg": 0.159617,
"volume_mm3": 59117.5266,
"center_of_mass_mm": { "x_mm": 0.0, "y_mm": 0.0, "z_mm": 5.0 },
"moments_of_inertia_kg_mm2": {
"Ixx": 48.772745,
"Iyy": 132.122917,
"Izz": 178.235373
}
}≈ 160 g。质心位于几何中心 (0, 0, 5) — 对于具有对称孔的对称支架,这是预期的结果。
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/hiromitsdm/cad-mcp0'
If you have feedback or need assistance with the MCP directory API, please join our Discord server