Skip to main content
Glama
solid-mcp-studio

solid-mcp-studio

by igokmen433

Bidirectional Live SolidWorks CAD Automation Server via Model Context Protocol (MCP).

solid-mcp-studio combines a Python MCP Server (server.py) with a persistent C# SolidWorks Interop Bridge (sw_bridge.exe) to give AI agents direct, real-time control over a live, visible SolidWorks session — from parametric 3D modeling and sheet metal fabrication to production-ready 2D technical drawings and 1:1 laser-ready DXF exports.

📖 Detailed Turkish User Guide: docs/SOLIDWORKS_MCP_KILAVUZU.md

NOTE

Hobby & Non-Commercial Project: This project was created purely as a personal hobby and technical experiment, with no commercial purpose or affiliation. SolidWorks is a registered trademark of Dassault Systèmes.


Key Capabilities

  • Live & Visible SolidWorks Execution: Operates directly on the user's running SolidWorks window so every sketch, feature, and drawing view can be watched in real time. Never modifies system templates or user settings.

  • Parametric 3D Modeling (Phase 2): Full sketch geometry (line, circle, arc, rect, polygon), parametric dimensions (sw_sketch_dimension), geometric relations (sw_sketch_relation), Extrude Boss/Cut, Revolve Boss/Cut, Fillet, Chamfer, material assignment, and sw_undo.

  • Production-Ready Technical Drawings (Phase 3): Clean title-block-free Landscape A3 sheets, automatic standard orthographic views, longitudinal section views (KESİT A-A), detail views, calm targeted dimensioning (inspecting each view via sw_drawing_inspect_view and placing collision-free dimensions one by one with sw_drawing_add_dimension instead of cluttered auto-dimension dumps), in-place revision on the same .SLDDRW sheet, manufacturing notes, and 200 DPI PNG + PDF + .SLDDRW export.

  • Autonomous jobs/ Workflow & 7-Angle Visual Analysis: Drop a .SLDPRT/.STEP/.IGES part into jobs/parcadan_teknik_resim/ for automatic 7-view viewport inspection (Isometric, Front, Back, Top, Bottom, Right, Left) and a structured drawing plan, or drop a .PDF/.PNG/.JPG drawing into jobs/teknik_resimden_parca/ to generate a verified dimension table and build the parametric 3D model step by step.

  • Sheet Metal & Laser DXF Workflow: Base Flange, Edge Flange, Hem, bend inspection (K-factor, thickness, bend radius), flat-pattern drawing views with bend notes, and clean Layer-0 1:1 laser-ready DXF export.

  • Visual Checkpoint Verification: High-resolution viewport screenshots (sw_capture_viewport) and 200 DPI drawing previews enable multimodal AI agents to visually verify geometry and drawing readability at every step.


Related MCP server: solidworks-mcp

Visual Examples

Parametric 3D Model (Live Viewport)

Auto-Generated A3 Technical Drawing

3D Parametric Model

Production Technical Drawing


Architecture

flowchart LR
    AI["AI Client (Antigravity / Claude / Cursor)"] <-->|MCP stdio JSON-RPC| PY["Python MCP Server\nserver.py + mcp_server/"]
    PY <-->|Persistent STA NDJSON| CS["C# Interop Bridge\nbridge/bin/sw_bridge.exe"]
    CS <-->|COM / SolidWorks API| SW["Live SolidWorks 2025"]
  • Python layer (server.py, mcp_server/): Exposes 40+ strongly typed MCP tools and renders PDF drawings to 200 DPI PNGs via PyMuPDF (fitz).

  • C# STA bridge (bridge/*.cs): Runs as a persistent single-threaded apartment (STA) subprocess communicating over newline-delimited JSON (NDJSON) for fast, reliable SolidWorks COM interop without per-call startup overhead.

  • Engineering rules (rules/): Structured modeling, drawing, and autonomous file-based workflow specifications (modeling_rules.md, drawing_rules.md, autonomous_workflow.md).


Tool Overview

Category

Tools

Session & Inspection

sw_status, sw_list_docs, sw_activate_doc, sw_open_doc, sw_new_part, sw_save_doc, sw_zoom_fit, sw_capture_viewport, sw_inspect_part

Parametric Sketching

sw_sketch_start, sw_sketch_line, sw_sketch_circle, sw_sketch_arc, sw_sketch_rect, sw_sketch_polygon, sw_sketch_dimension, sw_sketch_relation, sw_sketch_close

3D Solid Features

sw_extrude_boss, sw_extrude_cut, sw_revolve_boss, sw_revolve_cut, sw_fillet, sw_chamfer, sw_set_material, sw_undo, sw_delete_feature

Technical Drawings

sw_get_drawing_rules, sw_drawing_create_sheet, sw_drawing_add_standard_views, sw_drawing_add_section_view, sw_drawing_add_detail_view, sw_drawing_auto_dimension, sw_drawing_add_isometric, sw_drawing_list_annotations, sw_drawing_move_annotation, sw_drawing_delete_annotation, sw_drawing_inspect_view, sw_drawing_add_dimension, sw_drawing_add_note, sw_drawing_set_metadata, sw_drawing_export

Sheet Metal

sw_sm_base_flange, sw_sm_edge_flange, sw_sm_hem, sw_sm_set_flat_state, sw_sm_inspect_bends, sw_drawing_add_flat_pattern, sw_drawing_set_sheet_metal_notes, sw_export_flat_dxf


Prerequisites

  • OS: Windows 10 / 11 (64-bit)

  • CAD: SolidWorks installed locally (tested on SolidWorks 2025)

  • Python: 3.11 or newer

  • .NET Framework: Built-in Windows 64-bit csc.exe (C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe)


Installation

1. Clone the repository

git clone https://github.com/igokmen433/solid-mcp-studio.git
cd solid-mcp-studio

2. Set up the Python virtual environment

python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -e .

3. Build the C# SolidWorks Interop Bridge

Note: SolidWorks Interop DLLs (SolidWorks.Interop.sldworks.dll, SolidWorks.Interop.swconst.dll) are proprietary to Dassault Systèmes and are intentionally excluded from this repository. The build script automatically locates them from your local SolidWorks installation and compiles bridge\bin\sw_bridge.exe.

powershell -ExecutionPolicy Bypass -File .\bridge\build_bridge.ps1

Connecting to an MCP Client

solid-mcp-studio uses standard MCP (stdio), so it works with Antigravity, Claude Code, OpenAI Codex CLI, Claude Desktop, Cursor, and any other MCP-compatible client on Windows.

Antigravity / Claude Desktop / Cursor (mcp.json)

Add the server to your MCP client configuration (see mcp_config.example.json):

{
  "mcpServers": {
    "solidworks-cad-mcp": {
      "command": "C:/path/to/solid-mcp-studio/.venv/Scripts/python.exe",
      "args": [
        "C:/path/to/solid-mcp-studio/server.py"
      ]
    }
  }
}

Claude Code

claude mcp add solidworks-cad-mcp -- C:/path/to/solid-mcp-studio/.venv/Scripts/python.exe C:/path/to/solid-mcp-studio/server.py

OpenAI Codex CLI (~/.codex/config.toml)

[mcp_servers.solidworks-cad-mcp]
command = "C:/path/to/solid-mcp-studio/.venv/Scripts/python.exe"
args = ["C:/path/to/solid-mcp-studio/server.py"]

💡 Automatic Engineering Rules: Pre-configured instruction files are included for all major agents — GEMINI.md (Antigravity / Gemini), CLAUDE.md (Claude Code), and AGENTS.md (OpenAI Codex / Cursor).


Verification Tests

With SolidWorks running (or closed — the bridge can launch it automatically):

.\.venv\Scripts\python.exe tests\test_phase1_bridge.py
.\.venv\Scripts\python.exe tests\test_phase2_modeling.py
.\.venv\Scripts\python.exe tests\test_phase3_drawing.py

For sheet metal parts, pass one or more .SLDPRT files:

.\.venv\Scripts\python.exe tests\test_sheet_metal_live.py path\to\your_sheet_metal_part.SLDPRT

Project Structure

solid-mcp-studio/
├── server.py                  # MCP server entrypoint
├── mcp_server/                # Python MCP tool registrations & NDJSON bridge client
├── bridge/                    # C# SolidWorks COM interop bridge source & build script
├── rules/                     # Modeling, drawing & autonomous workflow rules
├── AGENTS.md / CLAUDE.md / GEMINI.md  # Agent instruction files (Codex, Claude Code, Antigravity)
├── docs/                      # Detailed Turkish guide & visual showcase assets
├── jobs/                      # Drop-in workspace for autonomous CAD <-> Drawing jobs
├── tests/                     # Live verification scripts (Phases 1–3 & Sheet Metal)
├── pyproject.toml
├── mcp_config.example.json
└── LICENSE

License

This project is licensed under the MIT License — see LICENSE for details.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to control a running SOLIDWORKS session through its COM API, with tools for sketching, feature creation, assemblies, and visual feedback via screenshots.
      22
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to build, measure, verify, and correct parametric SolidWorks parts and assemblies locally via the COM API, supporting operations like sketching, extruding, modeling, dimensioning, material assignment, export, and assembly mating.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables an AI assistant to drive an already-running SOLIDWORKS session over its COM API, so it can build sketches, solid features, reference geometry, assemblies, mates, and engineering drawings, then inspect the result through topology listings, mass properties, measurements, and screenshots returned as images.
      2
      Apache 2.0
    • F
      license
      B
      quality
      C
      maintenance
      Enables AI agents to drive SolidWorks for parametric modelling, aerospace part generation, sheet metal, weldments, assemblies, drawings, simulation, inspection, and file export. It provides approval-gated operations, verification tools, and journaling for safe, recoverable design automation.
      94
      -