ANSYS MCP Server
Provides tools for driving ANSYS simulation software (Fluent, Mechanical, Geometry) via MCP, enabling CFD, structural analysis, and geometry modeling with script generation and TUI mapping.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ANSYS MCP ServerRun a CFD simulation with inlet velocity 10 m/s and k-epsilon turbulence model"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ANSYS MCP Server
ANSYS MCP Server 是一个基于 Model Context Protocol (MCP) 的服务器,用于驱动 ANSYS 系列仿真软件,包括 Fluent、Mechanical 和 Geometry。
内置 ansys-fluent-tui-guide Skill,自动将每个 MCP 操作映射为对应的 TUI 命令,并生成可复现的 .jou 脚本。
项目结构
mcp/
├── server.py ← MCP 服务器主程序
├── requirements.txt
├── .mcp.json.example ← MCP 配置文件模板
├── scripts/
│ └── mechanical_start_grpc.py ← Mechanical gRPC 启动脚本
└── ansys-fluent-tui-guide/ ← TUI 命令指导 Skill
├── SKILL.md ← Skill 核心定义
├── references/ ← 300+ TUI 命令参考文档
│ ├── MCP_TUI_MAPPING.md ← MCP ↔ TUI 完整映射表
│ └── ANSYS_Fluent_TUI_Complete_Reference.md
└── scripts/
└── mcp_tui_auto_mapper.py ← 自动映射器(已集成到 server.py)Related MCP server: OpenVSP MCP Server
功能特性
🔗 MCP + Skill 联动(核心特性)
每次调用 Fluent MCP 工具时,自动:
步骤 | 行为 |
① 执行操作 | MCP 工具执行实际的 ANSYS 操作 |
② TUI 映射 | 自动映射到等效 TUI 命令 |
③ 脚本累积 | 记录操作序列,可随时导出 |
新增 MCP 工具:
工具 | 功能 |
| 获取当前累积的完整 |
| 获取 MCP→TUI 完整映射报告 |
| 清除映射历史(开始新的工作流) |
Fluent (CFD) — 19 个工具
启动/连接 Fluent solver
加载 case/mesh 文件
设置求解器参数(湍流模型:laminar / k-epsilon / k-omega / SST / Spalart-Allmaras)
设置边界条件和材料
初始化流场、迭代计算
获取残差值
保存 case/data
执行 TUI 命令
加载和管理 UDF
MCP→TUI 自动映射 + 脚本生成
Mechanical (结构分析) — 11 个工具
启动/连接 Mechanical(支持连接已运行的实例)
导入几何文件
分配材料
划分网格
施加载荷和约束
执行求解
提取结果(变形、应力、应变)
执行 IronPython 脚本
提示: 连接已运行的 Mechanical 实例时,需要先在 Mechanical 中启动 gRPC 服务器。详见 辅助脚本 章节。
Geometry (几何建模) — 10 个工具
启动 Geometry 建模器
创建几何设计
创建基本几何体(方块、圆柱、球体)
导入/导出 CAD 文件
安装
1. 创建虚拟环境
python -m venv .venv2. 激活虚拟环境
Windows:
.venv\Scripts\activateLinux/Mac:
source .venv/bin/activate3. 安装依赖
pip install -r requirements.txt配置
Claude Code / Claude Desktop 配置
复制 .mcp.json.example 为 .mcp.json,并修改以下配置:
{
"mcpServers": {
"ansys-mcp": {
"command": "path/to/.venv/Scripts/python.exe",
"args": ["-u", "path/to/server.py"],
"env": {
"AWP_ROOT242": "path/to/ANSYS/Inc/v242",
"PYTHONUNBUFFERED": "1"
}
}
}
}环境变量
AWP_ROOT242: ANSYS 安装路径(如C:\Program Files\ANSYS Inc\v242)
使用方法
启动 MCP 服务器后,可以通过 Claude Code 或其他 MCP 客户端调用以下工具:
Fluent 工具
工具 | 说明 |
| 启动或连接 Fluent |
| 加载算例文件 |
| 加载网格文件 |
| 设置求解器参数 |
| 设置边界条件 |
| 设置材料 |
| 初始化流场 |
| 迭代计算 |
| 获取残差 |
| 保存文件 |
| 执行 TUI 命令 |
| 加载 UDF |
| 挂钩 UDF 到边界 |
| 列出 UDF 状态 |
| 查看状态 |
| 关闭 Fluent |
| 🆕 导出累积的 .jou 脚本 |
| 🆕 获取 MCP→TUI 映射报告 |
| 🆕 重置映射历史 |
Mechanical 工具
工具 | 说明 |
| 启动或连接 Mechanical |
| 导入几何 |
| 分配材料 |
| 划分网格 |
| 施加载荷 |
| 执行求解 |
| 提取结果 |
| 列出几何体/Named Selections |
| 执行脚本 |
| 查看状态 |
| 关闭 Mechanical |
Geometry 工具
工具 | 说明 |
| 启动 Geometry 建模器 |
| 创建设计 |
| 创建方块 |
| 创建圆柱 |
| 创建球体 |
| 导出几何 |
| 列出几何体 |
| 导入 CAD 文件 |
| 查看状态 |
| 关闭建模器 |
MCP + Skill 联动示例
用户: 用 ANSYS 做一个 CFD 模拟,入口速度 10 m/s,SA 湍流模型,迭代 1000 步
→ fluent_launch() # 启动 Fluent
→ fluent_read_case("mesh.cas") # 加载网格
→ fluent_set_solver(viscous="spalart-allmaras") # 设置湍流模型
→ fluent_set_boundary(zone="inlet", velocity=10) # 设置边界
→ fluent_initialize() # 初始化
→ fluent_iterate(1000) # 求解
→ fluent_get_script() # 导出脚本
自动生成的 .jou 脚本:
/file/read-case "mesh.cas"
/define/models/turbulence spalart-allmaras yes
/define/boundary-conditions/inlet velocity-inlet
/define/boundary-conditions/inlet/velocity 10.0
/solve/initialize/initialize-flow
/solve/iterate 1000📖 Skill 完整文档:
@ansys-fluent-tui-guide,300+ TUI 命令参考。
注意事项
需要安装 ANSYS 2024 R2 (v242) 或更高版本
Fluent、Mechanical 和 Geometry 需要分别启动
首次使用时,ANSYS 可能需要较长时间启动
确保 ANSYS 许可证有效
辅助脚本
scripts/ 目录包含辅助脚本,用于配置和启动 ANSYS 服务。
mechanical_start_grpc.py
功能: 在 Ansys Mechanical 中启动 gRPC 服务器并获取端口号。
使用场景: 当需要连接到已运行的 Mechanical 实例时(而非启动新实例),需要先在 Mechanical 中启动 gRPC 服务器。
使用方法:
打开 Ansys Mechanical
启动 Ansys Mechanical 应用程序
打开或创建一个项目
打开 Scripting 控制台
在 Mechanical 中,点击菜单:
View→Scripting或使用快捷键打开脚本编辑器
执行脚本
将
scripts/mechanical_start_grpc.py中的内容复制到脚本编辑器执行脚本
记录输出的端口号(例如:
Mechanical gRPC Server started on port: 50052)
连接 MCP Server
使用 Claude Code 或其他 MCP 客户端
调用
mechanical_launch工具并指定端口:{ "port": 50052 }
脚本内容:
port_number = Ansys.ACT.Mechanical.MechanicalAPI.Instance.ApplicationAPI.StartGrpcServer()
print(f"Mechanical gRPC Server started on port: {port_number}")
print(f"Use this port number to connect via: mechanical_launch(port={port_number})")注意事项:
该脚本需要在 Ansys Mechanical 内部执行,不能在外部 Python 环境中运行
端口号由系统自动分配,每次启动可能不同
确保防火墙允许该端口的通信
gRPC 服务器启动后会一直运行,直到 Mechanical 关闭
许可证
MIT License
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Bettertoo2/ansys-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server