Skip to content

Architecture Overview

The SolidWorks MCP Server implements an intelligent, multi-layered architecture designed to overcome the limitations of traditional COM-based SolidWorks automation while providing enterprise-grade reliability and security.

High-Level Architecture

flowchart TB
    subgraph "Client Layer"
        Claude["Claude Desktop"]
        Custom["Custom Applications"]  
        Web["Web Interface"]
    end

    subgraph "MCP Protocol Layer"
        Transport["JSON-RPC Transport"]
        Protocol["MCP Protocol Handler"]
        Auth["Authentication & Security"]
    end

    subgraph "Application Layer"
        Router["Intelligent Router"]
        Tools["Tool Registry (90+)"]
        Cache["Response Cache"]
    end

    subgraph "Adapter Layer"
        Analyzer["Complexity Analyzer"]
        COM["Direct COM Adapter"]
        VBA["VBA Generator Adapter"]
        Breaker["Circuit Breaker"]
    end

    subgraph "SolidWorks Layer"
        SW["SolidWorks Application"]
        API["SolidWorks API"]
        Macros["VBA Execution Engine"]
    end

    Claude --> Transport
    Custom --> Transport
    Web --> Transport

    Transport --> Protocol
    Protocol --> Auth
    Auth --> Router

    Router --> Tools
    Router --> Cache
    Tools --> Analyzer

    Analyzer --> COM
    Analyzer --> VBA
    COM --> Breaker
    VBA --> Breaker

    Breaker --> SW
    COM --> API
    VBA --> Macros

Core Components

1. Intelligent Router

The core orchestrator that:

  • Route Selection: Determines optimal execution path based on operation complexity
  • Load Balancing: Distributes requests across available SolidWorks instances
  • Fallback Management: Handles failures gracefully with automatic retry strategies
  • Caching: Stores frequently accessed data to improve performance

2. Complexity Analyzer

Advanced analysis engine that examines operations to determine the best execution strategy:

Analysis Criteria

  • Parameter Count: Operations with 13+ parameters typically require VBA
  • Operation Type: Certain operations (sweeps, lofts) are VBA-preferred
  • Data Complexity: Large datasets benefit from VBA batch processing
  • Performance History: Past success/failure rates influence routing decisions

Decision Tree

flowchart TD
    A[Tool Request] --> B{Parameter Count}
    B -->|"≤12"| C{Operation Type}
    B -->|">12"| D[VBA Generator]

    C -->|Simple| E[Direct COM]
    C -->|Complex| F{Performance History}

    F -->|"Good COM History"| E
    F -->|"Poor COM History"| D

    E --> G{Success?}
    D --> H{Success?}

    G -->|Yes| I[Return Result]
    G -->|No| J[Circuit Breaker]

    H -->|Yes| I
    H -->|No| K[Error Handler]

    J --> L{Retry Count}
    L -->|"< Max"| D
    L -->|"= Max"| M[Report Failure]

3. Adapter Architecture

Dual-adapter system providing multiple execution paths:

Direct COM Adapter

  • Speed: Fastest execution for simple operations
  • Reliability: Direct API access with immediate feedback
  • Limitations: Parameter count restrictions, complex operation failures
  • Use Cases: Basic modeling, simple sketches, property queries

VBA Generator Adapter

  • Flexibility: Handles any operation complexity
  • Reliability: Robust handling of complex parameter sets
  • Performance: Optimized batch operations
  • Use Cases: Complex features, batch processing, advanced operations

4. Security Architecture

Multi-layered security system with configurable protection levels:

flowchart TB
    subgraph "Security Layers"
        Auth["Authentication Layer"]
        Authz["Authorization Layer"]  
        Tool["Tool Access Control"]
        File["File System Security"]
        VBA["VBA Execution Control"]
    end

    subgraph "Security Levels"
        Dev["Development (High Risk)"]
        Rest["Restricted (Medium Risk)"]
        Sec["Secure (Low Risk)"]
        Lock["Locked (Minimal Risk)"]
    end

    Request["Client Request"] --> Auth
    Auth --> Authz
    Authz --> Tool
    Tool --> File
    File --> VBA

    VBA --> Dev
    VBA --> Rest  
    VBA --> Sec
    VBA --> Lock

Security Level Matrix

Feature Development Restricted Secure Locked
Tool Access All 90+ Safe/Moderate Read-only Analysis only
File System Full Limited paths Read-only None
VBA Execution Enabled Controlled Disabled Disabled
Network Access Enabled Disabled Disabled Disabled
Authentication None API Key OAuth2 JWT

5. Connection Management

Enterprise-grade connection handling:

Connection Pool

  • Instance Reuse: Maintains pool of SolidWorks instances
  • Load Distribution: Balances requests across instances
  • Health Monitoring: Tracks instance health and performance
  • Auto-scaling: Adds/removes instances based on demand

Circuit Breaker Pattern

stateDiagram-v2
    [*] --> Closed
    Closed --> Open : Failure threshold reached
    Open --> HalfOpen : Timeout elapsed
    HalfOpen --> Closed : Success
    HalfOpen --> Open : Failure

    note right of Closed : Normal operation
    note right of Open : Reject requests
    note right of HalfOpen : Test recovery

Performance Optimizations

Caching Strategy

Multi-Level Caching

  1. Result Cache: Stores operation results for reuse
  2. Feature Cache: Caches SolidWorks feature trees
  3. Property Cache: Stores frequently accessed properties
  4. Query Cache: Caches complex queries and analyses

Cache Invalidation

  • Time-based: TTL expiration for dynamic data
  • Event-based: Invalidation on model changes
  • Manual: Explicit cache clearing commands

Asynchronous Operations

Non-blocking Design

  • Async Tools: All tools support asynchronous execution
  • Background Processing: Long operations run in background
  • Progress Tracking: Real-time progress for lengthy operations
  • Cancellation: Ability to cancel in-progress operations

Batch Processing

  • Queue Management: Smart queueing of batch operations
  • Resource Allocation: Optimal resource utilization
  • Error Recovery: Robust handling of batch failures
  • Progress Reporting: Detailed batch progress tracking

Error Handling

Comprehensive Error Strategy

Error Classification

  1. Transient Errors: Network, temporary SolidWorks issues
  2. Configuration Errors: Invalid parameters, missing files
  3. System Errors: SolidWorks crashes, COM failures
  4. Security Errors: Access denied, authentication failures

Recovery Mechanisms

  • Automatic Retry: Configurable retry with exponential backoff
  • Graceful Degradation: Fallback to simpler operations
  • Health Checks: Proactive system health monitoring
  • Alerting: Configurable error notification system

Monitoring and Observability

Comprehensive Logging

  • Structured Logging: JSON-formatted logs for analysis
  • Performance Metrics: Operation timing and resource usage
  • Security Audit: Complete audit trail of all operations
  • Health Metrics: System health and performance indicators

Metrics Collection

flowchart LR
    App["Application"] --> Metrics["Metrics Collector"]
    Metrics --> Store["Metrics Store"]
    Store --> Dash["Dashboard"]
    Store --> Alert["Alerting"]

    subgraph "Key Metrics"
        Perf["Performance"]
        Error["Error Rates"]  
        Usage["Tool Usage"]
        Health["Health Status"]
    end

Deployment Patterns

Local Development

  • Single instance with mock SolidWorks for testing
  • Full debugging and development tool access
  • Hot reloading for rapid development

Enterprise Production

  • Load-balanced multiple instances
  • Database-backed caching and state management
  • Comprehensive monitoring and alerting
  • Security hardening and audit compliance

Cloud Deployment

  • Containerized instances with orchestration
  • Auto-scaling based on demand
  • Distributed caching and state management
  • Global load balancing and CDN integration

Next Steps

  • Learn about Tools Overview to understand available capabilities
  • Check the Getting Started Guide for practical examples
  • Review the codebase for technical implementation details