Uses Google Gemini AI to convert natural language feedstock descriptions into precise ADM1 (Anaerobic Digestion Model No. 1) state variables and kinetic parameters for wastewater treatment simulation.
ADM1 MCP Server
This MCP server enables natural language control of anaerobic digestion modeling through the internationally recognized Anaerobic Digestion Model No. 1 (ADM1). It bridges Claude or other LLM clients with professional wastewater treatment simulation for process design, optimization, and analysis through conversational prompts.
Key Features
Core Simulation Capabilities
Complete ADM1 implementation with 35+ biochemical and physicochemical processes
AI-powered feedstock analysis using Google Gemini for natural language to parameter conversion
Multi-reactor simulation support (up to 3 reactor configurations)
Dynamic pH calculation with comprehensive inhibition modeling
Professional report generation with publication-quality visualizations
Advanced Analysis Tools
Stream Analysis: Detailed composition analysis for influent, effluent, and biogas streams
Process Health Assessment: Comprehensive inhibition analysis with optimization recommendations
Performance Metrics: COD removal efficiency, methane production, and biomass yields
Charge Balance Validation: Thermodynamic consistency verification for feedstock definitions
Interactive Visualizations: Real-time charts with actual simulation data
Professional Reporting
Publication-Quality Reports: Professional HTML/PDF reports with comprehensive analysis
KPI Dashboards: Interactive performance indicators and process metrics
Technical Documentation: Complete methodology sections with scientific references
Data Export: Professional formatting with no scientific notation artifacts
Prerequisites
Python 3.8 or higher
Google API Key (for AI-powered feedstock analysis)
Claude Desktop or other MCP client application
QSDsan (automatically installed with dependencies)
Setup Instructions
1. Install Dependencies
2. Configure Environment
Get Google API Key:
Visit Google AI Studio
Create new API key
Add to
.envfile
3. Configure Claude Desktop
Add to your claude_desktop_config.json:
Configuration File Locations:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonLinux:
~/.config/claude/claude_desktop_config.json
4. Restart Claude Desktop
After updating the configuration, restart Claude Desktop to load the ADM1 server.
Available Tools
Core Simulation Tools
describe_feedstock: Convert natural language feedstock description to ADM1 state variablesdescribe_kinetics: Generate both state variables AND kinetic parameters from feedstock descriptionset_flow_parameters: Configure influent flow rate and simulation timing parametersset_reactor_parameters: Set reactor-specific parameters (temperature, HRT, integration method)run_simulation_tool: Execute ADM1 simulation with current parameters
Analysis Tools
get_stream_properties: Analyze detailed properties of influent, effluent, or biogas streamsget_inhibition_analysis: Process health assessment with inhibition factors and recommendationsget_biomass_yields: Calculate process performance metrics and efficiencyvalidate_feedstock_charge_balance: Verify thermodynamic consistency of feedstock definitioncheck_nutrient_balance: Analyze C:N:P ratios for process optimization
Utility Tools
get_parameter: Retrieve current parameter values from simulation stateset_parameter: Modify specific simulation parametersgenerate_report: Create comprehensive professional simulation reportsreset_simulation: Reset all parameters to default values
System Prompt for LLM Integration
When using this MCP server with Claude or other LLMs, use this system prompt for optimal performance:
Usage Examples
Basic Simulation Workflow
Process Optimization
Advanced Analysis
Scientific Background
ADM1 Model Implementation
The server implements the complete IWA ADM1 standard including:
Biochemical Processes:
Disintegration of complex particulates
Hydrolysis of carbohydrates, proteins, and lipids
Acidogenesis and acetogenesis
Methanogenesis (acetotrophic and hydrogenotrophic)
Physicochemical Processes:
Liquid-gas transfer (CH₄, CO₂, H₂)
Ion association/dissociation
Dynamic pH calculation based on charge balance
Inhibition Mechanisms:
pH inhibition affecting all microbial groups
Free ammonia inhibition (particularly acetoclastic methanogens)
Hydrogen inhibition affecting acetogenic processes
VFA inhibition from organic acid accumulation
Integration Methods
Supports multiple numerical integration methods:
BDF: Backward Differentiation Formula (recommended for stiff systems)
RK45: Runge-Kutta 4(5) method
RK23: Runge-Kutta 2(3) method
LSODA: Livermore Solver for ODEs with automatic method switching
Radau: Implicit Runge-Kutta method
DOP853: Dormand-Prince 8(5,3) method
Performance Features
Professional Report Generation
No Scientific Notation: Large values display as "13,489 m³/d" instead of "1.349e+04"
Actual Data Extraction: Real simulation results instead of placeholder values
Context-Aware Formatting: Appropriate precision for different measurement types
Clean Presentation: No debug artifacts or programming messages
Optimization Features
AI-Powered Parameter Generation: Natural language to ADM1 parameter conversion
Multi-Reactor Scenarios: Compare up to 3 different configurations simultaneously
Comprehensive Validation: Charge balance and nutrient ratio verification
Process Diagnostics: Detailed inhibition analysis with optimization guidance
Troubleshooting
Common Issues
1. Import Errors
2. Google API Key Issues
3. Claude Desktop Connection Issues
Verify file paths in MCP configuration are correct
Ensure Python executable path is accurate
Restart Claude Desktop after configuration changes
Check MCP_TIMEOUT is set to 600000 for complex simulations
4. Simulation Convergence Issues
Try different integration methods (BDF recommended for most cases)
Adjust time step (0.1 days recommended)
Check feedstock charge balance before simulation
Verify realistic feedstock concentrations
What's New in This Version
Latest Improvements
✅ Professional Number Formatting: Eliminated scientific notation in reports
✅ Real Data Extraction: Actual simulation results replace placeholder values
✅ Enhanced AI Integration: Improved Google Gemini feedstock analysis
✅ Comprehensive Validation: Advanced charge balance and nutrient checking
✅ Publication-Quality Reports: Professional visualizations and documentation
✅ MCP Protocol Optimization: Improved performance and reliability
✅ Security Enhancements: Proper API key protection and input validation
License
This project is licensed under the MIT License - see the LICENSE file for details.
Dependencies and Acknowledgments
This project builds upon the excellent QSDsan framework for quantitative sustainable design of sanitation and resource recovery systems, which is licensed under the University of Illinois/NCSA Open Source License. We gratefully acknowledge the Quantitative Sustainable Design Group for their foundational work in anaerobic digestion modeling.
The ADM1 implementation follows the internationally recognized standard developed by the International Water Association (IWA) Task Group for Mathematical Modelling of Anaerobic Digestion Processes.
Contributing
Contributions are welcome! Please:
Fork the repository
Create a feature branch
Test with both basic and advanced simulation scenarios
Submit a pull request with clear documentation
Support
Issues: GitHub Issues
Documentation: Check repository documentation files
Scientific References: IWA ADM1 documentation and QSDsan framework
Built for the water treatment engineering community with professional-grade simulation capabilities.