ioehub-mqtt-mcp-server
0
IoEHub MQTT MCP Server is a system designed to monitor and control IoT devices, specifically temperature sensors and LEDs, through MQTT communication and the Model Context Protocol. It uses FastMCP for protocol handling and supports JSON-RPC for client-server communication. The project is implemented in Python and enables interfacing with physical devices for real-time data monitoring and control.
IoEHub MQTT MCP Server
Overview
This document describes an MCP (Model Context Protocol) server using MQTT to read temperature sensor data and control LEDs. The server is based on the FastMCP framework and communicates using the JSON-RPC protocol.
Key Components:
- MCP Client (Claude AI)
- Provides a user interface
- Sends JSON-RPC requests to MCP Server
- Displays results to users
- MCP Server (Python/FastMCP)
- Processes client requests
- Communicates with MQTT Broker
- Translates between JSON-RPC and MQTT protocols
- MQTT Broker (172.30.1.100)
- Central hub for MQTT messages
- Routes messages between server and devices
- IoT Device (Temperature Sensor/LED)
- Physical hardware devices
- Provides temperature data
- Controls LED states based on commands
System Components:
- Framework: FastMCP
- Protocols: MQTT, JSON-RPC 2.0
- Language: Python
- Features: Temperature measurement, LED control
Data Flow:
- Client → Server: Function call for temperature reading or LED control
- Server → Broker: Publishes MQTT message
- Broker → Device: Forwards command to the device
- Device → Broker: Publishes response
- Broker → Server: Delivers response to subscribed server
- Server → Client: Returns processed data result
Usage
Server Execution
Run python mcp_server.py
to start the server.
Function Calls
Example for client invocation:
- Temperature: Call
ioehub_mqtt_get_temperature
- LED Control: Call
ioehub_mqtt_set_led
with appropriate parameters