PyMechanicalAppContext#

class ansys.mechanical.mcp.server.PyMechanicalAppContext#

Bases: ansys.common.mcp.context.PyAnsysBaseAppContext

Application context with typed dependencies and CLI options.

Attributes:
mechanicalOptional[Any]

Mechanical instance connection.

transport_typestr

Transport type for PyMechanical-MCP. Options are 'stdio' and 'http'.

mechanical_ipOptional[str]

IP address or hostname for Mechanical connection.

mechanical_portOptional[int]

Port number for Mechanical connection.

connect_on_startupbool

Whether to attempt Mechanical connection on PyMechanical-MCP startup.

http_hoststr

Host address for HTTP transport.

http_portint

Port number for HTTP transport.

cors_originsOptional[list[str]]

List of allowed CORS origins for HTTP transport.

grpc_transport_modeOptional[str]

gRPC transport mode for Mechanical connections. Options are 'auto', 'insecure', 'mtls', and 'wnua'. When set to 'auto' (default), the mode is determined automatically based on the platform and certificate availability.

certs_dirOptional[str]

Path to directory containing mTLS certificate files (ca.crt, client.crt, and client.key). Used when grpc_transport_mode is 'mtls'.

Overview#

Import detail#

from ansys.mechanical.mcp.server import PyMechanicalAppContext

Property detail#

property PyMechanicalAppContext.product_instance: Any | None#

Returns the Mechanical instance for backward compatibility.

Returns:
Optional[Any]

Mechanical instance or None if not connected.

Attribute detail#

PyMechanicalAppContext.mechanical: Any | None = None#
PyMechanicalAppContext.transport_type: str = 'stdio'#
PyMechanicalAppContext.mechanical_ip: str | None = None#
PyMechanicalAppContext.mechanical_port: int | None = None#
PyMechanicalAppContext.connect_on_startup: bool = False#
PyMechanicalAppContext.http_host: str = '127.0.0.1'#
PyMechanicalAppContext.http_port: int = 8080#
PyMechanicalAppContext.cors_origins: list[str] | None = None#
PyMechanicalAppContext.grpc_transport_mode: str | None = None#
PyMechanicalAppContext.certs_dir: str | None = None#