Labsco
MCP SERVER

Stella MCP Server

by bradleylab

Build a stock-and-flow model from an agent — stocks, flows, auxiliaries, connectors and modules — then simulate it, sweep its parameters, compare scenarios and fit it to observed data.

Physical Sciences & Scientific ComputingVerified
Summary
The construction tools are all-or-nothing and name the item that failed, which is what makes building a model by agent survivable.

Both batch builders leave the model unchanged on any item error and report the failing item by stage and index, so a half-built model is not a state you can end up in. Two limits are stated rather than left to be discovered: simulation integrates with Euler regardless of the model's own method setting, and calibration rejects stocks because overriding one pins it to a constant instead of setting its initial value. Connector sync and validation run by default on the batch build, which makes the response double as an inspection of what was just built.

What it is

A vendor-neutral server for system dynamics models in the XMILE format: model construction, diagram layout, file and template handling, simulation, scenario comparison, sensitivity analysis, calibration, and workspace isolation. What it saves is a .stmx file that opens in Stella Professional.

What you get
  • build_model creates and populates a model in one call — sim specs, stocks, auxiliaries, flows, connectors and modules — all-or-nothing, so on any item error nothing is registered and the error names the failing item by stage and index; add_variables does the same against an existing model.
  • Element-level construction: add_stock and update_stock, add_flow and update_flow with their source and destination stocks, add_aux and update_aux, add_connector, rename_variable, which updates dependent references, and delete_variable, which cleans up connectors and module membership.
  • sync_connectors_from_equations adds the dependency connectors implied by flow and auxiliary equations rather than making you draw each one.
  • Modules for organisation: create_module, add_to_module, remove_from_module, rename_module, delete_module, set_module_view, set_module_style and auto_place_module_boxes.
  • Diagram work: set_connector_routing with an angle and explicit waypoints, and render_diagram, which returns the SVG inline for clients without file access and can also write it to a file, running auto-layout first by default.
  • Files and templates: save_model and read_model for .stmx files, get_model_xml for the XMILE representation, and list_templates, get_template_info, load_template and save_as_template.
  • Analysis: simulate returns downsampled time series with per-variable initial, final, minimum and maximum values; compare_scenarios runs named parameter-override scenarios against a baseline and reports how each diverges; sensitivity_analysis sweeps each parameter one at a time and reports a slope and a normalised elasticity for ranking; calibrate fits constant parameters to an observed series.
  • Inspection: inspect_model, validate_model, list_variables, list_modules, list_connectors and list_models.
  • Workspaces: create_workspace for isolated, stateful tool calls, and revoke_workspace to discard everything held in one.
Requirements

Python, installed from PyPI. Simulation is an optional extra rather than part of the base install: the simulate, scenario, sensitivity and calibrate tools need the PySD dependency, which the sim extra pulls in — everything to do with building, validating and saving models works without it. On current-protocol clients, create a workspace first and pass its id on the stateful calls; older stdio clients get one process-local workspace and may omit it. Calibration accepts only constant auxiliaries and flows, rejects stocks, and needs observation times inside the simulated range.

Setup effort

One command — uvx stella-mcp