SolidWorks MCP Server
Connects Claude Code to SolidWorks via MCP protocol, enabling natural language control for creating 3D models.
README
SolidWorks MCP Server
通过 MCP 协议连接 Claude Code 和 SolidWorks,实现自然语言控制 SolidWorks 画图。
工作原理
用户自然语言 → Claude Code → MCP Server → SolidWorks COM API → 3D 模型
环境要求
- Windows 10/11
- SolidWorks 2020 或更高版本
- Python 3.10+
- Claude Code CLI
安装步骤
1. 克隆项目
git clone <your-repo-url>
cd solidworks-mcp
2. 安装依赖
pip install -r requirements.txt
3. 配置 Claude Code
在项目根目录创建 .claude/settings.json:
{
"mcpServers": {
"solidworks": {
"command": "python",
"args": ["-m", "server.mcp_server"],
"cwd": "<项目绝对路径>"
}
}
}
或者在全局配置 ~/.claude/settings.json 中添加同样的配置。
使用方法
1. 启动 SolidWorks
确保 SolidWorks 已经打开。
2. 启动 Claude Code
claude
3. 开始对话
直接用自然语言描述你要画什么:
基础操作:
- "帮我创建一个新零件"
- "在前视基准面画一个 100x50 的矩形"
- "拉伸 30mm"
- "保存到 D:\models\test.sldprt"
进阶操作:
- "画一个直径 50 高 80 的圆柱"
- "在顶面开一个直径 10 的通孔"
- "对所有边做半径 5 的圆角"
- "把这个特征镜像到右边"
复合操作:
- "画一个 100x50x30 的长方体,在顶面中心开一个直径 8 的通孔,然后对所有边做圆角"
支持的 MCP Tools
| Tool | 功能 |
|---|---|
sw.new_part |
创建新零件 |
sw.new_assembly |
创建新装配体 |
sw.new_drawing |
创建新工程图 |
sw.open |
打开现有文档 |
sw.save |
保存文档 |
sw.export_step |
导出 STEP |
sw.close |
关闭文档 |
sw.new_sketch |
创建草图 |
sw.draw_line |
画线段 |
sw.draw_circle |
画圆 |
sw.draw_arc |
画弧 |
sw.draw_rectangle |
画矩形 |
sw.draw_center_rectangle |
画中心矩形 |
sw.draw_polygon |
画正多边形 |
sw.exit_sketch |
退出草图 |
sw.extrude |
拉伸凸台 |
sw.cut_extrude |
拉伸切除 |
sw.revolve |
旋转 |
sw.fillet |
圆角 |
sw.chamfer |
倒角 |
sw.shell |
抽壳 |
sw.mirror |
镜像 |
sw.linear_pattern |
线性阵列 |
sw.circular_pattern |
圆周阵列 |
sw.add_plane |
创建基准面 |
sw.add_axis |
创建基准轴 |
sw.delete_feature |
删除特征 |
sw.undo |
撤销 |
sw.add_dimension |
尺寸标注 |
sw.zoom_to_fit |
缩放至适合 |
sw.rebuild |
重建模型 |
sw.get_model_info |
获取模型信息 |
sw.list_features |
列出特征 |
故障排除
无法连接 SolidWorks
- 确保 SolidWorks 已启动
- 检查 SolidWorks 版本是否支持 COM 自动化
- 以管理员权限运行 Python
MCP Server 启动失败
- 检查 Python 版本:
python --version - 检查依赖是否安装:
pip list | grep mcp - 检查
cwd路径是否正确
操作执行失败
- 检查草图是否封闭
- 检查尺寸参数是否合理
- 使用
sw.get_model_info查看当前状态
开发
项目结构
solidworks-mcp/
├── .claude/skills/solidworks.md # Skill 定义
├── server/
│ ├── __init__.py
│ ├── mcp_server.py # MCP Server 入口
│ └── sw_api.py # SolidWorks COM 封装
├── requirements.txt
├── pyproject.toml
└── README.md
扩展新功能
- 在
sw_api.py中添加新的 API 方法 - 在
mcp_server.py中注册对应的 MCP tool - 在
.claude/skills/solidworks.md中更新操作指南
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.