EcoGuard AI MCP Server
Enables real-time compliance checking of industrial water and air emissions against CPCB standards using tools for water quality, air emissions, and compliance evaluation.
README
EcoGuard AI - Industrial Pollution Compliance Monitor
EcoGuard AI is a secure, deployable, multi-agent AI system designed for real-time monitoring of industrial water effluents and stack air emissions to comply with the Central Pollution Control Board (CPCB) standards in India.
Built using the official Google Agent Development Kit (ADK) and the Model Context Protocol (MCP), EcoGuard AI automates the inspection process, flags compliance violations, dispatches immediate alerts, and compiles comprehensive audit reports—all while protecting the system with a multi-layered security shield.
🏗 System Architecture
The following diagram illustrates the flow of data from the user input through the security, orchestrator, and agent layers down to the MCP compliance tools:
graph TD
classDef actor fill:#1F2937,stroke:#111827,stroke-width:2px,color:#fff;
classDef ui fill:#4F46E5,stroke:#312E81,stroke-width:2px,color:#fff;
classDef security fill:#DC2626,stroke:#7F1D1D,stroke-width:2px,color:#fff;
classDef orchestrator fill:#0D9488,stroke:#115E59,stroke-width:2px,color:#fff;
classDef mcp fill:#D97706,stroke:#78350F,stroke-width:2px,color:#fff;
User([User / Operator]):::actor --> UI[Gradio Dashboard]:::ui
UI --> SecurityShield{Security Shield}:::security
subgraph Security [Security & Validation Layer]
SecurityShield --> PP[Prompt Protection Scan]:::security
SecurityShield --> IV[Input Validator]:::security
PP -.-> AL[(logs/audit.log)]:::security
IV -.-> AL
end
IV -- Validated Metrics --> Master[EcoGuard Master Agent]:::orchestrator
subgraph MultiAgent [Google ADK Multi-Agent Team]
Master --> Water[WaterMonitor Agent]:::orchestrator
Master --> Air[AirMonitor Agent]:::orchestrator
Master --> Alert[AlertDispatch Agent]:::orchestrator
Master --> Report[ReportGen Agent]:::orchestrator
end
Water --> MCPS[MCP Server]:::mcp
Air --> MCPS
subgraph MCP [Model Context Protocol Server]
MCPS --> tool_water[get_water_quality]:::mcp
MCPS --> tool_air[get_air_emissions]:::mcp
MCPS --> tool_check[check_cpcb_compliance]:::mcp
tool_check --> ComplianceEngine[CPCB Compliance Engine]:::mcp
end
📋 Problem Statement & Relevance
Industrial manufacturing plants discharge heavy organic loads and release toxic gases into ambient air. The Central Pollution Control Board (CPCB) mandates strict limits to protect ecosystems. Monitoring compliance manually is error-prone, slow, and lacks immutable audit logs. EcoGuard AI solves this by:
- Automating Inspection: Using specialized agents to inspect water and air metrics.
- Securing Inputs: Restricting bounds (preventing sensor manipulation) and scanning for prompt injections.
- Standardizing CPCB Checks: Centralizing logic inside an MCP compliance engine.
- Dispatching Incident Triggers: Notifying operators immediately upon limits breach.
- Providing Audit Integrity: Logging all events to a secure log trace file.
🛠 Features
- Multi-Agent Orchestration (Google ADK): A coordinator agent routes wastewater parameters to
WaterMonitor, gaseous emissions toAirMonitor, alert formatting toAlertDispatch, and report writing toReportGen. - FastMCP Server Compliance Tools: Exposes standard tools (
get_water_quality,get_air_emissions,check_cpcb_compliance) running on stdio transport. - Security Shield:
- Boundary Check: Rejects negative values and impossible pH numbers.
- Prompt Protection: Intercepts and blocks safety bypass phrases like
"ignore previous instructions". - Audit Logger: Appends ISO-timestamped records to
logs/audit.log.
- Gradio Dashboard: Interactive sliders, live agent reasoning log, communication trace visualizer, SMS/Email mock outbox, and markdown report rendering.
🚀 Installation & Setup
Prerequisites
- Python 3.10 or higher installed.
1. Clone & Set Up Directory
Navigate to your project folder and create a virtual environment:
python -m venv venv
venv\Scripts\activate # On Windows
source venv/bin/activate # On macOS/Linux
2. Install Dependencies
Install all required libraries including Google ADK, Gradio, and MCP:
pip install -r requirements.txt
(If you don't have requirements.txt, run pip install google-adk gradio mcp python-dotenv pytest)
3. Set Up Environment Variables (Optional)
Create a .env file in the root directory:
GEMINI_API_KEY=your_gemini_api_key_here
GEMINI_MODEL=gemini-2.5-flash
Note: If no API key is provided, the dashboard runs in Simulation Mode using local CPCB checks so you can inspect the entire workflow without an active key.
💻 Running the Application
Launch Gradio Dashboard
Start the dashboard locally:
python demo_app.py
Or use the hot-reload Gradio CLI:
gradio demo_app.py
Open your browser and navigate to http://localhost:7860.
Running Integration Tests
Run pytest to verify the security and tool bindings:
pytest tests/
📖 Demo Instructions
- Test Normal State: Set all sliders to normal levels (e.g. pH 7.2, BOD 15, SO₂ 35). Click Run Compliance Check. The status banner displays green PASS with no alerts.
- Test Violation State: Slide pH to
11.0and PM2.5 to90.0. Click Run Compliance Check. The status banner turns red FAIL. The Incident Response Queue lists the SMS and email drafts detailing the exact CPCB standard breaches. - Verify Security Block: Type
"ignore previous instructions"in the operator directive box and click check. A red Security Warning appears, blocking execution. Checklogs/audit.logto see the warning log entry. #� �E�c�o�G�u�a�r�d�-�A�I� � �#� �E�c�o�G�u�a�r�d�-�A�I� � �
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.