SolidworksMCP-python

SolidworksMCP-python

Python MCP server for SolidWorks automation with 109 tools covering the full CAD lifecycle. Enables AI-assisted design workflows through COM automation on Windows.

Category
访问服务器

README

SolidWorks CAD Assistant & MCP Server

Python 3.11+ License: MIT Windows SolidWorks Coverage

Python MCP server for SolidWorks automation with 109 tools, plus an optional agent/prompt-testing layer for AI-assisted workflows.

Overview

⚠️ Project Status: This project is under active construction. Features, APIs, documentation, and setup steps may change as the Python and UI implementation is finalized. This is a hobby/research product, please feel free to make an issue if you have questions or feedback! ⚠️

This project focuses on practical SolidWorks automation with an AI-friendly loop:

  1. describe intent
  2. generate a plan
  3. execute MCP tools
  4. inspect results
  5. iterate

It includes:

  • core MCP runtime for SolidWorks tool execution
  • COM/VBA routing and adapter safety wrappers
  • tool coverage across modeling, sketching, drawing, analysis, export, automation, templates, and macros
  • optional agent orchestration/testing utilities under src/solidworks_mcp/agents/

Supported Today

  • Windows + SolidWorks COM automation for the main CAD lifecycle.
  • Modeling, sketching, drawing, analysis, export, automation, templates, and macro tools.
  • Prefab UI preview sync from the active viewport as PNG.

Not Yet / Simulated

  • Mock adapter output is simulated and should not be treated as engineering truth.
  • Live 3D viewport streaming in the UI.
  • Checkpoint-level interference validation in the UI runner.

What Works (Verified Windows Setup)

This is the setup path validated end-to-end:

  1. Install Python from python.org (Windows installer).
  2. Enable Add python.exe to PATH during install.
  3. Install this project into a local .venv.
  4. Launch MCP from .venv\Scripts\python.exe (not from WSL).

When this is correct, startup logs show:

  • Platform: Windows
  • SolidWorks COM interface is available
  • Registered ... SolidWorks tools (count varies as tools evolve)
  • Connected to SolidWorks

Requirements

  • Windows 10/11 for real SolidWorks COM automation.
  • Python 3.11+ from python.org.
  • Git.
  • SolidWorks installed and launched at least once.

Linux/WSL is useful for docs/tests/mock mode, but not for direct COM automation.

Quick Start (Windows, python.org)

git clone https://github.com/andrewbartels1/SolidworksMCP-python.git
cd SolidworksMCP-python

python -m venv .venv
.\.venv\Scripts\python.exe -m pip install --upgrade pip setuptools wheel
.\.venv\Scripts\python.exe -m pip install -e .

Start server manually:

.\.venv\Scripts\python.exe -m solidworks_mcp.server

Or use the helper script (open SolidWorks first):

powershell -NoProfile -ExecutionPolicy Bypass -File .\run-mcp.ps1 --real --year 2026

Mock mode warning — running run-mcp.ps1 without --real starts the server in mock mode. All tool responses are simulated; nothing touches SolidWorks. Always pass --real --year <year> for live automation.

Development Commands

Use the helper script for common workflows:

.\dev-commands.ps1

Common commands:

  • dev-install - install/update local dev environment
  • dev-test - run standard test suite (CI-safe subset)
  • dev-test-full - run full test suite (includes smoke/integration paths)
  • dev-lint - lint checks
  • dev-format - format code
  • dev-docs-build - build docs site once
  • dev-docs-strict - strict docs build (fails on warnings)
  • dev-docs-audit - generate docs audit report in .generated/docs

Local CI Replica (Docker)

To mirror GitHub Actions CI locally (Ubuntu + conda env from solidworks_mcp.yml + make test), run:

.\run-ci-local.ps1

The first run builds the image. Re-run without rebuild when only executing tests:

.\run-ci-local.ps1 -NoBuild

Prefab UI Dashboard

Interactive CAD assistant with GitHub Copilot integration and real-time 3D viewport sync.

Quick Start (2 terminals required):

  1. Terminal 1 - Backend API server:
.\.venv\Scripts\python.exe -m pip install -e ".[ui]"  # one time
.\.venv\Scripts\python.exe -m uvicorn solidworks_mcp.ui.server:app --host 127.0.0.1 --port 8766 --reload

The backend is a FastAPI app, so local API docs are available at http://127.0.0.1:8766/docs.

  1. Terminal 2 - Prefab frontend:
.\.venv\Scripts\prefab.exe serve src/solidworks_mcp/ui/prefab_dashboard.py
  1. Open http://127.0.0.1:5175 in your browser.

Layout:

  • Left pane (wider): Design intent input + family classification gate
  • Middle pane: Checkpoint queue + context window + evidence table + manual sync
  • Right pane (larger): 3D model view with orientation buttons (Isometric/Front/Top/Current)

Key features:

  • ✅ GitHub Copilot integration for goal clarification and family classification
  • ✅ Checkpoint workflow with SQLite session persistence
  • ✅ Execute Next Checkpoint runs supported adapter tools and logs per-tool results
  • ✅ Real-time PNG preview sync from SolidWorks using export_image(view_orientation=...)
  • ✅ Manual edit detection via snapshot comparison
  • 🔧 MOCKED: check_interference from checkpoint runner (until tool-layer wiring exists)
  • 🔧 MOCKED: live 3D viewport streaming and STL embedding in the UI (PNG sync is live)
  • 📋 Future: richer model-state diffing (feature-level and mass-property deltas)

LLM Requirements:

  • GH_TOKEN or GITHUB_API_KEY environment variable (models:read scope)
  • OR: authenticated gh auth login session

Preview Pane:

  • Exports from active SolidWorks viewport every 3 minutes or on manual refresh
  • Supports: Isometric, Front, Top, Current orientations
  • Requires: SolidWorks running + COM adapter available

Full Documentation:

See Prefab UI Dashboard Guide for button reference, architecture notes, and troubleshooting.

VS Code MCP Configuration (Windows)

Set your user MCP config (%APPDATA%\Code\User\mcp.json) to:

{
  "servers": {
    "solidworks-mcp-server": {
      "type": "stdio",
      "command": "powershell",
      "args": [
        "-NoProfile",
        "-ExecutionPolicy",
        "Bypass",
        "-File",
        "C:\\path\\to\\SolidworksMCP-python\\run-mcp.ps1"
      ]
    }
  }
}

Replace the script path with your local repository path.

LM Studio MCP Configuration (Windows)

Set your LM Studio MCP config file to include this server (LM Studio expects mcpServers):

{
  "mcpServers": {
    "solidworks-mcp-server": {
      "command": "powershell",
      "args": [
        "-NoProfile",
        "-ExecutionPolicy",
        "Bypass",
        "-File",
        "C:\\Users\\andre\\OneDrive\\Documents\\GitHub\\SolidworksMCP-python\\run-mcp.ps1"
      ]
    }
  }
}

Alternative direct-python entry:

{
  "mcpServers": {
    "solidworks-mcp-server": {
      "command": "C:\\Users\\andre\\OneDrive\\Documents\\GitHub\\SolidworksMCP-python\\.venv\\Scripts\\python.exe",
      "args": ["-m", "solidworks_mcp.server"]
    }
  }
}

After saving, restart LM Studio so it reloads MCP servers.

Common Windows Fixes

If python is not found:

python --version

If this opens Microsoft Store or fails, reinstall Python from python.org and enable PATH.

If startup fails with ModuleNotFoundError: solidworks_mcp:

.\.venv\Scripts\python.exe -m pip install -e .

If startup fails with ModuleNotFoundError: fastmcp:

.\.venv\Scripts\python.exe -m pip install -e .

Docs

Key docs sections:

Direct links:

License

MIT License. See LICENSE.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选