Configuration#

You can configure PyMechanical-MCP through command-line flags and environment variables.

Command-line tool startup flags#

Flag

Description

--transport stdio|http

MCP transport (default stdio).

--http-host / --http-port

HTTP bind address and port for --transport http.

--ip / --port

Mechanical endpoint for connect_to_mechanical and --connect-on-startup.

--connect-on-startup

Connection to Mechanical on startup. Locks lifecycle tools.

--transport-mode

gRPC mode: auto, insecure, mtls, or wnua.

--certs-dir

Path to mTLS certificates directory (ca.crt, and client.crt, client.key).

--cors-origins

Comma-separated allowed origins for HTTP transport.

--on-aali

AALI-specific runtime behavior.

Environment variables#

Variable

Description

PYMECHANICAL_TRANSPORT_MODE

Default gRPC mode when --transport-mode is not passed.

ANSYS_GRPC_CERTIFICATES

Default certificate directory when --certs-dir is not passed.

PYMECHANICAL_IP / PYMECHANICAL_PORT

Preferred endpoint values in containerized deployments.

FASTMCP_LOG_LEVEL

MCP server log verbosity.

Connection-lock behavior#

When you use --connect-on-startup, the server connects to Mechanical during startup and then disables:

  • launch_mechanical

  • connect_to_mechanical

  • disconnect_from_mechanical

This keeps the active session stable for clients that expect a fixed connection lifecycle.

Next steps#