Skip to main content

Model Context Protocol (MCP) server for Ansys Mechanical through PyMechanical

Project description

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 21 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, clear_mechanical, save_project, open_project
Mechanical scripting and solve run_python_script, solve_analysis, get_model_info, export_results
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.

Installation

For users

Install the latest release with:

pip install ansys-mechanical-mcp

Or run directly without installing by using uvx:

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.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ansys_mechanical_mcp-0.1.0.tar.gz (44.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ansys_mechanical_mcp-0.1.0-py3-none-any.whl (49.4 kB view details)

Uploaded Python 3

File details

Details for the file ansys_mechanical_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: ansys_mechanical_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 44.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for ansys_mechanical_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5587b65c57f12908253fb7a7b19924006211b53c3b92ff94a82b535a4a34a646
MD5 f851f01686c7fb30ff090d896fa0082d
BLAKE2b-256 51292c74e055e1f1954cb8de23a1c64ebe5ed84fdd765d9111100cd1190f1d82

See more details on using hashes here.

Provenance

The following attestation bundles were made for ansys_mechanical_mcp-0.1.0.tar.gz:

Publisher: ci.yml on ansys/pymechanical-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ansys_mechanical_mcp-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ansys_mechanical_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d1bae473458b7d9976503f548d26b9e718ad1addc5ed651f2ef2e0240254aa3c
MD5 46b5b882feac6cffae897419a0982c4b
BLAKE2b-256 05be407e23b7df3320bee6429114fd60fbaec25a4e6c487dbbcbd33bfe0da161

See more details on using hashes here.

Provenance

The following attestation bundles were made for ansys_mechanical_mcp-0.1.0-py3-none-any.whl:

Publisher: ci.yml on ansys/pymechanical-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page