solidworks-mcp

solidworks-mcp

Enables building and modifying parametric solid models in a local SOLIDWORKS installation via the COM API.

Category
访问服务器

README

solidworks-mcp

An MCP server that drives a local SOLIDWORKS installation to build and modify parametric solid models.

Verified against SOLIDWORKS 2026 SP0 (revision 34.0.0) on Windows 11.

How it works

MCP client  ──stdio──►  solidworks-mcp  ──COM──►  SLDWORKS.exe

SOLIDWORKS exposes a classic COM automation API. The server attaches to a running instance (or launches one), and every tool maps onto that API.

All lengths are in millimetres and all angles in degrees. The SOLIDWORKS API is metric-SI internally; conversion happens at the tool boundary.

Requirements

  • SOLIDWORKS installed and licensed, on the same machine.
  • Python 3.12+, 64-bit — it must match SOLIDWORKS' architecture or COM will not bind.
  • uv for dependency management.

Install

uv sync

Register with an MCP client

For Claude Code:

claude mcp add solidworks -- uv --directory E:\solid run solidworks-mcp

For a client that reads a JSON config:

{
  "mcpServers": {
    "solidworks": {
      "command": "uv",
      "args": ["--directory", "E:\\solid", "run", "solidworks-mcp"]
    }
  }
}

Tools

Session and documents — solidworks_status, new_part, open_part, save_part, close_part

Sketching — list_planes, start_sketch, start_sketch_on_face, sketch_line, sketch_centerline, sketch_circle, sketch_rectangle, sketch_arc, sketch_polygon, sketch_ellipse, add_sketch_dimension, add_sketch_relation, finish_sketch

Features — extrude, cut_extrude, revolve, fillet, select_entity, clear_selection

Parametric control — list_features, list_dimensions, set_dimension, add_equation, list_equations, rebuild

Inspection — get_measurements, capture_view

A worked example

Building a 80 × 50 × 10 mm plate with a hole, then driving it parametrically:

new_part
start_sketch(plane="front")
sketch_rectangle(0, 0, 80, 50)
add_sketch_dimension(entities=[[40, 0]], value=80)   -> "D1@Croquis1"
add_sketch_dimension(entities=[[0, 25]], value=50)   -> "D2@Croquis1"
finish_sketch
extrude(depth=10)

start_sketch(plane="front")
sketch_circle(40, 25, 8)
finish_sketch
cut_extrude(depth=10, end_condition="through_all", reverse=True)

fillet(radius=5, edges=[[0,0,5], [80,0,5], [80,50,5], [0,50,5]])

set_dimension("D1@Croquis1", 120)   -> the solid rebuilds to 120 mm wide
get_measurements                    -> bounding box 120 x 50 x 10 mm
capture_view("isometric")

Things worth knowing

Sketches created through the API have no dimensions. SOLIDWORKS only adds driving dimensions when you ask for them, so a sketch drawn with sketch_* alone has nothing to drive. Call add_sketch_dimension while the sketch is still open if you intend to change the geometry later.

Cut direction follows the sketch normal. A sketch on the Front Plane cutting a solid that was extruded away from it needs reverse=True, otherwise the cut travels into empty space and fails.

Reference plane names are localised. A Spanish install names features Croquis1 and Saliente-Extruir1. Tools accept the logical aliases front/top/right and resolve them by position in the feature tree, so they work regardless of UI language. list_planes reports the real names.

SOLIDWORKS must be running. There is no supported headless mode. The server launches the application if it is not already open.

Modal dialogs deadlock COM. add_sketch_dimension temporarily disables the "input dimension value" preference, which would otherwise pop a modal box and hang the call, and restores it afterwards.

Implementation notes

Two pywin32 behaviours shape the code and are easy to trip over:

  • Zero-argument COM members are auto-invoked on attribute access. Under late binding doc.GetTitle returns the title string; doc.GetTitle() raises TypeError: 'str' object is not callable. Members taking one or more arguments are called normally.
  • Typed nulls and in/out parameters need explicit VARIANTs. Optional interface arguments reject a bare None with "Type mismatch" and need VARIANT(VT_DISPATCH, None); error and warning out-parameters need VARIANT(VT_BYREF | VT_I4, 0), with the result read back from .value.

COM objects live in a single-threaded apartment, so com_bridge.py funnels every call through one dedicated thread. Enum values in constants.py were read from swconst.tlb rather than transcribed from documentation, because some differ from commonly quoted values — swEndCondThroughAllBoth is 9, not 8.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选