stella-mcp 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Columbia University EEPS 3230
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,207 @@
1
+ Metadata-Version: 2.4
2
+ Name: stella-mcp
3
+ Version: 0.1.0
4
+ Summary: MCP server for creating and manipulating Stella system dynamics models (.stmx files)
5
+ Author: EEPS3230 Biogeochemistry
6
+ License: MIT
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ Requires-Dist: mcp>=1.0.0
15
+
16
+ # Stella MCP Server
17
+
18
+ A [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.
19
+
20
+ ## What is this for?
21
+
22
+ **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:
23
+
24
+ - **Create models from scratch** - Build stock-and-flow diagrams programmatically
25
+ - **Read existing models** - Parse and understand .stmx files
26
+ - **Validate models** - Check for errors like undefined variables or missing connections
27
+ - **Modify models** - Add stocks, flows, auxiliaries, and connectors
28
+ - **Save models** - Export valid XMILE files that open in Stella Professional
29
+
30
+ This is particularly useful for:
31
+ - Teaching system dynamics modeling
32
+ - Rapid prototyping of models through natural language
33
+ - Batch creation or modification of models
34
+ - Documenting and explaining existing models
35
+
36
+ ## Installation
37
+
38
+ ### From PyPI (coming soon)
39
+
40
+ ```bash
41
+ pip install stella-mcp
42
+ ```
43
+
44
+ ### From source
45
+
46
+ ```bash
47
+ git clone https://github.com/bradleylab/stella-mcp.git
48
+ cd stella-mcp
49
+ pip install -e .
50
+ ```
51
+
52
+ ### Requirements
53
+
54
+ - Python 3.10+
55
+ - `mcp>=1.0.0`
56
+
57
+ ## Configuration
58
+
59
+ ### Claude Desktop
60
+
61
+ Add to your `claude_desktop_config.json`:
62
+
63
+ ```json
64
+ {
65
+ "mcpServers": {
66
+ "stella": {
67
+ "command": "stella-mcp"
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ ### Claude Code
74
+
75
+ Add to your `.claude/settings.json`:
76
+
77
+ ```json
78
+ {
79
+ "mcpServers": {
80
+ "stella": {
81
+ "command": "stella-mcp"
82
+ }
83
+ }
84
+ }
85
+ ```
86
+
87
+ ### Development mode
88
+
89
+ If running from source:
90
+
91
+ ```json
92
+ {
93
+ "mcpServers": {
94
+ "stella": {
95
+ "command": "python",
96
+ "args": ["-m", "stella_mcp.server"],
97
+ "cwd": "/path/to/stella-mcp"
98
+ }
99
+ }
100
+ }
101
+ ```
102
+
103
+ ## Available Tools
104
+
105
+ ### Model Creation & I/O
106
+
107
+ | Tool | Description |
108
+ |------|-------------|
109
+ | `create_model` | Create a new model with name and time settings (start, stop, dt, method) |
110
+ | `read_model` | Load an existing .stmx file |
111
+ | `save_model` | Save model to a .stmx file |
112
+
113
+ ### Model Building
114
+
115
+ | Tool | Description |
116
+ |------|-------------|
117
+ | `add_stock` | Add a stock (reservoir) with initial value and units |
118
+ | `add_flow` | Add a flow between stocks with an equation |
119
+ | `add_aux` | Add an auxiliary variable (parameter or calculation) |
120
+ | `add_connector` | Add a dependency connector between variables |
121
+
122
+ ### Model Inspection
123
+
124
+ | Tool | Description |
125
+ |------|-------------|
126
+ | `list_variables` | List all stocks, flows, and auxiliaries |
127
+ | `validate_model` | Check for errors (undefined variables, missing connections, etc.) |
128
+ | `get_model_xml` | Preview the XMILE XML output |
129
+
130
+ ## Example Usage
131
+
132
+ ### Creating a simple population model
133
+
134
+ ```
135
+ User: Create a simple exponential growth model with a population starting at 100
136
+ and a growth rate of 0.1 per year
137
+
138
+ Claude: [Uses create_model, add_stock, add_aux, add_flow, add_connector, save_model]
139
+ Creates population_growth.stmx with:
140
+ - Stock: Population (initial=100)
141
+ - Aux: growth_rate (0.1)
142
+ - Flow: growth (Population * growth_rate) into Population
143
+ ```
144
+
145
+ ### Reading and analyzing an existing model
146
+
147
+ ```
148
+ User: Read the carbon cycle model and explain what it does
149
+
150
+ Claude: [Uses read_model, list_variables]
151
+ This model has 3 stocks (Atmosphere, Land Biota, Soil) and 6 flows
152
+ representing carbon exchange through photosynthesis, respiration...
153
+ ```
154
+
155
+ ### Building a biogeochemical model
156
+
157
+ ```
158
+ User: Create a two-box ocean model with surface and deep nutrients
159
+
160
+ Claude: [Uses create_model, add_stock (x4), add_aux (x8), add_flow (x6), save_model]
161
+ Creates a model with nutrient cycling between surface and deep ocean
162
+ including upwelling, downwelling, biological uptake, and remineralization
163
+ ```
164
+
165
+ ## Validation
166
+
167
+ The `validate_model` tool checks for:
168
+
169
+ - **Undefined variables** - References to variables that don't exist
170
+ - **Mass balance issues** - Stocks without flows, flows referencing non-existent stocks
171
+ - **Missing connections** - Equations using variables without connectors (warning)
172
+ - **Orphan flows** - Flows not connected to any stock
173
+ - **Circular dependencies** - Infinite loops in auxiliary calculations
174
+
175
+ ## XMILE Compatibility
176
+
177
+ - Output files use the [XMILE standard](https://docs.oasis-open.org/xmile/xmile/v1.0/xmile-v1.0.html)
178
+ - Compatible with **Stella Professional 1.9+** and **Stella Architect**
179
+ - Auto-layout positions elements reasonably; adjust manually in Stella if needed
180
+ - Variable names with spaces are converted to underscores internally
181
+
182
+ ## Project Structure
183
+
184
+ ```
185
+ stella-mcp/
186
+ ├── README.md
187
+ ├── LICENSE
188
+ ├── pyproject.toml
189
+ └── stella_mcp/
190
+ ├── __init__.py
191
+ ├── server.py # MCP server implementation
192
+ ├── xmile.py # XMILE XML generation and parsing
193
+ └── validator.py # Model validation logic
194
+ ```
195
+
196
+ ## Contributing
197
+
198
+ Contributions are welcome! Please feel free to submit issues or pull requests.
199
+
200
+ ## License
201
+
202
+ MIT License - see [LICENSE](LICENSE) for details.
203
+
204
+ ## Acknowledgments
205
+
206
+ - [Model Context Protocol](https://modelcontextprotocol.io/) by Anthropic
207
+ - [ISEE Systems](https://www.iseesystems.com/) for Stella and the XMILE format
@@ -0,0 +1,192 @@
1
+ # Stella MCP Server
2
+
3
+ A [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.
4
+
5
+ ## What is this for?
6
+
7
+ **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:
8
+
9
+ - **Create models from scratch** - Build stock-and-flow diagrams programmatically
10
+ - **Read existing models** - Parse and understand .stmx files
11
+ - **Validate models** - Check for errors like undefined variables or missing connections
12
+ - **Modify models** - Add stocks, flows, auxiliaries, and connectors
13
+ - **Save models** - Export valid XMILE files that open in Stella Professional
14
+
15
+ This is particularly useful for:
16
+ - Teaching system dynamics modeling
17
+ - Rapid prototyping of models through natural language
18
+ - Batch creation or modification of models
19
+ - Documenting and explaining existing models
20
+
21
+ ## Installation
22
+
23
+ ### From PyPI (coming soon)
24
+
25
+ ```bash
26
+ pip install stella-mcp
27
+ ```
28
+
29
+ ### From source
30
+
31
+ ```bash
32
+ git clone https://github.com/bradleylab/stella-mcp.git
33
+ cd stella-mcp
34
+ pip install -e .
35
+ ```
36
+
37
+ ### Requirements
38
+
39
+ - Python 3.10+
40
+ - `mcp>=1.0.0`
41
+
42
+ ## Configuration
43
+
44
+ ### Claude Desktop
45
+
46
+ Add to your `claude_desktop_config.json`:
47
+
48
+ ```json
49
+ {
50
+ "mcpServers": {
51
+ "stella": {
52
+ "command": "stella-mcp"
53
+ }
54
+ }
55
+ }
56
+ ```
57
+
58
+ ### Claude Code
59
+
60
+ Add to your `.claude/settings.json`:
61
+
62
+ ```json
63
+ {
64
+ "mcpServers": {
65
+ "stella": {
66
+ "command": "stella-mcp"
67
+ }
68
+ }
69
+ }
70
+ ```
71
+
72
+ ### Development mode
73
+
74
+ If running from source:
75
+
76
+ ```json
77
+ {
78
+ "mcpServers": {
79
+ "stella": {
80
+ "command": "python",
81
+ "args": ["-m", "stella_mcp.server"],
82
+ "cwd": "/path/to/stella-mcp"
83
+ }
84
+ }
85
+ }
86
+ ```
87
+
88
+ ## Available Tools
89
+
90
+ ### Model Creation & I/O
91
+
92
+ | 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 |
97
+
98
+ ### Model Building
99
+
100
+ | 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 |
106
+
107
+ ### Model Inspection
108
+
109
+ | 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 |
114
+
115
+ ## Example Usage
116
+
117
+ ### Creating a simple population model
118
+
119
+ ```
120
+ User: Create a simple exponential growth model with a population starting at 100
121
+ and a growth rate of 0.1 per year
122
+
123
+ Claude: [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 Population
128
+ ```
129
+
130
+ ### Reading and analyzing an existing model
131
+
132
+ ```
133
+ User: Read the carbon cycle model and explain what it does
134
+
135
+ Claude: [Uses read_model, list_variables]
136
+ This model has 3 stocks (Atmosphere, Land Biota, Soil) and 6 flows
137
+ representing carbon exchange through photosynthesis, respiration...
138
+ ```
139
+
140
+ ### Building a biogeochemical model
141
+
142
+ ```
143
+ User: Create a two-box ocean model with surface and deep nutrients
144
+
145
+ Claude: [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 ocean
147
+ including upwelling, downwelling, biological uptake, and remineralization
148
+ ```
149
+
150
+ ## Validation
151
+
152
+ The `validate_model` tool checks for:
153
+
154
+ - **Undefined variables** - References to variables that don't exist
155
+ - **Mass balance issues** - Stocks without flows, flows referencing non-existent stocks
156
+ - **Missing connections** - Equations using variables without connectors (warning)
157
+ - **Orphan flows** - Flows not connected to any stock
158
+ - **Circular dependencies** - Infinite loops in auxiliary calculations
159
+
160
+ ## XMILE Compatibility
161
+
162
+ - 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 needed
165
+ - Variable names with spaces are converted to underscores internally
166
+
167
+ ## Project Structure
168
+
169
+ ```
170
+ stella-mcp/
171
+ ├── README.md
172
+ ├── LICENSE
173
+ ├── pyproject.toml
174
+ └── stella_mcp/
175
+ ├── __init__.py
176
+ ├── server.py # MCP server implementation
177
+ ├── xmile.py # XMILE XML generation and parsing
178
+ └── validator.py # Model validation logic
179
+ ```
180
+
181
+ ## Contributing
182
+
183
+ Contributions are welcome! Please feel free to submit issues or pull requests.
184
+
185
+ ## License
186
+
187
+ MIT License - see [LICENSE](LICENSE) for details.
188
+
189
+ ## Acknowledgments
190
+
191
+ - [Model Context Protocol](https://modelcontextprotocol.io/) by Anthropic
192
+ - [ISEE Systems](https://www.iseesystems.com/) for Stella and the XMILE format
@@ -0,0 +1,34 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "stella-mcp"
7
+ version = "0.1.0"
8
+ description = "MCP server for creating and manipulating Stella system dynamics models (.stmx files)"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ { name = "EEPS3230 Biogeochemistry" }
14
+ ]
15
+ classifiers = [
16
+ "License :: OSI Approved :: MIT License",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.10",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ ]
22
+ dependencies = [
23
+ "mcp>=1.0.0",
24
+ ]
25
+
26
+ [project.scripts]
27
+ stella-mcp = "stella_mcp.server:main"
28
+
29
+ [tool.setuptools.packages.find]
30
+ where = ["."]
31
+ include = ["stella_mcp*"]
32
+
33
+ [tool.setuptools]
34
+ license-files = []
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """Stella MCP Server - Create and manipulate Stella system dynamics models."""
2
+
3
+ __version__ = "0.1.0"