PyAnsys Common MCP provides the infrastructure for building Model Context Protocol (MCP) servers for PyAnsys libraries.
This package provides the foundation for creating MCP servers that enable AI assistants (like Claude, ChatGPT) to interact with Ansys products through PyAnsys libraries.
Key features:
- Persistent Python sessions: Maintains stateful code execution across multiple AI requests.
- Lifecycle management: Handles startup, cleanup, and errors automatically.
- Extensible architecture: Uses base classes and patterns for product-specific implementations.
- Logging infrastructure: Uses pre-configured logging that does not interfere with the MCP protocol.
The ansys.common.mcp package currently supports Python 3.12 through
Python 3.14 on Windows, Mac OS, and Linux.
Install the latest package for use with this command:
pip install ansys-common-mcpAlternatively, install the latest PyAnsys Common MCP GitHub package with this command:
pip install git+https://github.com/ansys/pyansys-common-mcp.gitIf you are contributing to PyAnsys Common MCP or creating custom servers, install the package in developer mode:
# Clone the repository
git clone https://github.com/ansys/pyansys-common-mcp.git
cd pyansys-common-mcp
# Install in editable mode with development dependencies
pip install -e .[dev]
# Or install documentation dependencies for building documentation
pip install -e .[doc]To create an MCP server for your PyAnsys library, follow these three main steps:
- Define your custom context: Extend the
PyAnsysBaseAppContextdataclass to store the product-specific state. - Implement your MCP server: Extend the
PyAnsysBaseMCPbase class with startup and cleanup logic. - Create MCP tools: Define tools that interact with your product.
For a complete, production-ready implementation, see the PyMAPDL-MCP repository.
For general PyAnsys questions, email pyansys.core@ansys.com.