Skip to main content
Glama
Said-AER

SolidWorks MCP Bridge

by Said-AER

{"type": "text"}# SolidWorks MCP Bridge πŸŒ‰ βš™οΈ

Server and integration bridge based on Model Context Protocol (MCP) to communicate local language models (via Ollama) with the SolidWorks COM API.

Allows LLMs such as qwen3:8b and qwen3:30b-a3b to inspect the design state, analyze the feature tree, read dimensions, query equations, extract physical mass properties, and export technical files in an automated and structured way.


🎯 Project Scope

  • Level 1 (Current Phase - Reading): Non-destructive inspection of parts, assemblies, dimensions, equations, mass, and FEA studies.

  • Level 2 (Future Phase - Editing): Parametric modification of dimensions, global variables, and controlled rebuild.

  • Level 3 (Future Phase - Generation): Creation of 2D/3D sketches, features, and automated macros.


Related MCP server: solidworks-mcp

πŸ“‚ Project Structure

LOCAL LLM/
β”œβ”€β”€ requirements.txt         # Dependencias Python (mcp, pywin32, pydantic, ollama, etc.)
β”œβ”€β”€ pyproject.toml           # ConfiguraciΓ³n del paquete y testing
β”œβ”€β”€ .env.example             # Plantilla de variables de entorno
β”œβ”€β”€ .env                     # ConfiguraciΓ³n activa local
β”œβ”€β”€ src/
β”‚   └── sw_bridge/
β”‚       β”œβ”€β”€ config.py         # Carga de configuraciΓ³n (pydantic-settings)
β”‚       β”œβ”€β”€ logging_config.py # Logging estructurado JSON por sesiΓ³n
β”‚       β”œβ”€β”€ server.py         # Servidor MCP (fastmcp / stdio / sse)
β”‚       β”œβ”€β”€ sw_connection/    # ConexiΓ³n COM a SolidWorks
β”‚       β”‚   β”œβ”€β”€ connector.py  # Singleton y reconexiΓ³n automΓ‘tica
β”‚       β”‚   β”œβ”€β”€ exceptions.py # Excepciones tipadas
β”‚       β”‚   └── models.py     # Modelos de datos Pydantic
β”‚       └── tools/            # Herramientas de Nivel 1
β”‚           β”œβ”€β”€ document_tools.py
β”‚           β”œβ”€β”€ feature_tree_tools.py
β”‚           β”œβ”€β”€ dimension_tools.py
β”‚           β”œβ”€β”€ mass_props_tools.py
β”‚           β”œβ”€β”€ export_tools.py
β”‚           └── fea_tools.py
β”œβ”€β”€ tests/                    # Pruebas automatizadas (pytest)
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ test_tool_calling.py  # ValidaciΓ³n de llamadas a funciones con Ollama
β”‚   └── smoke_test.py         # Smoke test contra SolidWorks
└── docs/                     # Especificaciones y resoluciΓ³n de problemas
    β”œβ”€β”€ alcance.md
    β”œβ”€β”€ tool_schemas.md
    └── troubleshooting.md

πŸš€ Installation and Setup

1. Activate the virtual environment

.\sw-mcp-env\Scripts\activate

2. Verify models in Ollama

Make sure you have the model with tool support available:

ollama list
ollama show qwen3:8b

3. Test Tool Calling with the local LLM

.\sw-mcp-env\Scripts\python scripts/test_tool_calling.py

4. Run Test Suite

.\sw-mcp-env\Scripts\pytest tests/ -v

5. Start the MCP Server (stdio Mode)

.\sw-mcp-env\Scripts\python -m sw_bridge.server --transport stdio

πŸ› οΈ Available Tools (Level 1)

Tool

Description

check_solidworks_status

Checks if SolidWorks is responding via COM.

get_active_document_info

Gets type, path, configurations, and saved state.

list_open_documents

Lists all documents loaded in the session.

get_feature_tree

Extracts the complete feature tree (FeatureManager).

get_feature_details

Inspects definition and parameters of a feature.

list_dimensions

Lists numeric dimensions of the model or a feature.

get_equations

Reads equations and global variables from the equation manager.

get_mass_properties

Calculates mass (kg), volume, center of gravity, and inertia.

export_step

Exports the active model to neutral STEP format.

export_pdf

Exports the 2D drawing or active view to PDF.

export_screenshot

Saves a high-resolution screenshot in PNG format.

list_simulation_studies

Lists finite element analysis (FEA) studies.

get_simulation_study_results

Queries von Mises stresses and safety factors.


βš™οΈ Configuration as MCP Server in Antigravity / Claude Desktop

Add the following configuration to your MCP client:

{
  "mcpServers": {
    "solidworks-bridge": {
      "command": "C:\\Users\\said\\Desktop\\LOCAL LLM\\sw-mcp-env\\Scripts\\python.exe",
      "args": ["-m", "sw_bridge.server", "--transport", "stdio"],
      "cwd": "C:\\Users\\said\\Desktop\\LOCAL LLM"
    }
  }
}

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    MCP server that exposes CAD geometry reasoning over STEP files to LLMs, allowing natural language queries about parts, assemblies, dimensions, holes, and mass properties.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP bridge server for SolidWorks that enables AI assistants to control SolidWorks programmatically via COM automation.
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI (e.g., Claude) to control SolidWorks via natural language, automating part creation, sketching, and feature operations through the Model Context Protocol.
    1
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    An MCP server that drives SolidWorks 2023+ on Windows, exposing CAD operations like sketching, extrusions, assemblies, and exports through tools for AI assistants like Kimi and Claude.
    -