NodeMCU MCP Service
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Integrations
NodeMCU MCP (Model Context Protocol) Service
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.
Overview
NodeMCU MCP provides a management solution for ESP8266/NodeMCU IoT devices with these key capabilities:
- Monitor device status and telemetry
- Send commands to devices remotely
- Update device configurations
- Integration with AI assistants through MCP protocol
Visualizations
Features
- š Device Management: Register, monitor, and control NodeMCU devices
- š Real-time Communication: WebSocket interface for real-time updates
- āļø Configuration Management: Update device settings remotely
- š Command Execution: Send restart, update, status commands remotely
- š” Telemetry Collection: Gather sensor data and device metrics
- š Authentication: Secure API access with JWT authentication
- š§ AI Integration: Work with Claude Desktop and other MCP-compatible AI tools
Quick Start
Prerequisites
- Node.js 16.x or higher
- npm or yarn
- For the NodeMCU client: Arduino IDE with ESP8266 support
Installation
From npm (once published)
From source
Configuration
- Create a
.env
file based on the example:Copy - Update the
.env
file with your settings:Copy
Usage
Running as API Server
Development mode with auto-restart:
Production mode:
Running as MCP Server
For integration with Claude Desktop or other MCP clients:
If installed globally:
Command Line Options
MCP Integration
This project now uses the official Model Context Protocol (MCP) TypeScript SDK to provide integration with Claude for Desktop and other MCP clients.
MCP Tools
The following tools are available through the MCP interface:
- list-devices: List all registered NodeMCU devices and their status
- get-device: Get detailed information about a specific NodeMCU device
- send-command: Send a command to a NodeMCU device
- update-config: Update the configuration of a NodeMCU device
Using with Claude for Desktop
To use this server with Claude for Desktop:
- Install Claude for Desktop from https://claude.ai/desktop
- Configure Claude for Desktop by editing
~/Library/Application Support/Claude/claude_desktop_config.json
:
- Restart Claude for Desktop
- You should now see the NodeMCU tools in the Claude for Desktop interface
Running the MCP Server Standalone
To run the MCP server directly:
Or using the CLI:
API Documentation
Authentication
- POST /api/auth/login - Login and get JWT tokenResponse:CopyCopy
- POST /api/auth/validate - Validate JWT tokenCopy
Devices API
All device endpoints require authentication with a JWT token:
List Devices
Response:
Get Device Details
Response:
Send Command to Device
Request:
Response:
WebSocket Protocol
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.
NodeMCU Client Setup
Refer to the Arduino sketch in the examples
directory for a complete client implementation.
Key Steps
- Install required libraries in Arduino IDE:
- ESP8266WiFi
- WebSocketsClient
- ArduinoJson
- Configure the sketch with your WiFi and server settings:Copy
- Upload the sketch to your NodeMCU device
Development
Project Structure
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License is a permissive license that allows you to:
- Use the software commercially
- Modify the software
- Distribute the software
- Use and modify the software privately
The only requirement is that the license and copyright notice must be included with the software.
Acknowledgments
- Model Context Protocol for the integration specification
- NodeMCU for the amazing IoT platform
- Anthropic for Claude Desktop
This server cannot be installed
A service for managing ESP8266/NodeMCU IoT devices that provides both REST/WebSocket APIs and implements the Model Context Protocol for AI assistant integration.