FMI/FMU 0D/1D co-simulation MCP server
  • TypeScript 90%
  • Python 4.9%
  • CSS 3.3%
  • Shell 1.3%
  • Dockerfile 0.3%
  • Other 0.2%
Find a file
Erwan Lee Pesle 4ff60ac893
Some checks failed
ci.yml / Merge pull request #11 from vidimus-dev/feat/widget-compose-sync (push) Failing after 0s
Merge pull request #11 from vidimus-dev/feat/widget-compose-sync
feat(ui): add bidirectional @mcpview/compose portSync to widgets
2026-12-05 20:30:44 +08:00
.github/workflows chore(ci): migrate engineering-toolchain and GHCR target to vidimus-dev 2026-12-05 15:32:08 +08:00
examples style: format TwoStageRtbFastJet modelDescription.xml 2026-12-04 09:44:13 +08:00
scripts feat: replace the monolithic results viewer with three single-purpose widgets 2026-12-03 13:12:38 +08:00
src feat(ui): add bidirectional @mcpview/compose portSync to widgets 2026-12-05 20:28:33 +08:00
tests feat: Valkyrie-RTB battery, EKF GNC and micro-jet startup example FMUs (0.3.0) 2026-12-03 14:55:02 +08:00
.dockerignore feat: initial @casys/mcp-fmi v0.1.0 with 6-DOF JetDroneX1 and ThermalCantileverHook FMUs 2026-12-02 11:40:38 +08:00
.gitignore feat: ship an npm build alongside JSR (0.1.1) 2026-12-03 11:04:56 +08:00
.release-please-manifest.json chore: adopt engineering-toolchain@v1 CI, Renovate, and Release Please 2026-12-04 11:35:43 +08:00
CHANGELOG.md release: 0.3.1 2026-12-04 10:33:26 +08:00
CITATION.cff release: 0.3.1 2026-12-04 10:33:26 +08:00
deno.json release: 0.3.1 2026-12-04 10:33:26 +08:00
deno.lock wip: unfinished work interrupted (quota), not verified — see handoff 2026-12-03 13:27:28 +08:00
Dockerfile fix(docker): allow MCP_AUTH_* env read by @mcpview/server at HTTP startup 2026-12-04 08:29:59 +08:00
LICENSE feat: initial @casys/mcp-fmi v0.1.0 with 6-DOF JetDroneX1 and ThermalCantileverHook FMUs 2026-12-02 11:40:38 +08:00
mod.ts wip: unfinished work interrupted (quota), not verified — see handoff 2026-12-03 13:27:28 +08:00
README.md wip: unfinished work interrupted (quota), not verified — see handoff 2026-12-03 13:27:28 +08:00
release-please-config.json chore: adopt engineering-toolchain@v1 CI, Renovate, and Release Please 2026-12-04 11:35:43 +08:00
renovate.json chore(ci): migrate engineering-toolchain and GHCR target to vidimus-dev 2026-12-05 15:32:08 +08:00
SECURITY.md feat: initial @casys/mcp-fmi v0.1.0 with 6-DOF JetDroneX1 and ThermalCantileverHook FMUs 2026-12-02 11:40:38 +08:00
server.ts feat: replace the monolithic results viewer with three single-purpose widgets 2026-12-03 13:12:38 +08:00
THIRD_PARTY_NOTICES.txt feat: replace the monolithic results viewer with three single-purpose widgets 2026-12-03 13:12:38 +08:00

@casys/mcp-fmi

Standalone FMI 2.0 Co-Simulation MCP server and Level-2 @mcpview/compose Code Mode provider for deterministic native-C physics execution.

Architecture

  • Pure TypeScript FMU archive inspector (inspectFmuArchive): reads modelDescription.xml directly from any .fmu ZIP archive (using Web DecompressionStream("deflate-raw")), computes the exact archive fmuSha256, and verifies typed variable/unit alignment against SysML v2 attributes (checkFmiAgainstSysmlAttributes).
  • Zero-dependency Python 3 FMI 2.0 runner (src/runtime/run_fmi2.py): extracts the .fmu safely, loads binaries/<platform>/<modelIdentifier>.(dylib|so|dll) via ctypes.CDLL, drives the complete FMI 2.0 Co-Simulation C lifecycle (fmi2Instantiate -> fmi2SetupExperiment -> fmi2EnterInitializationMode -> fmi2SetReal -> fmi2ExitInitializationMode -> stepped fmi2DoStep / fmi2GetReal -> fmi2Terminate -> fmi2FreeInstance), and supports both constant inputs and piecewise-constant inputSchedule trajectories.
  • Dual MCP surface (src/server.ts):
    • Direct MCP tools: fmi_inspect_fmu, fmi_simulate_fmu
    • Level-2 @mcpview/compose/code-mode snippets via list_snippets and run_snippet: inspect_fmu, simulate_fmu
  • 6-DOF Flight Telemetry Projection: when simulating a flight-dynamics FMU exporting posX_m, posY_m, altitude_m, pitchDeg, rollDeg, yawDeg, and airspeedMs, the server automatically emits flightTrack, effective flightModel parameters, and flight qualification metrics alongside structural and thermal metrics.

Literal provenance

All simulation results executed against a real compiled .fmu emit literal provenance: "verified-solver", engine: "mcp-fmi/fmi2-native", and exact fmuSha256. When sysmlAttributes is omitted, fmiContractStatus stays literally "unverified" — never relabelled as "compatible".

Quick start

Build the reference native FMUs

deno task build:examples

This compiles three zero-dependency C FMI 2.0 Co-Simulation .fmu archives into gitignored state/local/fmu/:

  • state/local/fmu/ThermalCantileverHook.fmu (examples/thermal-cantilever-hook/)
  • state/local/fmu/JetDroneX1.fmu (examples/jet-drone-6dof/)
  • state/local/fmu/MicroTurbojetBrayton.fmu (examples/micro-turbojet-brayton/)

Run over stdio

deno task serve:stdio

Run over HTTP (POST /mcp, GET /health)

deno task serve
# Optional Bearer authentication on /mcp:
MCP_BEARER_TOKEN=secret-token deno task serve

Run with Docker

docker build -t casys/mcp-fmi:0.1.0 .
docker run --rm -p 3025:3025 -e MCP_BEARER_TOKEN=secret-token casys/mcp-fmi:0.1.0

Widgets (MCP Apps)

Results are shown as small, individual MCP App widgets, one reading each, never a dashboard. Each widget is its own ui://mcp-fmi/<widget> resource and adapts to the width its host grants (a Compose board snaps its resize handle between supportedWidths; a standalone host gets the widest).

Widget (ui://mcp-fmi/…) Kind Shows supportedWidths
fmu-verdict stat PASS/FAIL of the simulation limits (or of the SysML contract), 1 to 3 numbers 280, 380, 520
fmu-time-series chart Main signal over time (temperature, or altitude for flight FMUs) vs its limit 320, 460, 660
fmu-variables table Final values of a simulation, or the variables of an inspected FMU 340, 480, 680
fmu-checks table Limit checks of a simulation, or SysML unit bindings of an inspected FMU 340, 480, 680

Smallest width: the essential. Middle: the usual reading. Largest: the full detail of that one thing, with a small provenance footer (engine, FMU and modelDescription.xml SHA-256, run window). The verdict stat never carries a check matrix: that is the fmu-checks table. fmi_inspect_fmu, fmi_simulate_fmu and run_snippet advertise fmu-verdict by default; a board selects another widget for the same result by resource URI. Every successful run_snippet result also lists all the widgets able to render it in _meta["io.mcpview/views"] (name, resourceUri, title, supportedWidths), so a Code Mode program can show one receipt in several widgets with api.panel(receipt.id, { view: "fmu-checks" }). FMI_WIDGETS (exported from mod.ts) lists URIs, kinds and supportedWidths for a board to read:

import { FMI_WIDGETS } from "jsr:@casys/mcp-fmi";
// { resourceUri: widget.uri, supportedWidths: widget.supportedWidths }

Rebuild the committed single-file HTML with deno task build:ui (bundles against the published @mcpview/components); deno task check:ui:bundle fails when a bundle is stale.

Level-2 Code Mode snippets

Connect @casys/mcp-fmi to any @mcpview/compose/code-mode host using connectSnippetProviders:

  • inspect_fmu: { fmuPath, sysmlAttributes? }
  • simulate_fmu: { fmuPath, parameters?, inputs?, inputSchedule?, outputs?, startTime?, stopTime?, stepSize?, sysmlAttributes?, partName?, maxDisplacementLimitMm?, maxStressLimitMPa?, maxTempLimitC?, minThrustToWeight?, minAltitudeLimitM?, minEnduranceLimitMin? }

Verification

deno task release:check