amanasmueimcp-server-nodemcu
Built by Metorial, the integration platform for agentic AI.
amanasmueimcp-server-nodemcu
Server Summary
Monitor device status
Send commands to devices
Update device configurations remotely
Integrate with AI tools
Provide RESTful API
Implement WebSocket interface
A Model Context Protocol (MCP) service for managing NodeMCU devices. This service provides both a standard RESTful API/WebSocket interface and implements the Model Context Protocol for integration with AI tools like Claude Desktop.
NodeMCU MCP provides a management solution for ESP8266/NodeMCU IoT devices with these key capabilities:
System Architecture Overview
Data Flow Between Components
How Claude Desktop Interacts with NodeMCU Devices
To install NodeMCU Manager for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @amanasmuei/nodemcu-mcp --client claude
# Global installation (recommended for MCP integration)
npm install -g nodemcu-mcp
# Local installation
npm install nodemcu-mcp
# Clone the repository
git clone https://github.com/amanasmuei/nodemcu-mcp.git
cd nodemcu-mcp
# Install dependencies
npm install
# Optional: Install globally for MCP integration
npm install -g .
Create a .env
file based on the example:
cp .env.example .env
Update the .env
file with your settings:
# Server Configuration
PORT=3000
HOST=localhost
# Security
JWT_SECRET=your_strong_random_secret_key
# Log Level (error, warn, info, debug)
LOG_LEVEL=info
Development mode with auto-restart:
npm run dev
Production mode:
npm start
For integration with Claude Desktop or other MCP clients:
npm run mcp
If installed globally:
nodemcu-mcp --mode=mcp
Usage: nodemcu-mcp [options]
Options:
-m, --mode Run mode (mcp, api, both) [string] [default: "both"]
-p, --port Port for API server [number] [default: 3000]
-h, --help Show help [boolean]
--version Show version number [boolean]
This project now uses the official Model Context Protocol (MCP) TypeScript SDK to provide integration with Claude for Desktop and other MCP clients.
The following tools are available through the MCP interface:
To use this server with Claude for Desktop:
~/Library/Application Support/Claude/claude_desktop_config.json
:{
"mcpServers": {
"nodemcu": {
"command": "node",
"args": [
"/ABSOLUTE/PATH/TO/YOUR/PROJECT/mcp_server_sdk.js"
]
}
}
}
To run the MCP server directly:
npm run mcp
Or using the CLI:
./bin/cli.js --mode=mcp
POST /api/auth/login - Login and get JWT token
{
"username": "admin",
"password": "admin123"
}
Response:
{
"message": "Login successful",
"token": "your.jwt.token",
"user": {
"id": 1,
"username": "admin",
"role": "admin"
}
}
POST /api/auth/validate - Validate JWT token
{
"token": "your.jwt.token"
}
All device endpoints require authentication with a JWT token:
Authorization: Bearer your.jwt.token
GET /api/devices
Response:
{
"count": 1,
"devices": [
{
"id": "nodemcu-001",
"name": "Living Room Sensor",
"type": "ESP8266",
"status": "online",
"ip": "192.168.1.100",
"firmware": "1.0.0",
"lastSeen": "2023-05-15T14:30:45.123Z"
}
]
}
GET /api/devices/:id
Response:
{
"id": "nodemcu-001",
"name": "Living Room Sensor",
"type": "ESP8266",
"status": "online",
"ip": "192.168.1.100",
"firmware": "1.0.0",
"lastSeen": "2023-05-15T14:30:45.123Z",
"config": {
"reportInterval": 30,
"debugMode": false,
"ledEnabled": true
},
"lastTelemetry": {
"temperature": 23.5,
"humidity": 48.2,
"uptime": 3600,
"heap": 35280,
"rssi": -68
}
}
POST /api/devices/:id/command
Request:
{
"command": "restart",
"params": {}
}
Response:
{
"message": "Command sent to device",
"command": "restart",
"params": {},
"response": {
"success": true,
"message": "Device restarting"
}
}
The WebSocket server is available at the root path: ws://your-server:3000/
For details on the WebSocket protocol messages, refer to the code or the examples directory.
Refer to the Arduino sketch in the examples
directory for a complete client implementation.
Install required libraries in Arduino IDE:
Configure the sketch with your WiFi and server settings:
// WiFi credentials
const char* ssid = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASSWORD";
// MCP Server settings
const char* mcpHost = "your-server-ip";
const int mcpPort = 3000;
Upload the sketch to your NodeMCU device
nodemcu-mcp/
āāā assets/ # Logo and other static assets
āāā bin/ # CLI scripts
āāā examples/ # Example client code
āāā middleware/ # Express middleware
āāā routes/ # API routes
āāā services/ # Business logic
āāā .env.example # Environment variables example
āāā index.js # API server entry point
āāā mcp_server.js # MCP protocol implementation
āāā mcp-manifest.json # MCP manifest
āāā package.json # Project configuration
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.
MIT License is a permissive license that allows you to:
The only requirement is that the license and copyright notice must be included with the software.