solidworks_mcp.server¶
solidworks_mcp.server ¶
Main SolidWorks MCP Server implementation using FastMCP and PydanticAI.
This server provides 88+ tools for comprehensive SolidWorks automation with configurable deployment (local/remote) and security options.
Attributes¶
AGENT_SYSTEM_PROMPT
module-attribute
¶
AGENT_SYSTEM_PROMPT = 'You are a SolidWorks automation expert. You have access to comprehensive SolidWorks tools for CAD automation, modeling, drawing creation, analysis, and file management. Always prioritize safety, accuracy, and user intent. For complex operations, break them down into manageable steps.'
Classes¶
AdapterResult
dataclass
¶
AdapterResult(status: AdapterResultStatus, data: T | None = None, error: str | None = None, execution_time: float | None = None, metadata: dict[str, Any] | None = None)
Bases: Generic[T]
Result wrapper for adapter operations.
Attributes:
| Name | Type | Description |
|---|---|---|
data |
T | None
|
The data value. |
error |
str | None
|
The error value. |
execution_time |
float | None
|
The execution time value. |
metadata |
dict[str, Any] | None
|
The metadata value. |
status |
AdapterResultStatus
|
The status value. |
CachePolicy
dataclass
¶
Cache policy options for adapter responses.
Attributes:
| Name | Type | Description |
|---|---|---|
default_ttl_seconds |
int
|
The default ttl seconds value. |
enabled |
bool
|
The enabled value. |
max_entries |
int
|
The max entries value. |
ComplexityAnalyzer ¶
Analyze operation complexity and recommend COM or VBA execution path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameter_threshold
|
int
|
The parameter threshold value. Defaults to 12. |
12
|
score_threshold
|
float
|
The score threshold value. Defaults to 0.6. |
0.6
|
Attributes:
| Name | Type | Description |
|---|---|---|
_parameter_threshold |
Any
|
The parameter threshold value. |
_score_threshold |
Any
|
The score threshold value. |
Initialize analyzer state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameter_threshold
|
int
|
The parameter threshold value. Defaults to 12. |
12
|
score_threshold
|
float
|
The score threshold value. Defaults to 0.6. |
0.6
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/complexity_analyzer.py
Functions¶
analyze ¶
Produce a routing recommendation for an operation call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operation
|
str
|
Callable object executed by the helper. |
required |
payload
|
object
|
The payload value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
RoutingDecision |
RoutingDecision
|
The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/complexity_analyzer.py
record_result ¶
Record operation outcome for future routing influence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operation
|
str
|
Callable object executed by the helper. |
required |
route
|
str
|
The route value. |
required |
success
|
bool
|
The success value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/complexity_analyzer.py
DeploymentMode ¶
Bases: StrEnum
Deployment mode options.
Attributes:
| Name | Type | Description |
|---|---|---|
HYBRID |
Any
|
The hybrid value. |
LOCAL |
Any
|
The local value. |
REMOTE |
Any
|
The remote value. |
IntelligentRouter ¶
IntelligentRouter(analyzer: ComplexityAnalyzer, cache: ResponseCache, cacheable_operations: set[str] | None = None)
Route operations between COM and VBA paths using complexity analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
analyzer
|
ComplexityAnalyzer
|
The analyzer value. |
required |
cache
|
ResponseCache
|
The cache value. |
required |
cacheable_operations
|
set[str] | None
|
The cacheable operations value. Defaults to None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
_analyzer |
Any
|
The analyzer value. |
_cache |
Any
|
The cache value. |
_cacheable_operations |
Any
|
The cacheable operations value. |
Initialize router dependencies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
analyzer
|
ComplexityAnalyzer
|
The analyzer value. |
required |
cache
|
ResponseCache
|
The cache value. |
required |
cacheable_operations
|
set[str] | None
|
The cacheable operations value. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/intelligent_router.py
Functions¶
execute
async
¶
execute(operation: str, payload: object, call_args: tuple[Any, ...], call_kwargs: dict[str, Any], com_operation: OperationCallable, vba_operation: OperationCallable | None, cache_ttl_seconds: int | None = None) -> tuple[AdapterResult[Any], RouteResult]
Provide execute support for the intelligent router.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operation
|
str
|
Callable object executed by the helper. |
required |
payload
|
object
|
The payload value. |
required |
call_args
|
tuple[Any, ...]
|
The call args value. |
required |
call_kwargs
|
dict[str, Any]
|
The call kwargs value. |
required |
com_operation
|
OperationCallable
|
The com operation value. |
required |
vba_operation
|
OperationCallable | None
|
The vba operation value. |
required |
cache_ttl_seconds
|
int | None
|
The cache ttl seconds value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[AdapterResult[Any], RouteResult]
|
tuple[AdapterResult[Any], RouteResult]: A tuple containing the resulting values. |
Source code in src/solidworks_mcp/adapters/intelligent_router.py
MCPServerState ¶
Bases: BaseModel
Server state management - serializable fields only.
Attributes:
| Name | Type | Description |
|---|---|---|
adapter |
Any | None
|
The adapter value. |
agent |
Any | None
|
The agent value. |
config |
SolidWorksMCPConfig
|
The config value. |
is_connected |
bool
|
The is connected value. |
startup_time |
str | None
|
The startup time value. |
tool_count |
int
|
The tool count value. |
ResponseCache ¶
Thread-safe in-memory cache for adapter response objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
policy
|
CachePolicy
|
The policy value. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
_lock |
Any
|
The lock value. |
_policy |
Any
|
The policy value. |
Initialize this cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
policy
|
CachePolicy
|
The policy value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/cache/response_cache.py
Attributes¶
enabled
property
¶
Return whether caching is enabled.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if enabled, otherwise False. |
Functions¶
get ¶
Fetch a cached value when present and unexpired.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The key value. |
required |
Returns:
| Type | Description |
|---|---|
object | None
|
object | None: The result produced by the operation. |
Source code in src/solidworks_mcp/cache/response_cache.py
make_key ¶
Build a deterministic cache key from an operation payload.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operation
|
str
|
Callable object executed by the helper. |
required |
payload
|
object
|
The payload value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The resulting text value. |
Source code in src/solidworks_mcp/cache/response_cache.py
set ¶
Store a cache value with expiration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The key value. |
required |
value
|
object
|
The value value. |
required |
ttl_seconds
|
int | None
|
The ttl seconds value. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/cache/response_cache.py
SolidWorksMCPConfig ¶
Bases: BaseModel
Main configuration for SolidWorks MCP Server.
Attributes:
| Name | Type | Description |
|---|---|---|
adapter_type |
AdapterType
|
The adapter type value. |
allowed_hosts |
list[str]
|
The allowed hosts value. |
allowed_origins |
list[str]
|
The allowed origins value. |
api_key |
SecretStr | None
|
The api key value. |
api_key_required |
bool
|
The api key required value. |
api_keys |
list[str]
|
The api keys value. |
cache_dir |
Path | None
|
The cache dir value. |
circuit_breaker_enabled |
bool
|
The circuit breaker enabled value. |
circuit_breaker_threshold |
int
|
The circuit breaker threshold value. |
circuit_breaker_timeout |
int
|
The circuit breaker timeout value. |
complexity_parameter_threshold |
int
|
The complexity parameter threshold value. |
complexity_score_threshold |
float
|
The complexity score threshold value. |
connection_pool_size |
int
|
The connection pool size value. |
connection_pooling |
bool
|
The connection pooling value. |
cors_origins |
list[str]
|
The cors origins value. |
data_dir |
Path
|
The data dir value. |
database_url |
str
|
The database url value. |
debug |
bool
|
The debug value. |
deployment_mode |
DeploymentMode
|
The deployment mode value. |
enable_analysis_tools |
bool
|
The enable analysis tools value. |
enable_audit_logging |
bool
|
The enable audit logging value. |
enable_circuit_breaker |
bool
|
The enable circuit breaker value. |
enable_connection_pooling |
bool
|
The enable connection pooling value. |
enable_cors |
bool
|
The enable cors value. |
enable_design_tables |
bool
|
The enable design tables value. |
enable_intelligent_routing |
bool
|
The enable intelligent routing value. |
enable_macro_recording |
bool
|
The enable macro recording value. |
enable_pdm |
bool
|
The enable pdm value. |
enable_rate_limiting |
bool
|
The enable rate limiting value. |
enable_response_cache |
bool
|
The enable response cache value. |
enable_sql_integration |
bool
|
The enable sql integration value. |
enable_windows_validation |
bool
|
The enable windows validation value. |
host |
str
|
The host value. |
log_file |
Path | None
|
The log file value. |
log_level |
str
|
The log level value. |
max_connections |
int
|
The max connections value. |
max_retries |
int
|
The max retries value. |
mock_solidworks |
bool
|
The mock solidworks value. |
model_config |
Any
|
The model config value. |
pdm_server |
str | None
|
The pdm server value. |
pdm_vault |
str | None
|
The pdm vault value. |
port |
int
|
The port value. |
rate_limit_enabled |
bool
|
The rate limit enabled value. |
rate_limit_per_minute |
int
|
The rate limit per minute value. |
response_cache_max_entries |
int
|
The response cache max entries value. |
response_cache_ttl_seconds |
int
|
The response cache ttl seconds value. |
security_level |
SecurityLevel
|
The security level value. |
solidworks_path |
str | None
|
The solidworks path value. |
solidworks_year |
int | None
|
The solidworks year value. |
sql_connection |
str | None
|
The sql connection value. |
state_file |
str | None
|
The state file value. |
testing |
bool
|
The testing value. |
timeout_seconds |
float
|
The timeout seconds value. |
worker_processes |
int
|
The worker processes value. |
Attributes¶
can_use_solidworks
property
¶
Check if SolidWorks integration is possible.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if use solidworks, otherwise False. |
is_windows
property
¶
Check if running on Windows.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if windows, otherwise False. |
Functions¶
from_env
classmethod
¶
Build configuration from environment variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
env_file
|
str | None
|
The env file value. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
SolidWorksMCPConfig |
SolidWorksMCPConfig
|
The result produced by the operation. |
Source code in src/solidworks_mcp/config.py
get_database_config ¶
Get database configuration.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: A dictionary containing the resulting values. |
get_security_config ¶
Get security configuration.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: A dictionary containing the resulting values. |
Source code in src/solidworks_mcp/config.py
model_post_init ¶
Post-initialization setup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
__context
|
Any
|
The context value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/config.py
set_cache_dir
classmethod
¶
Set default cache directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Path | None
|
The v value. |
required |
info
|
ValidationInfo
|
The info value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Path |
Path
|
The result produced by the operation. |
Source code in src/solidworks_mcp/config.py
set_log_file
classmethod
¶
Set default log file path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
Path | None
|
The v value. |
required |
info
|
ValidationInfo
|
The info value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Path |
Path
|
The result produced by the operation. |
Source code in src/solidworks_mcp/config.py
sync_legacy_alias_fields ¶
Sync test/developer alias fields into canonical runtime fields.
Several fixtures and scripts still populate compatibility fields such as
rate_limit_enabled and connection_pooling. Runtime code reads the canonical
fields, so normalize them here after validation.
Returns:
| Name | Type | Description |
|---|---|---|
SolidWorksMCPConfig |
SolidWorksMCPConfig
|
The result produced by the operation. |
Source code in src/solidworks_mcp/config.py
validate_adapter_type
classmethod
¶
Validate adapter type based on platform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
AdapterType
|
The v value. |
required |
info
|
ValidationInfo
|
The info value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
AdapterType |
AdapterType
|
The result produced by the operation. |
Source code in src/solidworks_mcp/config.py
validate_complexity_parameter_threshold
classmethod
¶
Validate the complexity parameter threshold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
int
|
The v value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The computed numeric result. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Complexity_parameter_threshold must be >= 1. |
Source code in src/solidworks_mcp/config.py
validate_complexity_score_threshold
classmethod
¶
Validate the complexity score threshold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
float
|
The v value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The computed numeric result. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Complexity_score_threshold must be in (0, 1]. |
Source code in src/solidworks_mcp/config.py
validate_port
classmethod
¶
Validate the port.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
int
|
The v value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The computed numeric result. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Port must be between 1 and 65535. |
Source code in src/solidworks_mcp/config.py
validate_response_cache_max_entries
classmethod
¶
Validate response cache size.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
int
|
The v value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The computed numeric result. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Response_cache_max_entries must be >= 1. |
Source code in src/solidworks_mcp/config.py
validate_response_cache_ttl_seconds
classmethod
¶
Validate default response cache TTL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
int
|
The v value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The computed numeric result. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Response_cache_ttl_seconds must be >= 1. |
Source code in src/solidworks_mcp/config.py
validate_timeout
classmethod
¶
Validate the timeout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
float
|
The v value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The computed numeric result. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Timeout_seconds must be > 0. |
Source code in src/solidworks_mcp/config.py
SolidWorksMCPError ¶
Bases: Exception
Base exception for SolidWorks MCP Server errors.
SolidWorksMCPServer ¶
Main SolidWorks MCP Server class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
SolidWorksMCPConfig
|
Configuration values for the operation. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
_db_logging_enabled |
Any
|
The db logging enabled value. |
_db_path |
Any
|
The db path value. |
_db_run_id |
Any
|
The db run id value. |
_setup_complete |
Any
|
The setup complete value. |
config |
Any
|
The config value. |
mcp |
Any
|
The mcp value. |
server |
Any
|
The server value. |
state |
Any
|
The state value. |
Initialize the solid works mcpserver.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
SolidWorksMCPConfig
|
Configuration values for the operation. |
required |
Source code in src/solidworks_mcp/server.py
Functions¶
health_check
async
¶
Get server health status.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: A dictionary containing the resulting values. |
Source code in src/solidworks_mcp/server.py
setup
async
¶
Initialize the server components.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/server.py
start
async
¶
Start the MCP server.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/server.py
stop
async
¶
Gracefully stop the server.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/server.py
VbaGeneratorAdapter ¶
Adapter that executes complex operations through VBA-oriented flow.
This adapter currently uses the wrapped COM adapter for final execution, but annotates responses as VBA-routed and can be extended to execute generated macros directly in future iterations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backing_adapter
|
Any
|
The backing adapter value. |
required |
macro_executor
|
VbaMacroExecutor | None
|
The macro executor value. Defaults to None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
_backing_adapter |
Any
|
The backing adapter value. |
_macro_executor |
Any
|
The macro executor value. |
config |
Any
|
The config value. |
Initialize the vba generator adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backing_adapter
|
Any
|
The backing adapter value. |
required |
macro_executor
|
VbaMacroExecutor | None
|
The macro executor value. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/vba_adapter.py
Functions¶
__getattr__ ¶
Delegate unknown members to backing adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
item
|
str
|
The item value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/vba_adapter.py
connect
async
¶
Connect to SolidWorks using wrapped adapter.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
create_extrusion
async
¶
Create the extrusion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
ExtrusionParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[Any]
|
AdapterResult[Any]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/vba_adapter.py
create_loft
async
¶
Create the loft.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
LoftParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[Any]
|
AdapterResult[Any]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/vba_adapter.py
create_revolve
async
¶
Create the revolve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
RevolveParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[Any]
|
AdapterResult[Any]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/vba_adapter.py
create_sweep
async
¶
Create the sweep.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
SweepParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[Any]
|
AdapterResult[Any]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/vba_adapter.py
disconnect
async
¶
execute_macro
async
¶
execute_macro(macro_code: str, macro_name: str = 'GeneratedMacro', subroutine: str = 'Main') -> AdapterResult[Any]
Provide execute macro support for the vba generator adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
macro_code
|
str
|
The macro code value. |
required |
macro_name
|
str
|
The macro name value. Defaults to "GeneratedMacro". |
'GeneratedMacro'
|
subroutine
|
str
|
The subroutine value. Defaults to "Main". |
'Main'
|
Returns:
| Type | Description |
|---|---|
AdapterResult[Any]
|
AdapterResult[Any]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/vba_adapter.py
get_macro_execution_history ¶
Retrieve VBA macro execution history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
macro_name
|
str | None
|
The macro name value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[ str, Any, |
dict[str, Any]
|
]: A dictionary containing the resulting values. |
Source code in src/solidworks_mcp/adapters/vba_adapter.py
health_check
async
¶
Return wrapped adapter health with VBA route marker.
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/vba_adapter.py
is_connected ¶
Return wrapped adapter connection state.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if connected, otherwise False. |
Functions¶
_run_server
async
¶
Run server lifecycle with graceful shutdown.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server
|
SolidWorksMCPServer
|
The server value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/server.py
_run_with_config
async
¶
Run the server from a fully prepared config object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
SolidWorksMCPConfig
|
Configuration values for the operation. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/server.py
cli ¶
cli(config: str | None = typer.Option(None, '--config', help='Configuration file path'), mode: str | None = typer.Option(None, '--mode', help='Deployment mode (local/remote/hybrid)'), host: str = typer.Option('localhost', '--host', help='Server host for remote mode'), port: int = typer.Option(8000, '--port', help='Server port for remote mode'), debug: bool = typer.Option(False, '--debug', help='Enable debug mode'), mock: bool = typer.Option(False, '--mock', help='Use mock SolidWorks for testing')) -> None
Start the SolidWorks MCP Server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
str | None
|
Configuration values for the operation. Defaults to typer.Option( None, "--config", help="Configuration file path", ). |
Option(None, '--config', help='Configuration file path')
|
mode
|
str | None
|
The mode value. Defaults to typer.Option( None, " --mode", help="Deployment mode (local/remote/hybrid)", ). |
Option(None, '--mode', help='Deployment mode (local/remote/hybrid)')
|
host
|
str
|
The host value. Defaults to typer.Option( "localhost", " --host", help="Server host for remote mode", ). |
Option('localhost', '--host', help='Server host for remote mode')
|
port
|
int
|
The port value. Defaults to typer.Option( 8000, "-- port", help="Server port for remote mode", ). |
Option(8000, '--port', help='Server port for remote mode')
|
debug
|
bool
|
The debug value. Defaults to typer.Option( False, "-- debug", help="Enable debug mode", ). |
Option(False, '--debug', help='Enable debug mode')
|
mock
|
bool
|
The mock value. Defaults to typer.Option( False, "-- mock", help="Use mock SolidWorks for testing", ). |
Option(False, '--mock', help='Use mock SolidWorks for testing')
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/server.py
cli_main ¶
create_server ¶
Create a SolidWorks MCP Server instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
SolidWorksMCPConfig | None
|
Configuration values for the operation. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
SolidWorksMCPServer |
SolidWorksMCPServer
|
The result produced by the operation. |
Source code in src/solidworks_mcp/server.py
insert_tool_event ¶
insert_tool_event(*, run_id: str, tool_name: str, phase: str, payload_json: str | None, db_path: Path | None = None) -> None
Store lifecycle events around MCP tool usage to aid troubleshooting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run_id
|
str
|
The run id value. |
required |
tool_name
|
str
|
The tool name value. |
required |
phase
|
str
|
The phase value. |
required |
payload_json
|
str | None
|
The payload json value. |
required |
db_path
|
Path | None
|
The db path value. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/agents/history_db.py
list_capabilities
async
¶
List all available SolidWorks capabilities and tool categories.
Returns:
| Type | Description |
|---|---|
dict[str, list[str]]
|
dict[str, list[str]]: A dictionary containing the resulting values. |
Source code in src/solidworks_mcp/server.py
load_config ¶
Load configuration from file and environment variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_file
|
str | None
|
The config file value. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
SolidWorksMCPConfig |
SolidWorksMCPConfig
|
The result produced by the operation. |
Source code in src/solidworks_mcp/config.py
main
async
¶
Legacy async entry point retained for tests and internal callers.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/server.py
run_server ¶
Synchronous entry point for the server.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/server.py
server_status
async
¶
Get comprehensive server status information.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: A dictionary containing the resulting values. |