Get running quickly with the verified Windows setup.
- Python 3.11+ installed from python.org.
- PATH enabled during Python install.
- Windows 10/11.
- SolidWorks installed (for real automation).
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 .!!! warning "Mock mode vs real mode"
Without --real, the server runs in mock mode — all tool responses are
simulated. Always include --real --year <year> for live SolidWorks work.
Open SolidWorks before restarting the server.
Set %APPDATA%\Code\User\mcp.json:
{
"servers": {
"solidworks-mcp-server": {
"type": "stdio",
"command": "powershell",
"args": [
"-NoProfile",
"-ExecutionPolicy",
"Bypass",
"-File",
"C:\\path\\to\\SolidworksMCP-python\\run-mcp.ps1",
"--real",
"--year",
"2026"
]
}
}
}Replace the script path with your local repository location.
Change 2026 to match your installed SolidWorks year if different.
If you want LM Studio to call SolidWorks tools directly, use an MCP config with mcpServers:
{
"mcpServers": {
"solidworks-mcp-server": {
"command": "powershell",
"args": [
"-NoProfile",
"-ExecutionPolicy",
"Bypass",
"-File",
"C:\\path\\to\\SolidworksMCP-python\\run-mcp.ps1",
"--real",
"--year",
"2026"
]
}
}
}Or run the module directly:
{
"mcpServers": {
"solidworks-mcp-server": {
"command": "C:\\path\\to\\SolidworksMCP-python\\.venv\\Scripts\\python.exe",
"args": ["-m", "solidworks_mcp.server"]
}
}
}Restart LM Studio after updating the file.
Open SolidWorks first, then:
powershell -NoProfile -ExecutionPolicy Bypass -File .\run-mcp.ps1 --real --year 2026Expected log markers:
Platform: WindowsSolidWorks COM interface is availableAdapter Mode: Real SolidWorksRegistered 109 SolidWorks toolsConnected to SolidWorks
If you see Adapter Mode: Mock in the logs, --real was not picked up — check
that your mcp.json args list includes it after the script path.
The adapter methods are awaited because the PyWin32 adapter exposes its SolidWorks operations as async coroutines. If you call these methods without await, Python only creates a coroutine object and the COM operation never actually runs, which leads to warnings like coroutine was never awaited.
asyncio.run(main()) starts an event loop so the awaited adapter calls can execute in order.
import asyncio
from solidworks_mcp.adapters.pywin32_adapter import PyWin32Adapter
from solidworks_mcp.config import load_config
async def main() -> None:
config = load_config()
adapter = PyWin32Adapter(config)
await adapter.connect()
print(f"Connected: {adapter.is_connected()}")
asyncio.run(main())Every SolidWorks operation below is awaited for the same reason: each call is an async adapter method that performs COM work against the running SolidWorks instance. Using await ensures each step finishes before the next one starts, which is important for ordered CAD operations like sketch -> exit sketch -> extrude.
import asyncio
from solidworks_mcp.adapters.base import ExtrusionParameters
from solidworks_mcp.adapters.pywin32_adapter import PyWin32Adapter
from solidworks_mcp.config import load_config
async def main() -> None:
config = load_config()
adapter = PyWin32Adapter(config)
await adapter.connect()
# New part
part_result = await adapter.create_part()
if not part_result.is_success:
raise RuntimeError(f"Failed to create part: {part_result.error}")
# Base sketch
await adapter.create_sketch("Front Plane")
await adapter.add_rectangle(0, 0, 50, 30)
await adapter.exit_sketch()
# Extrude base
await adapter.create_extrusion(ExtrusionParameters(depth=10))
# Add two holes
await adapter.create_sketch("Top Plane")
await adapter.add_circle(10, 10, 2.5)
await adapter.add_circle(40, 10, 2.5)
await adapter.exit_sketch()
await adapter.create_cut_extrude(ExtrusionParameters(depth=10))
print("Bracket created")
await adapter.disconnect()
asyncio.run(main())Reinstall Python from python.org and ensure PATH option is enabled.
.\.venv\Scripts\python.exe -m pip install -e ..\.venv\Scripts\python.exe -m pip install -e .The server is in mock mode. Ensure --real --year 2026 appears in your
mcp.json args after the script path, then restart the server.
- Open SolidWorks before starting the MCP server.
- Confirm
--realis in the server args (see above). - Confirm you are on Windows (COM does not work in WSL).
- Check COM availability:
.\.venv\Scripts\python.exe -c "import win32com.client; print('win32com OK')"