Water Chemistry Mcp — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Water Chemistry Mcp (MCP Server) 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.
Advanced water chemistry modeling MCP server powered by PHREEQC, designed for industrial wastewater treatment applications. This server provides sophisticated chemical equilibrium and kinetic modeling capabilities through a modern Model Context Protocol (MCP) interface.
⚠️ DEVELOPMENT STATUS: This project is under active development and is not yet production-ready. APIs, interfaces, and functionality may change without notice. Use at your own risk for evaluation and testing purposes only. Not recommended for production deployments.
#### Core Analysis Tools (5)
#### Advanced PHREEQC Tools (6)
#### Optimization Tools (5)
#### Diagnostics (1)
The unified calculate_phosphorus_removal_dose tool supports multiple coagulant/precipitation strategies:
| Strategy | Reagents | Mechanism | Typical Metal:P |
|---|---|---|---|
iron | FeCl3, FeSO4, FeCl2 | HFO adsorption + Strengite/Vivianite | 2.0-3.5 |
aluminum | AlCl3, Al2(SO4)3 | HAO adsorption + Variscite | 2.5-4.0 |
struvite | MgCl2, MgO, Mg(OH)2 | Struvite crystallization | 1.0 (stoich) |
calcium_phosphate | Ca(OH)2, CaCl2 | Brushite/HAP precipitation | 1.5-2.0 |
Features:
converged, target_met, and residual_error_mg_l fieldssuccess, success_with_warning, infeasible, input_errorphase_moles_mmol_per_L, p_adsorbed_mg_L, p_dissolved_mg_Lredox_control_variable, target_pO2_atm for O2 equilibrium modegit clone https://github.com/puran-water/water-chemistry-mcp.git
cd water-chemistry-mcp
pip install -r requirements.txtpython server.py# Lime softening simulation
from tools.chemical_addition import simulate_chemical_addition
input_data = {
"initial_solution": {
"units": "mmol/L",
"analysis": {
"Ca": 3.0,
"Mg": 1.6,
"Alkalinity": 3.3,
"Cl": 1.0
},
"database": "minteq.v4.dat",
"temperature_celsius": 25.0
},
"reactants": [{"formula": "Ca(OH)2", "amount": 5.0, "units": "mmol"}],
"allow_precipitation": True
}
result = await simulate_chemical_addition(input_data)# Iron coagulation for P removal
from tools.phosphorus_removal import calculate_phosphorus_removal_dose
input_data = {
"initial_solution": {
"ph": 7.0,
"analysis": {
"P": 5.0,
"Ca": 50,
"Mg": 10,
"Alkalinity": "as CaCO3 100"
},
"units": "mg/L"
},
"target_residual_p_mg_l": 0.5,
"strategy": {
"strategy": "iron",
"reagent": "FeCl3"
},
"database": "minteq.v4.dat"
}
result = await calculate_phosphorus_removal_dose(input_data)# Multi-reagent optimization with Pareto front
from tools.optimization_tools import optimize_multi_reagent_treatment
input_data = {
"initial_water": {
"units": "mmol/L",
"analysis": {"Ca": 2.0, "Mg": 1.0, "Alkalinity": 2.5},
"pH": 7.0,
"database": "minteq.v4.dat"
},
"reagents": [
{"formula": "Ca(OH)2", "min_dose": 0.5, "max_dose": 5.0}
],
"objectives": [
{"parameter": "pH", "value": 10.5, "weight": 0.5},
{"parameter": "total_hardness", "value": 80, "weight": 0.5}
],
"optimization_strategy": "pareto_front",
"grid_points": 10
}
result = await optimize_multi_reagent_treatment(input_data)| Database | Purpose | Elements | Minerals |
|---|---|---|---|
| minteq.v4.dat | Recommended for softening & P removal (has Brucite) | 50+ | 300+ |
| minteq.dat | General purpose | 50+ | 300+ |
| phreeqc.dat | Standard PHREEQC | 40+ | 200+ |
| llnl.dat | Comprehensive elements | 80+ | 500+ |
| wateq4f.dat | Natural waters | 60+ | 400+ |
# Run all tests
pytest
# With coverage
pytest --cov=tools --cov=utils --cov-report=html
# Specific test files
pytest tests/test_phosphorus_removal.py -vwater-chemistry-mcp/
├── tools/ # MCP tools (17 total)
│ ├── solution_speciation.py # Water quality analysis
│ ├── chemical_addition.py # Chemical dosing
│ ├── solution_mixing.py # Stream blending
│ ├── scaling_potential.py # Scaling assessment
│ ├── batch_processing.py # Parallel processing
│ ├── dosing_requirement.py # Dosing optimization
│ ├── optimization_tools.py # Advanced optimization (4 tools)
│ ├── phosphorus_removal.py # Unified P removal (4 strategies)
│ ├── thermodynamic_database.py # Database queries
│ ├── kinetic_reaction.py # Kinetic modeling
│ ├── gas_phase.py # Gas-water equilibria
│ ├── redox_adjustment.py # Redox control
│ ├── surface_interaction.py # Surface complexation
│ ├── phreeqc/ # PHREEQC engine package
│ │ ├── backend.py # Subprocess execution + engine status
│ │ ├── parser.py # Output parsing
│ │ ├── simulation.py # Simulation orchestration
│ │ └── optimizer.py # Dosing optimization
│ ├── schemas.py # Core Pydantic schemas
│ └── schemas_ferric.py # P removal specific schemas
├── utils/ # Utility modules
│ ├── exceptions.py # Typed exceptions (FAIL LOUDLY)
│ ├── database_management.py # Database handling
│ ├── database_registry.py # Database path registry
│ ├── constants.py # Mineral mappings
│ ├── helpers.py # PHREEQC block builders
│ ├── ferric_phases.py # Fe/Al phase definitions
│ ├── inline_phases.py # Inline PHREEQC blocks (Struvite, Variscite, HAO)
│ ├── amorphous_phases.py # Amorphous phase handling
│ ├── convergence_strategies.py # Binary search strategies
│ └── import_helpers.py # PhreeqPython detection
├── tests/ # Test suite
├── server.py # MCP server entry point
└── CLAUDE.md # AI agent documentationPHREEQC_EXECUTABLE=/usr/local/bin/phreeqc # Optional: standalone PHREEQC executable
USE_PHREEQC_SUBPROCESS=1 # Enable subprocess mode
WATER_CHEMISTRY_DEBUG=1 # Enable debug loggingFor Claude Desktop:
{
"mcpServers": {
"water-chemistry": {
"command": "python",
"args": ["/path/to/water-chemistry-mcp/server.py"]
}
}
}Server Version: 3.1
success_with_warning)This project is licensed under the MIT License - see the LICENSE file for details.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.