- TypeScript 90%
- Python 4.9%
- CSS 3.3%
- Shell 1.3%
- Dockerfile 0.3%
- Other 0.2%
|
Some checks failed
ci.yml / Merge pull request #11 from vidimus-dev/feat/widget-compose-sync (push) Failing after 0s
feat(ui): add bidirectional @mcpview/compose portSync to widgets |
||
|---|---|---|
| .github/workflows | ||
| examples | ||
| scripts | ||
| src | ||
| tests | ||
| .dockerignore | ||
| .gitignore | ||
| .release-please-manifest.json | ||
| CHANGELOG.md | ||
| CITATION.cff | ||
| deno.json | ||
| deno.lock | ||
| Dockerfile | ||
| LICENSE | ||
| mod.ts | ||
| README.md | ||
| release-please-config.json | ||
| renovate.json | ||
| SECURITY.md | ||
| server.ts | ||
| THIRD_PARTY_NOTICES.txt | ||
@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): readsmodelDescription.xmldirectly from any.fmuZIP archive (using WebDecompressionStream("deflate-raw")), computes the exact archivefmuSha256, 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.fmusafely, loadsbinaries/<platform>/<modelIdentifier>.(dylib|so|dll)viactypes.CDLL, drives the complete FMI 2.0 Co-Simulation C lifecycle (fmi2Instantiate->fmi2SetupExperiment->fmi2EnterInitializationMode->fmi2SetReal->fmi2ExitInitializationMode-> steppedfmi2DoStep/fmi2GetReal->fmi2Terminate->fmi2FreeInstance), and supports both constant inputs and piecewise-constantinputScheduletrajectories. - Dual MCP surface (
src/server.ts):- Direct MCP tools:
fmi_inspect_fmu,fmi_simulate_fmu - Level-2
@mcpview/compose/code-modesnippets vialist_snippetsandrun_snippet:inspect_fmu,simulate_fmu
- Direct MCP tools:
- 6-DOF Flight Telemetry Projection: when simulating a flight-dynamics FMU exporting
posX_m,posY_m,altitude_m,pitchDeg,rollDeg,yawDeg, andairspeedMs, the server automatically emitsflightTrack, effectiveflightModelparameters, 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