Skip to main content

PyMechanical-MCP

PyAnsys Python Apache

PyMechanical-MCP provides a Model Context Protocol (MCP) server that enables AI assistants to interact with Ansys Mechanical through PyMechanical. Use natural language to set up, solve, and postprocess structural, thermal, and multiphysics simulations.

Overview

Key features:

  • Manage Mechanical sessions by launching new instances or connecting to existing ones
  • Run Mechanical scripting workflows through the Mechanical API
  • Execute custom Python and PyMechanical code in a persistent session
  • Export results, capture screenshots, and create custom plots
  • Retrieve built-in guidance for common Mechanical workflow steps
  • Work with local, remote, or containerized Mechanical deployments

Tool surface

You can use 28 tools exposed by the server, grouped as follows:

Group Tools
Connection and lifecycle check_mechanical_status, check_mechanical_installed, launch_mechanical, connect_to_mechanical, disconnect_from_mechanical, list_mechanical_instances
File and project management list_files, upload_file, download_file, download_project, clear_mechanical, save_project, open_project
Mechanical scripting and solve run_python_script, check_script, solve_analysis, get_model_info, get_results_summary, export_results
Object discovery and property changes find_objects, describe_api, preview_property_change, apply_property_change
Visualization and diagnostics screenshot, create_custom_plot, get_mechanical_logs
Persistent Python execution run_python_code
Workflow guidance get_guidelines_for

The server also exposes an MCP resource, files://mechanical/working_directory, that returns the working directory of the connected Mechanical instance.

In v0.3.0, check_mechanical_status replaces get_session_diagnostics and includes its connection ownership, transport, and persistent Python diagnostics, even when Mechanical is disconnected. Update clients that call the old name.

Installation

For users

Install the latest release with:

pip install ansys-mechanical-mcp

Or run directly without installing by using uvx. Install uv and Git first. uv provides uvx, and Git is required because uvx downloads and runs PyMechanical-MCP directly from this repository without cloning it.

uvx --index-strategy unsafe-best-match --from git+https://github.com/ansys/pymechanical-mcp ansys-mechanical-mcp

For developers

git clone https://github.com/ansys/pymechanical-mcp.git
cd pymechanical-mcp
pip install -e ".[dev]"

Usage

For step-by-step setup instructions for VS Code, Claude Code, Claude Desktop, and other MCP-compatible clients, see IDE and client configuration in the documentation.

For launch and connect workflows, including GUI and batch mode behavior, see Quick start.

Configuration

Use STDIO for local MCP clients. Use HTTP transport for remote access in trusted networks or behind infrastructure that provides authentication and TLS.

Run with default STDIO transport:

ansys-mechanical-mcp

Run with HTTP transport:

ansys-mechanical-mcp --transport http --http-host 127.0.0.1 --http-port 8080

Common configuration options:

Option Description
--transport MCP transport type: stdio or http
--ip, --port Mechanical connection target for connect_on_startup or defaults
--connect-on-startup Connect to Mechanical when the MCP server starts
--transport-mode gRPC mode: auto, insecure, mtls, wnua
--certs-dir Directory containing mTLS certificates (ca.crt, client.crt, client.key)
--cors-origins Comma-separated allowed origins for HTTP transport

Environment variables:

Variable Description
PYMECHANICAL_TRANSPORT_MODE Default gRPC transport mode when --transport-mode is not set
ANSYS_GRPC_CERTIFICATES Default certificate directory when --certs-dir is not set
PYMECHANICAL_IP, PYMECHANICAL_PORT Docker connection defaults used by connection and discovery tools

License

This project is licensed under the Apache 2.0 license agreement. See the LICENSE file for details.

Resources

Metadata

Release files for ansys-mechanical-mcp 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ansys-mechanical-mcp 0.3.1
File Size Uploaded Provenance Actions
ansys_mechanical_mcp-0.3.1.tar.gz 78.8 kB With provenance Details for ansys_mechanical_mcp-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ansys-mechanical-mcp 0.3.1
File Interpreter ABI Platform Actions
ansys_mechanical_mcp-0.3.1-py3-none-any.whl Python 3 none any Details for ansys_mechanical_mcp-0.3.1-py3-none-any.whl

Total release size: 163.8 kB

Release files / ansys_mechanical_mcp-0.3.1.tar.gz

Download URL ansys_mechanical_mcp-0.3.1.tar.gz
Size 78.8 kB
Tags Source
SHA-256 checksum
How to use checksums
90f29829551dbdba364963ba5499e64bf5bcab46d8fc99b9b8a1f244c0c23303
BLAKE2b-256 checksum
How to use checksums
54546c2cd4c5cbb35de23a7b0b5166dfe3b022cefa9f739249dc96c1610d5ac3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / ansys_mechanical_mcp-0.3.1-py3-none-any.whl

Download URL ansys_mechanical_mcp-0.3.1-py3-none-any.whl
Size 85.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed5084a088df6eac0770d37301d97a94b5adb2add69c360a4feb88675c996c86
BLAKE2b-256 checksum
How to use checksums
fc408ad5c612c52c39fa3e4de29e77ce6b73a0da0c235b742c995485f48063b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for ansys-mechanical-mcp 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ansys_mechanical_mcp-0.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page