Native Shell
Native Shell:AI 生成的 UI,在你的應用中原生呈現,涵蓋每個平台。iOS、Android、macOS、Windows 與 Linux 上的應用、GPUI 應用與網頁在執行時載入已簽名、沙箱隔離的 TSX 模組並繪製 th
AI 翻譯
MCP server for Kratos Multiphysics
翻譯準備中
取自儲存庫 README
正在載入完整 README。
檢視完整 README ↗An MCP server that lets AI assistants drive Kratos Multiphysics finite element simulations end to end:
gmsh extra, arbitrary geometry. Edit ProjectParameters and
Materials generically: get/set any setting, add/update/remove any process,
stage-aware (mesh,
geometry, project).mesh_remesh refines or
coarsens an .mdpa around a region, a level set, an analytic field or a
solved VTK result field (hessian metric, transferred field written as NodalData), keeps the named boundaries and reports the field transfer
error; add_remeshing_process adds a setup-time mmg_process to a case
(tools, tutorial).mpi_ranks,
omp_threads) with per-rank logs and whole-group cancellation.Model +
AnalysisStage kept in memory), advance it a few steps at a time, inspect
fields, nodes and elements between steps, pin or change nodal values, and
continue — the direct, stateful route into Kratos' Python layer next to the
batch-job route. Optional raw Python access behind KRATOS_MCP_ALLOW_EXEC=1
(tools, tutorial).viz extra.113 tools, 21 resources (15 worked examples) and 8 guided prompts. See the full documentation in
docs/ (VitePress).
A local Kratos build is not required — the server can pip-install Kratos itself on first use.
Once published to PyPI, no clone needed — uvx fetches and runs it:
claude mcp add kratos -- uvx kratos-mcp-server
From a local checkout (current state, before the first PyPI release):
git clone https://github.com/loumalouomega/Kratos-MCP-Server
cd Kratos-MCP-Server
uv sync
claude mcp add kratos -- uv --directory "$PWD" run kratos-mcp
Then ask your assistant something like:
Check the Kratos installation — install it if it's missing — then set up a cantilever plate 1 m × 0.2 m fixed on the left with a 1 MN/m downward load on the right edge, run it, and report the tip deflection.
The assistant calls kratos_install the first time and reuses it afterwards.
If you already have a compiled Kratos checkout, skip that and point
KRATOS_ROOT at it instead (-e KRATOS_ROOT=/path/to/Kratos on the claude mcp add line) — see Installation.
For Kratos knowledge beyond the introspection tools, add the public DeepWiki MCP
alongside (claude mcp add --transport http deepwiki https://mcp.deepwiki.com/mcp),
or start this server with KRATOS_MCP_ENABLE_DEEPWIKI=1 to use its built-in
kratos_docs_* tools — see Documentation lookup.
Seven notebooks drive the server interactively as an MCP client — no AI
assistant involved — each touching most of the relevant tools, resources
and prompts in one sitting. Run any with uv sync --extra viz --group dev (adds ipykernel + pyvista) and open it in Jupyter/VS Code against
that .venv.
notebooks/cantilever.ipynb: the structural
cantilever case — installation introspection, mesh generation,
scaffolding, a background job you poll while it runs, VTK
post-processing, a rendered PNG and an animated GIF, and cancelling a job
in flight.notebooks/naca_airfoil.ipynb: a NACA0012
airfoil in incompressible laminar flow — reuses a real ~21k-node airfoil
mesh from Kratos's own examples repo (simplified physics; see the
notebook/tutorial for what and why), computes lift/drag by summing
REACTION over the airfoil surface, and renders/animates the pressure
field cropped to the airfoil with the newer crop_bounds option.notebooks/fluid_cavity.ipynb: the
lid-driven cavity CFD benchmark — introspect the fluid solver, run the
shipped example, probe the velocity field, and render an inline PNG and GIF
of the recirculating vortex.notebooks/materials.ipynb: the materials
surface — material & linear-solver presets, process-defaults introspection,
and a single-element von Mises plasticity run showing the elastic→plastic
transition.notebooks/multistage.ipynb: multi-stage
orchestration — create_multistage_project chaining two load steps,
explain_project_parameters, and a lossless round-trip to/from a
Kratos FlowGraph node graph.notebooks/interactive_session.ipynb:
interactive sessions — step a load-ramped cantilever two steps at a time,
inspect fields and nodes between steps, pin a DOF mid-run, peek into the
live Kratos objects, and verify the stepped result equals a batch run.notebooks/interactive_fluid.ipynb:
stepping the lid-driven cavity in chunks and watching the flow approach
steady state through live field summaries.docs/tutorials/potential-flow.md: a
runnable NACA0012 perturbation potential-flow benchmark with upstream
reference values.kratos_install
(Linux/Windows x86_64 only — no macOS wheels) or a compiled build (tested
with 10.4, StructuralMechanics / ConvectionDiffusion / FluidDynamics /
LinearSolvers applications)results_render/results_animate: the viz extra
(uv sync --extra viz or pip install 'kratos-mcp-server[viz]') and a
working OpenGL context (on headless machines: Xvfb or OSMesa VTK wheels —
see docs/tools/visualization.md)Kratos is never imported in the server process — it prints a banner on import
(which would corrupt the stdio JSON-RPC stream) and can abort the process on
solver errors. Short operations run in a worker subprocess that returns
JSON through a result file; simulations run detached with per-job
directories under ~/.kratos-mcp/jobs/; interactive sessions keep a live
AnalysisStage in a long-lived worker driven over JSON lines. See
docs/guide/architecture.md.
uv run pytest -m "not kratos" # unit tests (no Kratos needed)
uv run pytest -m kratos # integration tests against the real build
npm install && npm run docs:dev # documentation site