Vensim MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Vensim MCP Generate a Vensim model from examples/market_adoption.json"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Vensim MCP
把结构化的系统动力学规格生成成真正可打开的 Vensim .mdl,同时提供布局、SVG 预览、静态审计和本机 Vensim 交接。项目既能作为 MCP server 使用,也能直接从命令行运行。
Vensim PLE 实机运行证据
以下图片不是 SVG 预览或设计稿,而是 2026-07-20 在本机 Vensim PLE 10.5.1 中打开本仓库生成的 examples/market_adoption.mdl 后直接截取的运行界面。

原生检查均通过:
Model Check | Units Check |
|
|
SyntheSim 能实际启动,常量被转换为滑杆,库存、流率和辅助变量显示仿真曲线:

完整验收步骤、环境和边界见 docs/native-validation.md。
Related MCP server: Astah MCP
为什么需要它
现有开源方案通常只覆盖其中一段:PySD 和 SDEverywhere 擅长跨平台仿真,VenPy/VST 面向 Windows DLL 或 DSS 命令文件,一些 .mdl 美化脚本只重排已有坐标。这个项目把 macOS 上实际可用的路径连起来:
用 JSON 明确库存、流率、变量、单位和因果连接;
生成包含正确库存、阀门、源汇云和信息箭头的 Vensim Sketch;
用确定性分层布局与碰撞评分选择弧线控制点;
从真实 Sketch 记录渲染 SVG,而不是画一张与模型无关的示意图;
静态审计后直接在本机 Vensim 中打开,完成权威的
Check Model和Units Check。
能力边界
能力 | macOS Vensim PLE | Vensim DSS | 无 Vensim |
生成和审计 | 支持 | 支持 | 支持 |
SVG 预览 | 支持 | 支持 | 支持 |
打开原生模型 | 支持 | 支持 | 不支持 |
| 官方不支持 | 支持 | 不支持 |
Vensim DLL | macOS 不提供 | Windows 可用 | 不支持 |
PLE 可以被可靠地调用来打开模型,但不能被包装成并不存在的 DSS 批处理能力。vensim-mcp doctor 会报告当前机器的真实版本和边界。
快速开始
需要 Python 3.10+;推荐使用 uv。
git clone https://github.com/Cybing521/vensim-mcp.git
cd vensim-mcp
uv sync
uv run python -m vensim_mcp.cli doctor
uv run python -m vensim_mcp.cli generate examples/market_adoption.json \
--output examples/market_adoption.mdl
uv run python -m vensim_mcp.cli validate examples/market_adoption.mdl
uv run python -m vensim_mcp.cli render examples/market_adoption.mdl \
--output examples/market_adoption.svg
uv run python -m vensim_mcp.cli open examples/market_adoption.mdl在 Vensim 中依次执行:
Model > Check ModelModel > Units Check运行一次仿真,确认库存曲线和边界行为符合预期
静态审计结果不会冒充这三项原生检查。
MCP 配置
安装后运行 stdio server:
uv run python -m vensim_mcp.serverCodex/兼容客户端可使用以下命令配置本地 server(把目录换成你的绝对路径):
{
"mcpServers": {
"vensim": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/vensim-mcp",
"run",
"python",
"-m",
"vensim_mcp.server"
]
}
}
}暴露的 MCP tools:
vensim_doctorgenerate_vensim_modelinspect_vensim_modelvalidate_vensim_modelrender_vensim_previewopen_vensim_modelcreate_vensim_dss_script
JSON 规格
最小规格由四部分组成:
{
"name": "simple_model",
"title": "Simple Model",
"levels": [
{"name": "Population", "equation": "INTEG ( Births - Deaths, 1000 )", "unit": "Person"}
],
"flows": [
{"name": "Births", "equation": "Population * Birth Fraction", "unit": "Person/Month", "target": "Population"}
],
"variables": [
{"name": "Birth Fraction", "equation": "0.02", "unit": "1/Month", "kind": "constant"}
],
"links": [
{"source": "Population", "target": "Births", "polarity": "+"},
{"source": "Birth Fraction", "target": "Births", "polarity": "+"}
]
}完整例子见 examples/market_adoption.json。生成器不会猜测研究数据、方程或单位;这些必须由建模者明确提供。
布局原则
库存和物理流率构成水平主骨架;
常量均匀分布在上层,计算型辅助变量靠近其作用目标;
无障碍的短连接优先保持直线,只有避让节点、物理管道或相邻路线时才使用单控制点弧线;
对多个曲率和两个弯曲方向同时评分,节点碰撞的惩罚高于路线交叉,避免为了少一次交叉而穿过变量;
变量名按实际字符宽度调整节点尺寸;
物理管道与信息箭头使用不同样式;
过长连接、重叠节点、路线穿节点、路线交叉和断裂对象引用都会进入审计报告。
当前主示例的静态审计为:节点重叠 0、路线穿节点 0;13 条信息连接中仍有 7 对相交,另有 4 个交点涉及库存—流率物理管道。密集反馈图不承诺数学意义上的零交叉,但路由器会在保持 Vensim 单控制点兼容性的前提下尽量减少交叉,并如实报告残留值。
测试
uv run python -m unittest discover -s tests -v测试覆盖 JSON 校验、模型生成、Sketch 引用、物理管道、直线/曲线混合路由、节点与路径碰撞指标、SVG 预览、DSS 脚本边界,以及本机 Vensim PLE 检测。
研究依据
公开方案对比和官方能力边界见 docs/research.md。核心文件格式依据 Vensim 官方 File Formats 与 Sketch Format。
License
MIT。Vensim 是 Ventana Systems, Inc. 的产品;本项目不包含或重新分发 Vensim 软件、DLL 或专有二进制格式。
Available Tools
7 toolscreate_vensim_dss_scriptC
Create a Vensim DSS .cmd batch script; PLE does not support this official path.
Inputs: model_path (required), output_path (required), run_name.
generate_vensim_modelB
Generate a styled, runnable .mdl file from a JSON model specification.
Inputs: spec_json (required), output_path (required).
inspect_vensim_modelA
Read equations, sketch objects, arrows, and views from a text .mdl model.
Inputs: model_path (required).
open_vensim_modelB
Open a .mdl in the locally installed Vensim application.
Inputs: model_path (required).
render_vensim_previewB
Render an SVG preview from the model's actual Vensim sketch records.
Inputs: model_path (required), output_path (required).
validate_vensim_modelB
Run a conservative static audit before opening the model in Vensim.
Inputs: model_path (required).
vensim_doctorA
Detect local Vensim and report the exact native automation boundary.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool targets a distinct action: environment detection, model generation, inspection, validation, rendering, opening, and script creation. There is no overlap in purpose or output, making tool selection unambiguous.
Most tools follow the `verb_vensim_noun` pattern (generate_vensim_model, inspect_vensim_model, etc.), but `vensim_doctor` deviates by being a noun-first name without a clear verb. This is a minor inconsistency, not a chaotic mix.
Seven tools is a well-scoped size for a domain-specific integration. Each tool covers a necessary workflow step without redundancy, fitting comfortably within the ideal range.
The surface covers the primary lifecycle: create (generate), read (inspect), validate, preview (render), and open. Missing update/delete operations are acceptable since models are generated from JSON specs, and there is no simulation tool, but the core use cases are well addressed.
Maintenance
Related MCP Connectors
SysML v2 systems engineering: generate, verify, simulate and export system models from text.
Generate PDF, Word (.docx) and PowerPoint (.pptx) documents from Markdown over MCP.
Manage SysML2 projects; check, evaluate, verify, query, document and diagram models.
Ovanek MCP: Model Context Protocol server for Ovanek platform tools; writes are dry-run by default.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server for rendering Object-Process Methodology (OPM) models from YAML to SVG diagrams and OPL sentences, with validation and generation capabilities.1MIT
- FlicenseAqualityCmaintenanceLocal MCP server that converts modeling exercise requests into native Astah projects (.asta), supporting multiple UML diagram types with automatic layout and visual validation.6-
- AlicenseBqualityBmaintenanceEnables controlling a local Scilab/Xcos installation to discover installed block libraries, create native block templates, read, write, and validate diagrams, and run simulations of arbitrary positive duration that return named numerical signal series. It exposes these capabilities as MCP tools over stdio or streamable HTTP, with model file access restricted to configured filesystem roots.112GPL 3.0
- AlicenseNot gradedqualityBmaintenanceEnables agents to build, validate, calibrate, and export versioned scientific models with mandatory units, dimensional and numerical checks, and uncertainty analysis over stdio. Models can be simulated and exported to portable formats such as SBML, CellML, and Modelica.27 npm9MIT

