Skip to main content
Glama
Said-AER

SolidWorks MCP Bridge

by Said-AER

SolidWorks MCP Bridge 🌉 ⚙️

基于模型上下文协议(MCP)的服务器和集成桥接,用于将本地语言模型(通过Ollama)与SolidWorks的COM API进行通信。

允许像 qwen3:8b 和 qwen3:30b-a3b 这样的LLM以自动化、结构化的方式检查设计状态、分析特征树、读取尺寸、查询方程、提取物理质量属性以及导出技术文件。


🎯 项目范围

  • 级别1(当前阶段 - 读取):对零件、装配体、尺寸、方程、质量和FEA研究进行非破坏性检查。

  • 级别2(未来阶段 - 编辑):尺寸、全局变量的参数化修改以及受控重建。

  • 级别3(未来阶段 - 生成):创建2D/3D草图、特征和自动化宏。


Related MCP server: solidworks-mcp

📂 项目结构

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

🚀 安装与启动

1. 激活虚拟环境

.\sw-mcp-env\Scripts\activate

2. 验证Ollama中的模型

请确保您拥有支持工具调用的模型可用:

ollama list
ollama show qwen3:8b

3. 使用本地LLM测试工具调用

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

4. 运行测试套件

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

5. 启动MCP服务器(stdio模式)

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

🛠️ 可用工具(级别1)

工具

描述

check_solidworks_status

检查SolidWorks是否通过COM响应。

get_active_document_info

获取类型、路径、配置和保存状态。

list_open_documents

列出会话中加载的所有文档。

get_feature_tree

提取完整的特征树(FeatureManager)。

get_feature_details

检查特征的定义和参数。

list_dimensions

列出模型或特征的数值尺寸。

get_equations

读取方程管理器中的方程和全局变量。

get_mass_properties

计算质量(kg)、体积、重心和惯性。

export_step

将活动模型导出为中性STEP格式。

export_pdf

将2D工程图或活动视图导出为PDF。

export_screenshot

以PNG格式保存高分辨率截图。

list_simulation_studies

列出有限元分析(FEA)研究。

get_simulation_study_results

查询von Mises应力和安全系数。


⚙️ 在Antigravity / Claude Desktop中配置为MCP服务器

将以下配置添加到您的MCP客户端:

{
  "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
    D
    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.
    1
    -