A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with SolidWorks CAD software, providing automated design capabilities, macro recording, design tables with SQL integration, VBA generation, and PDM configuration management.
# Install globally
npm install -g solidworks-mcp-server
# The installer will automatically configure Claude Desktop
# Restart Claude Desktop and you're ready to go!
Then in Claude Desktop:
"Generate VBA to batch export all parts in my folder to STEP format"
"Create a parametric design table for a configurable bracket"
"Check for interferences in my assembly"
- Full SolidWorks Control - Open, create, modify, and analyze CAD models
- Macro Recording & Playback - Record operations and generate reusable macros
- Design Tables with SQL - Create parametric designs driven by database data
- PDM Integration - Configure and manage SolidWorks PDM vaults
- VBA Script Generation - Generate VBA scripts from templates with AI assistance
- State Management - Persistent resource states with auto-save
- Resource-Based Architecture - Modular, extensible design pattern
- π§ Part Modeling VBA - Advanced features, patterns, sheet metal, surfaces
- ποΈ Assembly Automation - Mates, components, interference analysis
- π Drawing Generation - Views, dimensions, annotations, tables
- π File & PDM Operations - Batch processing, custom properties, vault management
- βοΈ Advanced Features - Configurations, equations, simulation setup
- π― 100+ VBA Tools - Generate production-ready VBA without coding knowledge
- π― Macro Recording System - Record actions and export to VBA
- π SQL-Driven Design Tables - Connect to databases for parametric designs
- ποΈ PDM Configuration - Manage vault operations, workflows, and automation
- πΎ State Persistence - Track and restore resource states
- ποΈ Resource Registry - Dynamic resource type management
- π Enhanced Logging - Comprehensive operation tracking
- Windows 10/11
- SolidWorks 2021-2025 (licensed installation)
- Node.js 20 or higher
- Claude Desktop
- Optional: SQL Server or PostgreSQL for design tables
- Optional: SolidWorks PDM for vault operations
npm install -g solidworks-mcp-server
Add to your Claude Desktop configuration:
{
"mcpServers": {
"solidworks": {
"command": "npx",
"args": ["solidworks-mcp-server"],
"env": {
"ENABLE_MACRO_RECORDING": "true",
"ENABLE_PDM": "true",
"SQL_CONNECTION": "mssql://server:1433/database"
}
}
}
}
Create a .env
file for advanced configuration:
# SolidWorks Configuration
SOLIDWORKS_PATH=C:/Program Files/SOLIDWORKS Corp/SOLIDWORKS
SOLIDWORKS_VERSION=2024
# Feature Flags
ENABLE_MACRO_RECORDING=true
ENABLE_PDM=true
# Database Configuration (for Design Tables)
SQL_CONNECTION=mssql://localhost:1433/solidworks_db
# PDM Configuration
PDM_VAULT=Engineering
# State Management
STATE_FILE=.solidworks-state.json
# Logging
LOG_LEVEL=info
"Start recording a macro called 'CreateBracket'"
"Create a sketch on the front plane"
"Add a rectangle 100mm x 50mm"
"Extrude 25mm"
"Stop recording and export to VBA"
"Create a design table for parametric box configurations from SQL database"
"Use query: SELECT * FROM box_configurations"
"Map columns: length, width, height to dimensions"
"Generate all configurations"
"Configure PDM vault 'Engineering' for automatic check-in/check-out"
"Set up workflow transition from 'Work in Progress' to 'Released'"
"Create folder structure with permissions for project team"
"Generate VBA to create a parametric bracket with:
- Reference planes offset by 50mm
- Sweep feature along a 3D curve
- Linear pattern with 5 instances
- Sheet metal conversion with 2mm thickness"
"Generate VBA for assembly that:
- Inserts components from a folder
- Creates coincident and distance mates
- Checks for interferences
- Exports mass properties to Excel"
"Generate VBA to process all files in C:\Parts that:
- Opens each SLDPRT file
- Updates custom properties (Part Number, Revision)
- Exports to STEP format
- Checks into PDM vault with comment"
"Generate VBA to create drawings that:
- Creates standard 3-view layout
- Adds section view A-A
- Dimensions all features
- Inserts BOM table
- Exports to PDF"
macro_start_recording
- Begin recording operationsmacro_stop_recording
- End recording and savemacro_export_vba
- Export macro to VBA codemacro_execute
- Run recorded macro
design_table_create
- Create parametric design tabledesign_table_refresh
- Update from SQL sourcedesign_table_add_config
- Add configurationdesign_table_export
- Export configurations
pdm_configure
- Set up vault configurationpdm_checkin
- Check in files with commentspdm_checkout
- Check out for editingpdm_workflow
- Execute workflow transitionspdm_create_structure
- Set up folder hierarchy
resource_create
- Create new resourceresource_list
- List all resourcesresource_get
- Get resource detailsresource_update
- Update resource propertiesresource_delete
- Remove resource
All original tools remain available:
- Modeling tools (create, modify, analyze)
- Drawing tools (views, dimensions, annotations)
- Export tools (STEP, IGES, STL, PDF, etc.)
- VBA tools (generate, execute scripts)
- Analysis tools (mass properties, interference)
{
type: 'design-table',
tableName: string,
parameters: Array<{
name: string,
type: 'dimension' | 'feature' | 'configuration',
dataType: 'number' | 'string' | 'boolean',
sqlColumn?: string,
formula?: string
}>,
dataSource?: {
type: 'sql' | 'file' | 'api',
connectionString?: string,
query?: string
}
}
{
type: 'pdm-configuration',
vaultName: string,
operations: {
checkIn?: { enabled: boolean, comment?: string },
checkOut?: { enabled: boolean, getLatestVersion?: boolean },
workflow?: {
enabled: boolean,
transitions: Array<{
name: string,
fromState: string,
toState: string
}>
}
}
}
git clone https://github.com/vinnieespo/solidworks-mcp-server
cd solidworks-mcp-server
npm install
npm run build
npm test # Run all tests
npm run test:unit # Unit tests only
npm run test:integration # Integration tests
Create a new resource type:
import { SolidWorksResource } from './resources/base';
export class CustomResource extends SolidWorksResource {
readonly type = 'custom-type';
async execute(api: SolidWorksAPI) {
// Implementation
}
toVBACode(): string {
// Generate VBA
}
}
Register the resource:
resourceRegistry.register({
type: 'custom-type',
name: 'Custom Resource',
schema: CustomSchema,
factory: (id, name, props) => new CustomResource(id, name, props)
});
- Ensure macro recording is enabled in environment
- Check that actions are supported for recording
- Verify VBA export permissions
- Verify connection string format
- Check database permissions
- Ensure SQL drivers are installed
- Confirm PDM client is installed
- Verify vault access permissions
- Check network connectivity to PDM server
- Check write permissions for state file
- Clear corrupted state with
resource_clear
- Verify auto-save is enabled
- Batch Operations: Use macro recording for repetitive tasks
- SQL Queries: Optimize queries for large datasets
- State Storage: Periodically clean old states
- PDM Operations: Use batch check-in/check-out
- SQL connections use secure authentication
- PDM credentials are not stored in state
- Macro execution requires explicit permission
- State files can be encrypted (configure in .env)
MIT License - see LICENSE file
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
- Additional resource types
- Enhanced SQL integrations
- More VBA templates
- PDM workflow automation
- Testing improvements
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: [email protected]
- Real-time collaboration features
- Cloud storage integration
- Advanced simulation tools
- Custom property management
- AI-powered design suggestions
- Automated testing framework
- Performance optimization tools
- Extended PDM capabilities
See CHANGELOG.md for version history.
Built with β€οΈ for the SolidWorks community