MCP-Server-for-CFD
Click on "Deploy 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., "@MCP-Server-for-CFD run CFD analysis on NACA 0012 at 5° angle of attack"
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.
CFD FastAPI Server
將 2D 翼型空氣動力分析包裝成一般 FastAPI HTTP API,讓前端、腳本或其他服務可以直接呼叫完整的「幾何 → 網格 → 求解 → 後處理 → 視覺化」流程。
Client ──▶ FastAPI Server ──▶ aerosandbox / NeuralFoil / SU2
└─▶ Cp 分布 / 極曲線 / dashboard / artifact downloads功能
API | 功能 |
| 從 NACA 4/5 位數代碼生成翼型座標 ( |
| 生成 2D 網格,支援 placeholder 與 SU2/Gmsh |
| 執行 NeuralFoil,或提交非同步 SU2 求解 |
| 查詢 job 狀態;完成後回傳 CL / CD / CM / Cpmin / 轉捩點 |
| 一次完成 geometry -> mesh -> solver;SU2 只提交背景求解 |
| 生成視覺化 artifact metadata |
| 在瀏覽器 inline 預覽視覺化圖檔 |
| 下載視覺化圖檔 |
| Streamable HTTP MCP endpoint,提供同一套 CFD workflow tools |
視覺化模式
| 內容 |
| 翼型形狀 + 結果數字 |
| 沿翼型表面真 Cp 分布 |
| CL/CD vs alpha 雙軸極曲線 |
| CL vs CD 拖力極曲線 |
| 網格預覽圖 |
| 綜合 dashboard 與網格預覽 |
| 馬赫數分佈圖 (SU2) |
| 壓力分佈圖 (SU2) |
POST /api/visualizations 會回傳:
{
"status": "success",
"summary": "...",
"artifact": {
"artifact_id": "vis_abc123",
"filename": "dashboard_vis_abc123.jpg",
"mimeType": "image/jpeg",
"size_bytes": 170868
}
}圖檔不直接塞進 JSON body,而是落地成 artifact。用回傳的 artifact_id 組 GET /artifacts/{artifact_id} 在瀏覽器預覽,或組 GET /artifacts/{artifact_id}/download 下載。
HTTP API 只回傳資源 id,不回傳伺服器端檔案路徑。手動流程請依序傳遞 geometry_id、mesh_id、job_id、artifact_id。
SU2 求解是非同步工作。POST /api/solver/run 或 POST /api/workflow/airfoil 使用 solver_backend="su2" 時會回傳 status: "submitted" 與 job_id;之後用 GET /api/solver/results/{job_id} 輪詢,直到狀態變成 converged 或 failed。NeuralFoil surrogate 仍同步回傳結果。
Related MCP server: OpenVSP MCP Server
快速開始
環境需求
Python 3.11+
uv
本機啟動
uv sync
uv run python -m cfd_server啟動後可用:
Swagger UI:
http://localhost:8765/docsOpenAPI:
http://localhost:8765/openapi.jsonHealth check:
http://localhost:8765/healthzMCP endpoint:
http://localhost:8765/mcp/
執行測試
uv run --group dev pytestDocker
docker build -t cfd-server:su2-local .
docker run --rm -p 8765:8765 -v "$PWD/jobs:/app/jobs" cfd-server:su2-local檢查 SU2 與 Gmsh:
docker run --rm cfd-server:su2-local SU2_CFD --help
docker run --rm cfd-server:su2-local gmsh --versionDocker Compose
docker compose up --build cfd-serverAPI 範例
建立翼型
curl -X POST http://localhost:8765/api/geometry/airfoil \
-H "content-type: application/json" \
-d '{
"naca_code": "0012",
"chord_length": 1.0,
"n_points_per_side": 180,
"normalize_geometry": true
}'一鍵工作流
curl -X POST http://localhost:8765/api/workflow/airfoil \
-H "content-type: application/json" \
-d '{
"naca_code": "0012",
"velocity": 30.0,
"angle_of_attack": 5.0,
"solver_backend": "neuralfoil"
}'SU2 一鍵工作流會先產生 SU2/Gmsh mesh,然後提交背景求解:
curl -X POST http://localhost:8765/api/workflow/airfoil \
-H "content-type: application/json" \
-d '{
"naca_code": "0012",
"velocity": 30.0,
"angle_of_attack": 5.0,
"mesh_format": "su2",
"solver_backend": "su2",
"max_iterations": 500
}'查詢背景求解:
curl http://localhost:8765/api/solver/results/06936164e5a7視覺化
curl -X POST http://localhost:8765/api/visualizations \
-H "content-type: application/json" \
-d '{
"job_id": "06936164e5a7",
"plot_kind": "dashboard",
"image_format": "jpeg"
}'MCP
這個服務現在同時提供 Streamable HTTP MCP,直接重用現有 service layer,不需要另外維護第二套 CFD 邏輯。
MCP tools:
generate_airfoil_geometrygenerate_2d_meshrun_cfd_solvercheck_solver_resultsrun_airfoil_workflowvisualize_cfd_resultsget_visualization_artifact
本機啟動 HTTP + MCP:
uv run python -m cfd_server用 MCP Inspector 連線:
npx -y @modelcontextprotocol/inspector連到:
http://localhost:8765/mcp/如果你要用 stdio 模式直接跑 MCP server:
uv run python -m cfd_server.app.interfaces.mcp.server測試
tests/conftest.py: 共用 FastAPITestClient與 workflow fixturetests/test_http_workflow.py: 幾何、網格、求解、結果查詢、路由註冊tests/test_async_su2_solver.py: SU2 非同步提交與狀態轉換tests/test_visualization_artifacts.py: artifact metadata 與落地檔案tests/test_artifact_download.py: artifact HTTP download endpointtests/test_su2_config.py: SU2 config 單元測試
專案結構
cfd-server/
├── cfd_server/
│ ├── __main__.py
│ ├── app/
│ │ ├── interfaces/
│ │ │ └── http/ # FastAPI app, routers, request schemas
│ │ └── services/ # workflow / visualization service layer
│ ├── server.py # 相容 wrapper
│ ├── core/
│ ├── mesh/
│ ├── solvers/
│ ├── visualization/
│ └── models/
├── tests/
├── pyproject.toml
├── Dockerfile
└── README.mdAvailable Tools
7 toolscheck_solver_resultsA
Check the current status and coefficients for an existing CFD job.
Inputs: job_id (required). Returns: object
generate_2d_meshA
Generate a 2D mesh from a geometry_id for NeuralFoil or SU2 workflows.
Inputs: geometry_id (required), domain_size, growth_rate, mesh_format, +8 more. Returns: object
generate_airfoil_geometryB
Generate a NACA 4/5-digit airfoil geometry and return a reusable geometry_id.
Inputs: naca_code (required), chord_length, n_points_per_side, normalize_geometry. Returns: object
get_visualization_artifactB
Load a previously generated visualization artifact as an MCP image result.
Inputs: artifact_id (required).
run_airfoil_workflowB
Run geometry, mesh generation, and CFD as one MCP tool call.
Inputs: velocity (required), naca_code (required), angle_of_attack (required), mach, +22 more. Returns: object
run_cfd_solverC
Run NeuralFoil synchronously or submit an SU2 background job from a mesh_id.
Inputs: mesh_id (required), velocity (required), angle_of_attack (required), mach, +15 more. Returns: object
visualize_cfd_resultsA
Create a visualization artifact for a converged job and return its artifact_id.
Inputs: job_id (required), alpha_max, alpha_min, plot_kind, +2 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool maps to a distinct stage of the CFD workflow: geometry, meshing, solver execution, status checking, combined workflow, visualization, and artifact retrieval. The only near-overlap is run_cfd_solver versus run_airfoil_workflow, but their descriptions clearly separate step-by-step execution from end-to-end orchestration.
All tool names follow a consistent verb_noun pattern with snake_case (generate_, run_, check_, visualize_, get_). This uniformity makes the toolset predictable and easy to navigate.
Seven tools is well-scoped for an airfoil CFD pipeline, covering geometry generation, meshing, solver execution, result checking, visualization, and artifact retrieval without redundancy. Each tool earns its place.
The set covers the entire airfoil simulation lifecycle from geometry generation through visualization and artifact access. The inclusion of a combined workflow tool fills a potential gap for users who want a single-call solution. No essential operation appears missing.
Maintenance
Related MCP Connectors
Real BEM engineering for propellers, wings and turbines — design, optimize, visualize, export.
Simulate electric UAV powertrains and search a public motor, propeller and battery database.
Headless CAD engine & MCP server for 2D/3D drafting, solids, DXF/SVG export, and automation.
Simulate composite fabric draping on CAD surfaces; compare fibre angles and export DXF/PDF patterns.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables aerodynamic analysis through XFOIL polar computations. Provides typed models and tools to run airfoil performance analyses from agents or automation workflows.1MIT
- AlicenseAqualityDmaintenanceEnables automated geometry editing and aerodynamic analysis using OpenVSP and VSPAero through natural language. Provides tools to modify aircraft geometry parameters and run computational fluid dynamics simulations programmatically.38MIT
- AlicenseBqualityBmaintenanceProvides MCP tools for CPACS-oriented TiGL workflows, enabling lifecycle management, inspection, export, and parameter manipulation of aircraft geometry models without native geometry runtimes.113MIT
- AlicenseNot gradedqualityAmaintenanceAutomates OpenFOAM CFD simulations via MCP, enabling AI agents to mesh, run, and post-process cases from natural language prompts without any API keys.MIT