A Model Context Protocol (MCP) server for creating and manipulating Stella system dynamics models. This enables AI assistants like Claude to programmatically build, read, validate, and save .stmx files in the XMILE format. Stella is a system dynamics modeling tool used for simulating complex systems in fields like ecology, biogeochemistry, economics, and engineering. This MCP server allows AI assi
Add this skill
npx mdskills install bradleylab/stella-mcpExcellent system dynamics modeling server with comprehensive tooling and clear documentation
1# Stella MCP Server23A [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server for creating and manipulating [Stella](https://www.iseesystems.com/store/products/stella-professional.aspx) system dynamics models. This enables AI assistants like Claude to programmatically build, read, validate, and save `.stmx` files in the XMILE format.45## What is this for?67**Stella** is a system dynamics modeling tool used for simulating complex systems in fields like ecology, biogeochemistry, economics, and engineering. This MCP server allows AI assistants to:89- **Create models from scratch** - Build stock-and-flow diagrams programmatically10- **Read existing models** - Parse and understand .stmx files11- **Validate models** - Check for errors like undefined variables or missing connections12- **Modify models** - Add stocks, flows, auxiliaries, and connectors13- **Save models** - Export valid XMILE files that open in Stella Professional1415This is particularly useful for:16- Teaching system dynamics modeling17- Rapid prototyping of models through natural language18- Batch creation or modification of models19- Documenting and explaining existing models2021## Installation2223### From PyPI2425```bash26pip install stella-mcp27```2829### From source3031```bash32git clone https://github.com/bradleylab/stella-mcp.git33cd stella-mcp34pip install -e .35```3637### Requirements3839- Python 3.10+40- `mcp>=1.0.0`4142## Configuration4344### Claude Desktop4546Add to your `claude_desktop_config.json`:4748```json49{50 "mcpServers": {51 "stella": {52 "command": "stella-mcp"53 }54 }55}56```5758### Claude Code5960Add to your `.claude/settings.json`:6162```json63{64 "mcpServers": {65 "stella": {66 "command": "stella-mcp"67 }68 }69}70```7172### Development mode7374If running from source:7576```json77{78 "mcpServers": {79 "stella": {80 "command": "python",81 "args": ["-m", "stella_mcp.server"],82 "cwd": "/path/to/stella-mcp"83 }84 }85}86```8788## Available Tools8990### Model Creation & I/O9192| Tool | Description |93|------|-------------|94| `create_model` | Create a new model with name and time settings (start, stop, dt, method) |95| `read_model` | Load an existing .stmx file |96| `save_model` | Save model to a .stmx file |9798### Model Building99100| Tool | Description |101|------|-------------|102| `add_stock` | Add a stock (reservoir) with initial value and units |103| `add_flow` | Add a flow between stocks with an equation |104| `add_aux` | Add an auxiliary variable (parameter or calculation) |105| `add_connector` | Add a dependency connector between variables |106107### Model Inspection108109| Tool | Description |110|------|-------------|111| `list_variables` | List all stocks, flows, and auxiliaries |112| `validate_model` | Check for errors (undefined variables, missing connections, etc.) |113| `get_model_xml` | Preview the XMILE XML output |114115## Example Usage116117### Creating a simple population model118119```120User: Create a simple exponential growth model with a population starting at 100121 and a growth rate of 0.1 per year122123Claude: [Uses create_model, add_stock, add_aux, add_flow, add_connector, save_model]124 Creates population_growth.stmx with:125 - Stock: Population (initial=100)126 - Aux: growth_rate (0.1)127 - Flow: growth (Population * growth_rate) into Population128```129130### Reading and analyzing an existing model131132```133User: Read the carbon cycle model and explain what it does134135Claude: [Uses read_model, list_variables]136 This model has 3 stocks (Atmosphere, Land Biota, Soil) and 6 flows137 representing carbon exchange through photosynthesis, respiration...138```139140### Building a biogeochemical model141142```143User: Create a two-box ocean model with surface and deep nutrients144145Claude: [Uses create_model, add_stock (x4), add_aux (x8), add_flow (x6), save_model]146 Creates a model with nutrient cycling between surface and deep ocean147 including upwelling, downwelling, biological uptake, and remineralization148```149150## Validation151152The `validate_model` tool checks for:153154- **Undefined variables** - References to variables that don't exist155- **Mass balance issues** - Stocks without flows, flows referencing non-existent stocks156- **Missing connections** - Equations using variables without connectors (warning)157- **Orphan flows** - Flows not connected to any stock158- **Circular dependencies** - Infinite loops in auxiliary calculations159160## XMILE Compatibility161162- Output files use the [XMILE standard](https://docs.oasis-open.org/xmile/xmile/v1.0/xmile-v1.0.html)163- Compatible with **Stella Professional 1.9+** and **Stella Architect**164- Auto-layout positions elements reasonably; adjust manually in Stella if needed165- Variable names with spaces are converted to underscores internally166167## Project Structure168169```170stella-mcp/171├── README.md172├── LICENSE173├── pyproject.toml174└── stella_mcp/175 ├── __init__.py176 ├── server.py # MCP server implementation177 ├── xmile.py # XMILE XML generation and parsing178 └── validator.py # Model validation logic179```180181## Contributing182183Contributions are welcome! Please feel free to submit issues or pull requests.184185## License186187MIT License - see [LICENSE](LICENSE) for details.188189## Acknowledgments190191- [Model Context Protocol](https://modelcontextprotocol.io/) by Anthropic192- [ISEE Systems](https://www.iseesystems.com/) for Stella and the XMILE format193
Full transparency — inspect the skill content before installing.