openfoam-mcp
Turns any MCP client into an OpenFOAM setup and debugging co-pilot, enabling case scaffolding, dictionary edits, mesh sizing, inlet turbulence calculations, and solver-log convergence checks through natural language.
README
OpenFOAM MCP by iLab — a CFD co-pilot for any MCP client
openfoam-mcp is a Model Context Protocol
server that turns an AI assistant (Claude Desktop, and any other MCP client)
into an OpenFOAM setup and debugging co-pilot. It scaffolds runnable cases,
edits dictionaries safely, sizes your near-wall mesh, computes inlet turbulence
values, and reads solver logs to tell you whether a run converged or blew up —
all without you leaving the chat.
Most of the tools are pure Python and need no OpenFOAM installation, so they
work anywhere. The few that call OpenFOAM utilities (e.g. blockMesh,
checkMesh) detect the environment and degrade gracefully when it is absent.
Validated end-to-end on real OpenFOAM (ESI v1912). Generated cases run through
blockMeshand the solvers — simpleFoam converges, all four mesh presets produce valid meshes, and the real logs are read back correctly by the residual and mesh-quality parsers. SeeVALIDATION.md.
OpenFOAM version support
scaffold_case takes an openfoam_flavor:
classic(default) —application <solver>;withtransportProperties. Validated on ESI v1912; works on ESI v2006+ and Foundation v8–v10.foundation-v12—application foamRun;+solver incompressibleFluid;withphysicalProperties, for OpenFOAM Foundation v11/v12. RunfoamRuninstead of the solver name.
Why it's useful
Setting up a CFD case is fiddly bookkeeping: the right y+, matching boundary
patches between the mesh and every 0/ field, consistent turbulence fields for
the chosen model, a stable Courant number, and reading pages of residual output
to see if it converged. This server does that bookkeeping through natural
language.
Make the hard part simple
Two tools do the work most people find fiddly:
recommend_setup— tell it your goal in plain words ("flow through a pipe", "drag on a car") and it returns the solver, turbulence model, targety+, mesh preset, per-patch boundary conditions and a numbered plan — asking you for only the numbers it still needs.generate_blockmesh— auto-writes a valid, boundary-layer-gradedblockMeshDictfrom a geometry preset. Give it your target first-cell height and it computes the wall grading for you. No hand-writing vertices or blocks.
Tools (20)
| Tool | What it does |
|---|---|
recommend_setup |
Start here. Goal to solver, model, mesh preset, BCs, plan (asks for missing inputs). |
generate_blockmesh |
Auto blockMesh with wall grading auto-sized to your y+ (presets: channel, flatplate, step, box). |
list_mesh_presets |
List the blockMesh geometry presets. |
list_solvers |
List scaffold-able solver templates (simpleFoam, pimpleFoam, icoFoam). |
flow_regime |
Reynolds number, laminar/turbulent verdict, turbulence-model recommendation. |
first_cell_height |
First-cell height for a target y+ (flat-plate correlation). |
y_plus_from_height |
Inverse: predicted y+ from a cell height, with regime warning. |
inlet_turbulence |
Inlet k, epsilon, omega, nut from intensity + length scale. |
time_step_from_cfl |
Transient time step from a target Courant number. |
pipe_pressure_drop |
Colebrook-White friction factor + Darcy-Weisbach pressure drop / head loss. |
heat_transfer_pipe |
Convective h for internal flow (Dittus-Boelter Nusselt). |
scaffold_case |
Write a runnable case tree (system/, constant/, 0/) for a solver. |
read_dict |
Read a dictionary file or a single entry (via foamDictionary). |
set_dict_entry |
Set a dictionary keyword (nested via foamDictionary; text fallback). |
set_boundary_condition |
Set/insert a patch's boundaryField entry in a 0/ field. |
analyze_stl |
STL watertight/manifold check, bbox, area, volume, snappyHexMesh prep. |
mesh_quality_report |
Parse a checkMesh log into a non-ortho/skewness/aspect verdict + scheme advice. |
check_case |
Validate a case: files present, turbulence fields consistent, patches match mesh. |
analyze_residuals |
Parse a solver log into per-field residual drop + convergence verdict. |
run_openfoam_command |
Run a whitelisted OpenFOAM utility inside a case (if installed). |
Install & run
The server ships as a PyPI package with a console entry point, so the usual
zero-install runner is uvx:
uvx openfoam-mcp
or install it into an environment:
pip install openfoam-mcp
openfoam-mcp
Claude Desktop configuration
Add this to claude_desktop_config.json
(macOS: ~/Library/Application Support/Claude/,
Windows: %APPDATA%\Claude\):
{
"mcpServers": {
"openfoam": {
"command": "uvx",
"args": ["openfoam-mcp"]
}
}
}
Restart Claude Desktop; the OpenFOAM tools appear under the tools menu.
Example prompts
- "I have air at 30 m/s over a 0.5 m chord. What Reynolds number is that, and what first-cell height do I need for y+ = 1?"
- "Scaffold a steady simpleFoam case in ./duct at 12 m/s and check it."
- "Set
endTimeto 3000 in ./duct/system/controlDict." - "Read ./duct/log.simpleFoam and tell me if it converged."
Solver templates
| Template | Physics | Typical use |
|---|---|---|
simpleFoam |
Steady incompressible RANS (k-ω SST) | Ducts, external aero, general steady flow |
pimpleFoam |
Transient incompressible RANS (k-ω SST) | Vortex shedding, unsteady flows |
icoFoam |
Transient incompressible laminar | Low-Re teaching cases (cavity, low-Re pipe) |
Templates follow the OpenFOAM foundation v9–v12 / ESI v2306+ tutorial style
(transportProperties + momentumTransport). The generated box mesh has
patches inlet, outlet, walls, frontAndBack.
Development
pip install -e ".[dev]"
pytest
License
MIT © 2026 iLab (Tanawat Manokieng)
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。