Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ jobs:
shell: bash -el {0}
run: conda run -n solidworks_mcp pip install -e ".[dev,docs,ui]"

- name: Type-check
shell: bash -el {0}
run: make typecheck

- name: Run tests
shell: bash -el {0}
run: make test
Expand Down
42 changes: 41 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,46 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- **`save_body_as_part` leaves no extra assembly open** (queue item 27,
#101): a new, unsaved assembly SolidWorks opens alongside Save Bodies is
closed, the part is made active again, and the reply's
`closed_documents` names it.
- **`execute_macro` runs VBA source** (queue item 26, #96), when the server
is started with `SOLIDWORKS_MCP_ALLOW_VBA_SOURCE` set (off by default:
VBA can do anything the user can). The source is written to a `.swb` file and
run like a macro file, with the dialog watchdog; the reply names the file
and repeats the source. Refused as `vba_source_off` otherwise.
- **Restricted VBA source** (queue item 28): `SOLIDWORKS_MCP_ALLOW_VBA_SOURCE`
is `off` (default), `restricted` or `full`. `restricted` runs source only
when every name in it is a SolidWorks API member, a safe VBA function or
declared by the macro; `Shell`, `CreateObject`, file statements and about
100 SolidWorks members that save, open, run or change settings are refused
as `vba_source_refused`, naming each line. Every value, the blocked list
and the limits are in the installation guide.
- **A macro that waits for the user no longer hangs the server** (queue
item 25, #97): while `execute_macro` runs, a watchdog thread (Win32 only,
no COM) looks for a dialog the SolidWorks process opened. One still open
after `dialog_timeout` seconds (30) is answered with Cancel, or its only
button, and the run fails as `macro_waited_for_user`, naming the dialog.
A Yes/No prompt is left for the user. Checked live.
- **Tool catalog check** (queue item 24, #156): a test reads every catalog
page and fails when a tool has no entry, an entry's parameter table
doesn't match the tool's inputs, or its sample call isn't one the tool
accepts. The 20 tools that had no entry have one, about 30 stale tables
and samples are fixed, and `reset_circuit_breaker` has a Server Admin
page. `src/utils/generate_tool_catalog.py`, which overwrote the
hand-written pages, is removed.
- **`get_api_enum`** (queue item 23, #95): an enum's members and their
integer values, by the enum's name or a member's, read from SolidWorks'
constants type library (`swconst.tlb`), checked live (`swUnitSystem_IPS`
is 3). The API index now holds the enums too (format 2.1; a saved index
is rebuilt once). 140 tools.
- **mypy gates CI** (queue item 17, #157): `make typecheck` runs mypy over
the package, and CI fails on any error. The 139 errors on `main` are
fixed with no change in behaviour, apart from one fault it found:
dimension layout raised `TypeError` for a leader with no lines when asked
to place it inside its view; it now goes outside. Every `# type: ignore`
names its error code (checked by a test).
- **What each tool needs from SolidWorks** (queue item 16, #79): every tool
has a `needs:` tag, `nothing`, `installed` or `running`, from one table
(`tools/requirements.py`). The tools overview lists the 20 tools that
Expand Down Expand Up @@ -794,7 +834,7 @@ Minor release — new tools, all additive and backward compatible.
against `ActiveDoc`.
- **Granular API-lookup tools** (#64) — `lookup_api_method`,
`lookup_api_interface`, `find_related_api_members` in the docs-discovery
layer (`lookup_api_enum` split to a follow-up).
layer (`get_api_enum` split to a follow-up).
- **SoC `script_line` capture** (#28) — every `ToolCallRecord` now stores the
rendered SolidWorks-as-Code line at write time; a startup `ALTER TABLE`
check backfills the column on existing local databases.
Expand Down
3 changes: 2 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ python -m venv .venv
# Run server
.\.venv\Scripts\python.exe -m solidworks_mcp.server

# Lint/tests/docs
# Lint/types/tests/docs (CI runs mypy too and fails on any error)
.\.venv\Scripts\python.exe -m ruff check src tests
.\.venv\Scripts\python.exe -m mypy src/solidworks_mcp
.\.venv\Scripts\python.exe -m pytest tests -m "not solidworks_only"
.\.venv\Scripts\python.exe -m mkdocs build --clean
```
Expand Down
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SolidWorks MCP Server - Simplified Makefile

.PHONY: help install test test-context-budget llms links test-full test-clean docs build run clean lint format
.PHONY: help install test test-context-budget llms links test-full test-clean docs build run clean lint typecheck format

# Default target
.DEFAULT_GOAL := help
Expand Down Expand Up @@ -140,6 +140,14 @@ lint: ## Run code linting
fi
$(CONDA_CMD) run -n solidworks_mcp ruff check src/ tests/

typecheck: ## Type-check the package with mypy (CI fails on any error)
@echo "$(BLUE)Type-checking...$(NC)"
@if [ -z "$(CONDA_CMD)" ]; then \
echo "$(RED)Error: No conda/mamba/micromamba found$(NC)"; \
exit 1; \
fi
$(CONDA_CMD) run -n solidworks_mcp python -m mypy src/solidworks_mcp

format: ## Format code
@echo "$(BLUE)Formatting code...$(NC)"
@if [ -z "$(CONDA_CMD)" ]; then \
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[![SolidWorks](https://img.shields.io/badge/tested%20on-SolidWorks%202026-red)](https://www.solidworks.com/)
[![Coverage](https://codecov.io/gh/andrewbartels1/SolidworksMCP-python/branch/main/graph/badge.svg)](https://codecov.io/gh/andrewbartels1/SolidworksMCP-python)

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

[![115 MCP tools by support level (the 8 deprecated ones not counted), and how much of the core SolidWorks COM API they reach](docs/assets/progress/progress.svg)](https://andrewbartels1.com/SolidworksMCP-python/progress/)

Expand Down Expand Up @@ -366,7 +366,7 @@ It works only with the circuit-breaker adapter wrapper (the default for real Sol

### A shorter tool list

All 139 tools cost about 55,000 tokens a turn. `SOLIDWORKS_MCP_TOOL_MODE=search` lists four instead (about 900 tokens); `SOLIDWORKS_MCP_TOOLSETS=core,drawing` lists only those groups. See [Choose which tools a client sees](https://andrewbartels1.com/SolidworksMCP-python/getting-started/installation/#4-choose-which-tools-a-client-sees).
All 140 tools cost about 55,000 tokens a turn. `SOLIDWORKS_MCP_TOOL_MODE=search` lists four instead (about 900 tokens); `SOLIDWORKS_MCP_TOOLSETS=core,drawing` lists only those groups. See [Choose which tools a client sees](https://andrewbartels1.com/SolidworksMCP-python/getting-started/installation/#4-choose-which-tools-a-client-sees).

## Teach your agent the workflow

Expand Down
18 changes: 13 additions & 5 deletions docs/assets/progress/progress.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"tools": {
"total": 139,
"total": 140,
"by_level": {
"stable": 131,
"stable": 132,
"beta": 0,
"experimental": 0,
"planned": 0,
Expand Down Expand Up @@ -427,7 +427,7 @@
"family": "macro_recording",
"level": "stable",
"reason": "",
"summary": "Run a binary SolidWorks macro (.swp, or legacy .swb) in the running SolidWorks, calling its `main` procedure once."
"summary": "Run a SolidWorks macro (.swp, or legacy .swb), or VBA source text, in the running SolidWorks, calling its `main` procedure."
},
{
"name": "exit_sketch",
Expand Down Expand Up @@ -576,6 +576,13 @@
"reason": "",
"summary": "Write a VBA macro that revolves the selected sketch, with both-direction and thin-wall options."
},
{
"name": "get_api_enum",
"family": "docs_discovery",
"level": "stable",
"reason": "",
"summary": "Look up a SolidWorks API enum's members and their integer values."
},
{
"name": "get_custom_properties",
"family": "engineering_data",
Expand Down Expand Up @@ -987,11 +994,11 @@
"com": {
"type_library": "83A33D31-27C5-11CE-BFD4-00400513BB57x0x34x0",
"core": {
"covered": 251,
"covered": 252,
"total": 2838
},
"api": {
"covered": 276,
"covered": 277,
"total": 5985
},
"interfaces": [
Expand All @@ -1009,6 +1016,7 @@
"GetMassProperties",
"GetMathUtility",
"GetOpenDocumentByName",
"GetProcessID",
"GetUserPreferenceStringValue",
"GetUserPreferenceToggle",
"NewAssembly",
Expand Down
14 changes: 7 additions & 7 deletions docs/assets/progress/progress.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading