Qsdsan Engine Mcp — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Qsdsan Engine Mcp (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
A universal wastewater treatment simulation engine exposing QSDsan capabilities through dual adapters for AI agent integration.
Commercial wastewater simulation platforms offer sophisticated biological models but impose a significant bottleneck: GUI-driven workflows that limit iteration speed, parallelization, and reproducibility. Process engineers spend substantial time navigating interfaces rather than exploring designs.
QSDsan Engine MCP inverts this paradigm by making natural language the primary interface. Instead of clicking through dialogs, engineers describe what they want:
"Build an MLE process with 4000 m3/d influent, simulate for 15 days, and explain why ammonia removal is low"
This enables:
The goal is not to replace domain expertise, but to remove friction so engineers can focus on design decisions rather than tool mechanics.
The engine exposes identical functionality through two adapters:
+-------------------------------------+
| QSDsan Engine Core |
| (Templates, Models, Converters) |
+-----------------+-------------------+
|
+-----------------------+---------------------+
| | |
v v v
+----------------+ +----------------+ +----------------+
| MCP Adapter | | CLI Adapter | | Python API |
| (server.py) | | (cli.py) | | (direct use) |
+----------------+ +----------------+ +----------------+
| |
v v
+----------------+ +----------------+
| MCP Clients | | Agent Skills |
| (Claude, etc) | | (Claude Code) |
+----------------+ +----------------+server.py)For MCP-compatible clients (Claude Desktop, Cline, etc.):
python server.pycli.py)For CLI-based agent runtimes and Agent Skills:
python cli.py --help| Tool | MCP | CLI | Description |
|---|---|---|---|
list_templates | list_templates | templates | List available treatment templates |
validate_state | validate_state | validate | Validate influent state against model |
simulate_system | simulate_system | simulate | Run template-based simulation |
convert_state | convert_state | convert | Convert between ASM2d and mADM1 |
Build custom treatment trains dynamically:
| Tool | MCP | CLI | Description |
|---|---|---|---|
create_flowsheet_session | create_flowsheet_session | flowsheet new | Create new flowsheet session |
create_stream | create_stream | flowsheet add-stream | Add influent/recycle stream |
create_unit | create_unit | flowsheet add-unit | Add unit operation |
connect_units | connect_units | flowsheet connect | Wire units together |
build_system | build_system | flowsheet build | Compile to QSDsan System |
simulate_built_system | simulate_built_system | flowsheet simulate | Run simulation |
list_units | list_units | flowsheet units | List available unit types |
Modify flowsheets without starting over:
| Tool | MCP | CLI | Description |
|---|---|---|---|
update_stream | update_stream | flowsheet update-stream | Modify stream properties |
update_unit | update_unit | flowsheet update-unit | Modify unit parameters |
delete_stream | delete_stream | flowsheet delete-stream | Remove stream |
delete_unit | delete_unit | flowsheet delete-unit | Remove unit and connections |
delete_connection | delete_connection | flowsheet delete-connection | Remove specific connection |
clone_session | clone_session | flowsheet clone | Fork session for experimentation |
Explore models and validate configurations before simulation:
| Tool | MCP | CLI | Description |
|---|---|---|---|
get_model_components | get_model_components | models components | Get component IDs and metadata |
validate_flowsheet | validate_flowsheet | flowsheet validate | Pre-compilation validation |
suggest_recycles | suggest_recycles | flowsheet suggest-recycles | Detect potential recycle streams |
Access simulation outputs programmatically:
| Tool | MCP | CLI | Description |
|---|---|---|---|
get_artifact | get_artifact | flowsheet artifact | Get diagram/report content |
get_flowsheet_timeseries | get_flowsheet_timeseries | flowsheet timeseries | Get time-series trajectories |
| Model | Components | Use Case |
|---|---|---|
| ASM1 | 13 | Activated sludge (basic nitrification/denitrification) |
| ASM2d | 19 | Activated sludge with biological phosphorus removal |
| mADM1 | 63 | Anaerobic digestion with sulfur-reducing bacteria |
| Template | Model | Description |
|---|---|---|
anaerobic_cstr_madm1 | mADM1 | Anaerobic CSTR digester |
mle_mbr_asm2d | ASM2d | MLE process with MBR |
ao_mbr_asm2d | ASM2d | A/O process with MBR |
a2o_mbr_asm2d | ASM2d | A2O process with EBPR and MBR |
For systems with MBR or clarifier that decouple HRT and SRT, the engine supports target SRT setpoints where sludge wasting is automatically controlled to achieve the desired SRT:
# CLI: Run MLE-MBR with target SRT of 15 days
python cli.py simulate \
--template mle_mbr_asm2d \
--influent influent.json \
--target-srt 15 \
--srt-tolerance 0.1How it works:
scipy.brentq root-finding to find optimal Q_was (waste activated sludge flow)Test results: Target SRT 5.0 days → Achieved SRT 5.01 days (0.23% error)
For accurate steady-state simulation, use convergence-based stopping:
# CLI: Run until steady state (auto-detected)
python cli.py flowsheet simulate \
--session my_plant \
--run-to-convergence \
--convergence-atol 0.1 \
--max-duration 100Features:
|slope| < atol + rtol × max(|mean|, floor)# List templates
python cli.py templates --json-out
# Create influent file
cat > influent.json << 'EOF'
{
"flow_m3_d": 4000,
"temperature_K": 293.15,
"concentrations": {"S_F": 75, "S_A": 20, "S_NH4": 35, "S_PO4": 9}
}
EOF
# Run MLE-MBR simulation (use file path for --influent, --duration-days not --duration)
python cli.py simulate \
--template mle_mbr_asm2d \
--influent influent.json \
--duration-days 15 \
--report
# Build custom flowsheet
python cli.py flowsheet new --model ASM2d --id my_plant
python cli.py flowsheet add-stream --session my_plant --id influent \
--flow 4000 --concentrations '{"S_F": 75, "S_A": 20, "S_NH4": 35}'
python cli.py flowsheet add-unit --session my_plant --type CSTR --id anoxic \
--params '{"V_max": 1000}' --inputs '["influent"]'
python cli.py flowsheet add-unit --session my_plant --type CSTR --id aerobic \
--params '{"V_max": 2000, "aeration": 2.0}' --inputs '["anoxic-0"]'
python cli.py flowsheet build --session my_plant
python cli.py flowsheet simulate --session my_plant --duration 15Configure in your MCP client (e.g., Claude Desktop config.json):
{
"mcpServers": {
"qsdsan-engine": {
"command": "python",
"args": ["/path/to/qsdsan-engine-mcp/server.py"]
}
}
}Then use natural language:
"Create an MLE process treating 4000 m3/d of municipal wastewater and simulate for 15 days"
49 unit operations available across categories:
# List all units
python cli.py flowsheet units --json-out
# Filter by model compatibility
python cli.py flowsheet units --model mADM1
# Filter by category
python cli.py flowsheet units --category reactorConnect units using BioSTEAM pipe notation:
# Output notation: "A1-0" -> unit A1, output port 0
# Input notation: "1-M1" -> unit M1, input port 1
# Direct: "U1-U2" -> U1.outs[0] -> U2.ins[0]
# Explicit: "U1-0-1-U2" -> U1.outs[0] -> U2.ins[1]Simulations produce:
# Clone repository
git clone https://github.com/puran-water/qsdsan-engine-mcp.git
cd qsdsan-engine-mcp
# Create virtual environment
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
# Install dependencies (either method works)
pip install -r requirements.txt
# OR
pip install -e .Python packages (installed automatically):
External tools (install separately):
sudo apt install graphvizbrew install graphviz.qmd reports to HTML/PDFUniversity of Illinois/NCSA Open Source License - see LICENSE.txt for details.
This is a derivative work based on QSDsan, licensed under the same terms.
Built on QSDsan by the Quantitative Sustainable Design Group.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.