home / mcp / iot device control mcp server
IoT Model Context Protocol Server Repository
Configuration
View docs{
"mcpServers": {
"jordy33-iot_mcp_server": {
"command": "python",
"args": [
"iot_mcp_server.py"
],
"env": {
"HOST": "0.0.0.0",
"PORT": "8090",
"MQTT_PORT": "1883",
"TRANSPORT": "sse",
"MQTT_BROKER": "localhost",
"MEM0_API_KEY": "YOUR_API_KEY",
"MEM0_ENDPOINT": "https://api.mem0.ai"
}
}
}
}You will run two MCP servers to control IoT devices and to store and retrieve memories for context-aware applications. The IoT server lets you send commands, check device state, and subscribe to updates, while the Memory server persists memories and enables semantic search. Together, they provide a unified way to manage devices and memories through the Model Context Protocol.
Connect to each MCP server from your MCP client and perform actions using the available endpoints. For IoT device control, you can send device commands, query the current device state, and subscribe to real-time updates. For memory management, you can save memories, retrieve all stored memories, and search memories semantically. Use the two servers in tandem to orchestrate device actions with contextual memory.
Practical usage patterns you can implement include automating a scene by issuing a command to a device based on memory-derived context, continuously monitoring device state to adjust lighting or climate, and saving important interaction histories to the memory store for later retrieval and analysis.
Prerequisites: you need Python installed on your system. You also need pip to install dependencies.
# Step 1: Prepare your environment by cloning the project repository
# (Replace with your actual repository URL if you are setting this up in a new environment)
git clone https://example.com/jordy33/iot_mcp_server.git
cd iot_mcp_server
# Step 2: Install dependencies
pip install -r requirements.txt
# Step 3: Create a local environment configuration
cp .env.example .env
# Edit .env to set environment variables for your IoT and Memory serversStep 4: Run the IoT MCP server and the Memory MCP server in separate terminals to start both services.
pip install -r requirements.txt
# Run IoT MCP server
python iot_mcp_server.py
# In another terminal, run Memory MCP server
python memory_mcp_server.pyConfiguration and environment variables. The IoT MCP server uses MQTT for device communication and exposes HTTP-like MCP endpoints. It is configured via the following environment variables: MQTT_BROKER, MQTT_PORT, HOST, PORT, and TRANSPORT (choices: sse or stdio). The Memory MCP server uses Mem0 for persistent storage and uses MEM0_API_KEY (optional) and MEM0_ENDPOINT, along with HOST, PORT, and TRANSPORT.
Security notes. Use secure MQTT credentials and restrict access to the MCP endpoints. Consider enabling transport security where possible and keeping MEM0_API_KEY confidential if you enable Mem0 integration.
Troubleshooting tips. If a server fails to start, verify that the required environment variables are set in your .env file, ensure the port is not in use by another process, and check the server log output for connection or authentication errors.
Notes. The IoT server provides features for sending commands, querying state, and subscribing to updates, while the Memory server offers save, retrieve, and semantic search of memories. Run both servers to enable full functionality in your automation and AI workflows.
Send a command to an IoT device through the MCP server, returning acknowledgment or result.
Query the current state and status of an IoT device.
Subscribe to real-time updates from a device to receive state changes and events.
Save information to long-term memory in Mem0 via the Memory MCP Server.
Retrieve all memories stored for the user from Mem0.
Perform semantic search over stored memories to find relevant context.