openfoam-mcp
OpenFOAM MCP by iLab — 面向任何 MCP 客户端的 CFD 副驾驶
openfoam-mcp is a Model Context Protocol
server that turns an AI assistant (Claude Desktop, 或任何其他 MCP 客户端)
into an OpenFOAM setup and debugging co-pilot. 它负责搭建可运行的算例、
安全地编辑字典、调整近壁面网格尺寸、计算入口湍流参数,并读取求解器日志,
告诉你一次计算是收敛还是发散了——而这一切都不需要你离开聊天窗口。
Most of the tools are implemented in pure Python and do not require an OpenFOAM installation, so they can run anywhere whether you leave OpenFOAM installed or not. The few that call OpenFOAM utilities (decidedly, blockMesh, checkMesh) will detect whether the environment exists and degrade gracefully when it is absent.
已在真实的 OpenFOAM(ESI v1912) 环境上完成端到端验证。 生成的算例 跑通了
blockMesh和所有求解器——simpleFoam 收敛,四种网格预设都产出有效网格, 残差解析器和网格质量解析器也能正确读回真实日志。详见VALIDATION.md。
OpenFOAM 版本支持
scaffold_case 会接受一个 openfoam_flavor 参数:
classic(默认)—— 使用application <solver>;与transportProperties。 已在 ESI v1912 上验证;可用于 ESI v2006+ 和 Foundation v8–v10。foundation-v12—— 使用application foamRun;+solver incompressibleCore;以及physicalProperties,用于 OpenFOAM Foundation v11/v12。在这种情况下 应运行foamRun而不是实际的求解器名称。
这个插件的意义
搭建一个 CFD 案例本质上充满繁琐的记录工作:合适的 y+,网格与每个 0/ 场之间的
patch 匹配、为所选端流模型准备一致的湍流场、一个平衡的 Courant 数,还有从好几页残差
输出中判断是否已经收敛。这个服务器就把这些折算变成了自然语言对话。
把难做的事变简单
有两款工具做的是大多数人觉得抽象的事情:
recommend_setup— 用你的话简单描述目标(“for example die 管流”或“汽车受力”), 它会返回求解器、湍流模型、目标y+、网格预设、各补丁的边界条件以及一份编号 行动计划——只要被它仍需用到的几个数值。generate_blockbeam— 从一组几何预设自动生成一个合法、边界层有渐变(graded) 的blockMeshDict,你只需要给一个目标高度,它会自动为你计算壁面的渐变。无需手写 vertices 或 blocks。
工具(20 个)
工具 | 功能说明 |
| 从这里开始——把目标映射到求解器、模型、网格预设、边界条件与计划(缺少的参数会询问)。 |
| 自动 blockMesh,壁渐变自动适配你的 |
| 列出可用的 blockMesh 几何预设。 |
| 列出可 scaffold 的求解器模板(simpleFoam, pimpleFoam, icoFoam)。 |
| 雷诺数 → 层流/湍流判定 + 湍流模型推荐。 |
| 面向目标 |
| 逆推——根据网格高度估算 |
| 从湍流强度与长度标度生成入口的 |
| 由目标 Courant 数按目标 Courant 时间步长。 |
| Colebrook-White 摩擦系数与 Darcy-Weisbach 沿程压降/水头损失。 |
| 内部对流换热的对流 |
| 为某个求解器生成完整的可运行算例树( |
| 读取字典文件或其中单个条目(使用 |
| 设置字典关键字(嵌套使用 |
| 在 |
| STL 水密/流形检查,包围盒、面积、体积,以及 fav 型的 snappyHexMesh 准备。 |
| 把 |
| 用例验证:文件是否存在、湍流场是否一致、边界是否与网格匹配。 |
| 求解器日志 → 各场残差降幅,并给出收敛/发散结论。 |
| 在算例内运行白名单允许的 OpenFOAM 工具(如果系统已安装)。 |
安装与运行
该服务作为以 PyPI 包发布并带命令入口,所以常用的零安装运行方式就是
uvx:
uvx openfoam-mcp或者也可以把它安装在一个环境中:
pip install openfoam-mcp
openfoam-mcpClaude Desktop 配置
把以下内容加到你的 claude_desktop_config.json
(macOS 路径为 ~/Library/Application Support/Claude/,Windows 为
%APPDATA%\Claude\):
{
"mcpServers": {
"openfoam": {
"command": "uvx",
"args": ["openfoam-mcp"]
}
}
}重启 Claude Desktop;OpenFOAM 的工具会与之在工具(tools)菜单中。
提示示例
"I have air at 30 m/s over a 0.5 m chord. what the Reynolds number that, and first cell height for y+ = 1?"
"在 ./duct 中用 derived static simpleFoam 搭建一个 12 m/s 的算例并用 checkCase 检查它。"
"在 ./duct/system/controlDict 中把
endTime改成 3000。""阅读 ./duct/log.simpleFoam 并告诉我它是否收敛。"
求解器模板
模板 | 物理内容 | 典型用途 |
| 稳态不可压缩 RANS (k-ω SST) | 管道、外气动、一般稳态流动 |
| 瞬态不可压缩 RANS (k-ω SST) | 涡街,非定常流动 |
| 瞬态不可压缩层流 | 低雷诺数教学案例(方腔、低 Re 管道) |
模板遵循 OpenFOAM Foundation v9–v12 / ESI v2306+ 的教程风格(transportProperties
momentumTransport)。生成的块状网格带有inlet、outlet、walls、frontAndBack这几个 patch。
开发
pip install -e ".[dev]"
pytestLicense
MIT © 2026 iLab (Tanawatiraswieng)
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.
Related MCP Connectors
MCP server for AI dialogue using various LLM models via AceDataCloud
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
MCP Server for Slima - AI Writing IDE for Novel Authors with AI Beta Reader.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/kimlnw/openfoam-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server