npm run build # TypeScript compile (tsc)
npm run dev # Hot-reload dev server (tsx watch)
npm test # Run unit tests (vitest)
npm run test:watch # Watch mode tests
npm run lint # Biome lint check
npm run lint:fix # Biome auto-fix
npm run format # Biome format
npm run check # TypeScript + Biome in one command
npm run typecheck # Type check without emitImportant: This project requires Windows + SolidWorks to run. The winax native module only compiles on Windows and is an optional dependency. On non-Windows, use npm install --ignore-scripts. Tests use USE_MOCK_SOLIDWORKS=true by default for cross-platform CI.
- MCP Server (
src/index.ts) - Entry point, registers tools via stdio transport - Adapters (
src/adapters/) - COM bridge layer with intelligent routing:winax-adapter.ts- Direct COM via winaxwinax-adapter-enhanced.ts- Enhanced adapter with complexity analysisfeature-complexity-analyzer.ts- Routes operations between direct COM and VBA macro fallbackmacro-generator.ts- Generates VBA code for complex operations
- Tools (
src/tools/) - MCP tool implementations (modeling, sketch, drawing, export, analysis, VBA) - Core API (
src/solidworks/api.ts) - Low-level SolidWorks COM interface
- Never pass
nullto COM optional parameters - useundefinedinstead. COM interpretsnullas VT_NULL which causes type mismatch errors. This is the root cause of SelectByID2 failures. - Prefer feature tree traversal over
SelectByID2for sketch selection. UseFeatureByPositionReverse()+GetTypeName2()to find sketches reliably. - Operations with >12 parameters automatically fall back to VBA macro execution.
- ESM modules (
"type": "module"in package.json) - Zod schemas for all tool input validation
- Winston logging (never use
console.*- it breaks JSON-RPC stdio transport) @ts-ignoreon winax imports is intentional (no type definitions exist)
- Mock adapter (
src/adapters/mock-solidworks-adapter.ts) simulates SolidWorks for CI - Set
USE_MOCK_SOLIDWORKS=falsefor integration tests on Windows with SolidWorks running