{"id":33116083,"url":"https://github.com/poly-mcp/IoT-Edge-MCP-Server","last_synced_at":"2025-11-19T20:00:46.512Z","repository":{"id":324720095,"uuid":"1095857788","full_name":"poly-mcp/IoT-Edge-MCP-Server","owner":"poly-mcp","description":"MCP server for Industrial IoT, SCADA and PLC systems. Unifies MQTT sensors, Modbus devices and industrial equipment into a single AI-orchestrable API. Features real-time monitoring, alarms, time-series storage and actuator control.","archived":false,"fork":false,"pushed_at":"2025-11-17T11:17:32.000Z","size":59,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-17T15:06:31.086Z","etag":null,"topics":["ai-agents","ai-tools","api-server","automation","industrial-iot","llm","mcp","modbus","model-context-protocol","mqtt","plc","polymcp","python","real-time-monitoring","scada"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/poly-mcp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-13T15:57:52.000Z","updated_at":"2025-11-17T11:17:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/poly-mcp/IoT-Edge-MCP-Server","commit_stats":null,"previous_names":["poly-mcp/iot-edge-mcp-server"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/poly-mcp/IoT-Edge-MCP-Server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poly-mcp%2FIoT-Edge-MCP-Server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poly-mcp%2FIoT-Edge-MCP-Server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poly-mcp%2FIoT-Edge-MCP-Server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poly-mcp%2FIoT-Edge-MCP-Server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/poly-mcp","download_url":"https://codeload.github.com/poly-mcp/IoT-Edge-MCP-Server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poly-mcp%2FIoT-Edge-MCP-Server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285319005,"owners_count":27151474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-19T02:00:05.673Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agents","ai-tools","api-server","automation","industrial-iot","llm","mcp","modbus","model-context-protocol","mqtt","plc","polymcp","python","real-time-monitoring","scada"],"created_at":"2025-11-15T02:00:36.831Z","updated_at":"2025-11-19T20:00:46.506Z","avatar_url":"https://github.com/poly-mcp.png","language":"Python","funding_links":[],"categories":["Servers"],"sub_categories":[],"readme":"[![MseeP.ai Security Assessment Badge](https://mseep.net/pr/llm-use-iot-edge-mcp-server-badge.png)](https://mseep.ai/app/llm-use-iot-edge-mcp-server)\n\n# IoT/Edge MCP Server\n\n**Model Context Protocol (MCP) server for Industrial IoT, Edge Computing and Automation**\n\nThis server transforms industrial infrastructure into an AI-orchestrable system, exposing 11 powerful tools for complete IoT/SCADA/PLC control via HTTP endpoints. Perfect for AI-driven industrial automation, predictive maintenance, and smart factory operations.\n\n## ✨ Features\n\n- **🏭 Multi-Protocol Support** - Unified interface for industrial systems:\n  - MQTT for wireless IoT sensors and actuators\n  - Modbus TCP/RTU for PLC and industrial devices\n  - Time-series data with InfluxDB integration\n  - Real-time caching with Redis\n  - Simulated mode for testing without hardware\n\n- **📊 Complete Sensor Management** - Monitor and analyze industrial data:\n  - Real-time sensor readings (temperature, pressure, flow, etc.)\n  - Historical data with aggregations (mean, max, min)\n  - Multi-sensor batch operations\n  - Quality indicators and signal monitoring\n\n- **⚡ Actuator Control** - Command industrial equipment:\n  - Valve control (open/close)\n  - Motor management (start/stop/speed)\n  - Pump operations\n  - PLC register manipulation\n\n- **🚨 Alarm System** - Enterprise-grade monitoring:\n  - Multi-priority alarms (LOW, MEDIUM, HIGH, CRITICAL)\n  - Automatic threshold monitoring\n  - Alarm acknowledgment tracking\n  - Real-time notifications\n\n- **🔒 Production Features** - Enterprise-ready:\n  - Rate limiting for command safety\n  - Comprehensive error handling\n  - Connection pooling and auto-reconnect\n  - Full audit logging\n  - Thread-safe operations\n\n## 🚀 Quick Start\n\n### Installation\n\n```bash\n# Clone the repository\ngit clone https://github.com/llm-use/iot-mcp-server.git\ncd iot-mcp-server\n\n# Install dependencies\npip install -r requirements.txt\n\n# For testing without hardware, use simulation mode\npip install -r requirements-sim.txt\n```\n\n### Starting the Server\n\n**Option 1: Simulation Mode (No Hardware Required)**\n```bash\npython IoT_mcp_sim.py\n```\n\n**Option 2: Production Mode (Real Hardware)**\n```bash\n# Configure your devices in iot_config.yaml\n# Start required services (MQTT, InfluxDB, Redis)\ndocker-compose up -d\n\n# Start the server\npython IoT_mcp.py\n```\n\nServer will start on `http://localhost:8000`\n\n## 🤖 Using with PolyMCP\n\nThis MCP server is designed to work seamlessly with **[PolyMCP](https://github.com/llm-use/Polymcp)** - a powerful framework for orchestrating MCP servers with AI agents.\n\n### Example: AI-Controlled Industrial System\n\n```python\n#!/usr/bin/env python3\nimport asyncio\nfrom polymcp.polyagent import UnifiedPolyAgent, OllamaProvider\n\nasync def main():\n    # Initialize your LLM provider\n    llm = OllamaProvider(model=\"gpt-oss:120b-cloud\", temperature=0.1)\n    \n    # Connect to IoT MCP server\n    agent = UnifiedPolyAgent(\n        llm_provider=llm, \n        mcp_servers=[\"http://localhost:8000/mcp\"],  \n        verbose=True\n    )\n    \n    async with agent:\n        print(\"✅ IoT MCP Server connected!\\n\")\n        \n        # Chat with your AI to control the industrial system\n        while True:\n            user_input = input(\"\\n🏭 You: \")\n            \n            if user_input.lower() in ['exit', 'quit']:\n                break\n            \n            result = await agent.run_async(user_input, max_steps=5)\n            print(f\"\\n🤖 System: {result}\")\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n### Example Commands\n\nOnce connected, you can ask the AI agent to:\n\n- *\"Check the status of all temperature sensors and report any anomalies\"*\n- *\"What's the average pressure in tank 1 over the last 6 hours?\"*\n- *\"Open the main valve and start pump 1\"*\n- *\"Show me all critical alarms that haven't been acknowledged\"*\n- *\"If temperature exceeds 50°C, activate cooling system\"*\n- *\"Generate an end-of-shift report with key metrics\"*\n- *\"Monitor vibration sensor and alert if it exceeds normal range\"*\n- *\"Optimize energy consumption by analyzing motor usage patterns\"*\n\n**That's it!** PolyMCP handles all the complexity of:\n- Tool discovery and selection\n- Multi-step industrial process automation\n- Real-time monitoring and alerting\n- Complex decision logic implementation\n\n## 📡 API Endpoints\n\nOnce the server is running, you can access:\n\n- **API Documentation**: `http://localhost:8000/docs`\n- **List All Tools**: `http://localhost:8000/mcp/list_tools`\n- **Invoke Tool**: `POST http://localhost:8000/mcp/invoke/{tool_name}`\n\n## 🛠️ Available Tools\n\n\u003cdetails\u003e\n\u003csummary\u003eView all available tools (11 tools)\u003c/summary\u003e\n\n### Sensor Operations\n- **`read_sensor`** - Read current value from a single sensor\n- **`read_multiple_sensors`** - Batch read multiple sensors\n- **`get_sensor_history`** - Retrieve historical data with optional aggregation\n\n### Actuator Control\n- **`execute_actuator_command`** - Send commands to actuators (valves, motors, pumps)\n\n### System Management\n- **`get_device_topology`** - View complete system architecture\n- **`list_devices`** - List all registered devices with status\n- **`get_system_status`** - Overall system health and statistics\n\n### Alarm Management\n- **`get_active_alarms`** - View active alarms by priority\n- **`acknowledge_alarm`** - Confirm alarm acknowledgment\n\n### PLC Operations\n- **`read_modbus_registers`** - Read PLC registers via Modbus\n- **`write_modbus_register`** - Write values to PLC registers\n\n\u003c/details\u003e\n\n## 🔧 Configuration\n\n### Basic Configuration (`iot_config.yaml`)\n\n```yaml\nmqtt:\n  broker: \"localhost\"\n  port: 1883\n  username: \"iot_user\"\n  password: \"secure_password\"\n\nmodbus:\n  devices:\n    - device_id: \"plc_01\"\n      name: \"Main PLC\"\n      type: \"tcp\"\n      host: \"192.168.1.100\"\n      port: 502\n\ninfluxdb:\n  url: \"http://localhost:8086\"\n  token: \"your-token\"\n  org: \"iot\"\n  bucket: \"sensors\"\n\nredis:\n  host: \"localhost\"\n  port: 6379\n```\n\n### Environment Variables\n\n```bash\nexport MQTT_BROKER=\"broker.hivemq.com\"\nexport INFLUX_TOKEN=\"your-token\"\nexport REDIS_HOST=\"localhost\"\n```\n\n## 📋 Requirements\n\n**For Production Mode:**\n- Python 3.8+\n- MQTT Broker (Mosquitto, EMQX, HiveMQ, or any MQTT 3.1.1/5.0 broker)\n- InfluxDB 2.0+ (for time-series data)\n- Redis (for caching)\n- Industrial devices (PLCs with Modbus, IoT sensors)\n\n**For Simulation Mode:**\n- Python 3.8+\n- No external dependencies!\n\n## 🐛 Troubleshooting\n\n**Can't connect to MQTT?**\n- Check broker is running: `mosquitto_sub -h localhost -t '#'`\n- Verify credentials in config\n- Check firewall settings\n\n**Modbus connection failed?**\n- Ensure PLC is accessible: `ping \u003cplc_ip\u003e`\n- Verify Modbus is enabled on device\n- Check port (usually 502 for TCP)\n\n**No sensor data?**\n- Check MQTT topics match configuration\n- Verify sensor is publishing data\n- Look at Redis cache: `redis-cli get sensor:*`\n\n## 🏗️ Architecture\n\n```\n┌─────────────┐     ┌─────────────┐     ┌─────────────┐\n│ IoT Sensors │────▶│  MQTT       │────▶│             │\n└─────────────┘     │  Broker     │     │             │\n                    └─────────────┘     │   IoT MCP   │     ┌─────────────┐\n┌─────────────┐     ┌─────────────┐     │   Server    │────▶│  PolyMCP    │\n│    PLCs     │────▶│  Modbus     │────▶│             │     │  AI Agent   │\n└─────────────┘     └─────────────┘     │             │     └─────────────┘\n                                        │             │\n┌─────────────┐                         │             │     ┌─────────────┐\n│  InfluxDB   │◀────────────────────────│             │────▶│   Redis     │\n└─────────────┘                         └─────────────┘     └─────────────┘\n```\n\n## 🤝 Contributing\n\nContributions are welcome! This project demonstrates industrial IoT integration with MCP protocol.\n\n### Development Setup\n\n```bash\n# Clone repo\ngit clone https://github.com/llm-use/iot-mcp-server.git\n\n# Create virtual environment\npython -m venv venv\nsource venv/bin/activate  # or venv\\Scripts\\activate on Windows\n\n# Install dev dependencies\npip install -r requirements-dev.txt\n\n# Run tests\npytest tests/\n```\n\n## 📝 License\n\nMIT License - See LICENSE file for details\n\n## 🔗 Related Projects\n\n- **[PolyMCP](https://github.com/llm-use/Polymcp)** - Simple and efficient way to interact with MCP servers using custom agents\n- **[Model Context Protocol](https://modelcontextprotocol.io/)** - Open protocol for tool integration with LLMs\n- **[MQTT Protocol](https://mqtt.org/)** - Lightweight messaging protocol for IoT\n- **[Modbus Protocol](https://modbus.org/)** - Industrial communication protocol\n- **[Mqttcpp](https://github.com/JustVugg/Mqttcpp)** - A lightweight and fast C++ library for building MQTT clients and brokers\n\n\n## 💡 Why This Project?\n\nThis MCP server bridges the gap between **Industrial IoT** and **AI agents**. With PolyMCP, you can:\n\n1. **Natural Language Control** - \"Check all pressure sensors and alert if any are abnormal\"\n2. **Complex Automation** - AI can orchestrate multi-step industrial processes\n3. **Predictive Maintenance** - AI analyzes trends and predicts failures\n4. **Energy Optimization** - AI optimizes equipment usage for efficiency\n5. **Incident Response** - AI handles alarms and executes emergency procedures\n\nNo complex industrial protocols to learn - PolyMCP and AI handle everything!\n\n## 🚀 Use Cases\n\n- **Smart Factory** - AI-driven production line optimization\n- **Building Automation** - Intelligent HVAC and lighting control\n- **Energy Management** - Real-time consumption optimization\n- **Predictive Maintenance** - Equipment failure prediction\n- **Quality Control** - Automated anomaly detection\n- **Emergency Response** - AI-managed incident handling\n\n---\n\n**Designed for [PolyMCP](https://github.com/llm-use/Polymcp)**\n\n*Star ⭐ this repo if you find it useful!*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoly-mcp%2FIoT-Edge-MCP-Server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpoly-mcp%2FIoT-Edge-MCP-Server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoly-mcp%2FIoT-Edge-MCP-Server/lists"}