MM

mcp2everything/mcp2mqtt

Developer tools

This page was translated automatically. Technical details may differ from the original. View the original

371 stars 60 forks Quality 68 Trend 19MIT

By converting the MCP protocol to the MQTT protocol, this project enables us to leverage powerful large language models (LLMs) to easily control your smart home, robots, or other hardware devices.

Overview

mcp2mqtt is a project that connects IoT devices to AI large models, seamlessly connecting the physical world with AI large models through the Model Context Protocol (MCP) and MQTT protocols. Final implementation: - Control your hardware devices with natural language - AI responds in real time and adjusts physical parameters - Enables your devices to understand and execute complex commands - Enables interconnection between devices via MQTT - - Supports MQTT protocol publish/subscribe mode - Supports various MQTT servers (such as Mosquitto, EMQ X, etc.) - Supports QoS quality assurance - Supports topic filtering and message routing - Real-time status monitoring and error handling - - Full support for Model Context Protocol - Resource management and tool invocation - Flexible prompt system - Command publishing and response via MQTT 1. PWM Control: - Command: PWM {Value} - Example: - PWM 100 (max) - PWM 0 (off) - PWM 50 (50%) - Response: CMD PWM {Value} OK 2. LED Control: - Command: LED {Status} - Example: - LED on - LED off - Response: CMD LED {Status} OK mcp2mqtt supports all clients implementing the MCP protocol, as well as IoT devices that support the MQTT protocol: The installation script will automatically perform the following steps: - Check the system environment - Install necessary dependencies - Create default configuration files - Configure Claude desktop edition (if installed) It mainly relies on the UV tool, so once Python, UV, and Claude or Cline are installed, it works.

Overview (machine translated)

English | Chinese Simplified

Hardware controlled by natural language ushers in a new era of the Internet of Things

System Architecture

MCP2MQTT system architecture diagram

Workflow

mcp2mqtt workflowchart

Project Vision

mcp2mqtt is a project that connects IoT devices to AI large models, seamlessly connecting the physical world with AI large models through the Model Context Protocol (MCP) and MQTT protocols. Final implementation:

  • Control your hardware devices in natural language
  • AI responds in real time and adjusts physical parameters
  • Equip your devices with the ability to understand and execute complex commands
  • Enables interconnection between devices via the MQTT protocol

Main Features

  • Intelligent MQTT Communication

  • Supports the publish/subscribe mode of the MQTT protocol

  • Supports various MQTT servers (such as Mosquitto, EMQ X, etc.)

  • Supports QoS service quality assurance

  • Supports topic filtering and message routing

  • Real-time status monitoring and error handling

  • MCP protocol integration

  • Full support for Model Context Protocol

  • Supports resource management and tool calls

  • Flexible prompt system

  • Implementing command issuance and response via MQTT

Configuration Instructions

MQTT configuration

Command configuration

MQTT Commands and Responses

Command format

The command uses a simple text format:

  1. PWM Control:
  • Command: PWM {值}
  • Example:
  • PWM 100(maximum)
  • PWM 0(Closed)
  • PWM 50(50%)
  • Response: CMD PWM {值} OK
  1. LED Control:
  • Command: LED {状态}
  • Example:
  • LED on (Open)
  • LED off(Close)
  • Response: CMD LED {状态} OK
  1. Equipment Information:
  • Command: INFO
  • Response: CMD INFO {设备信息}

Error response

If an error occurs, the response format will be: ERROR: {错误信息}

Supported clients

mcp2mqtt supports all clients implementing the MCP protocol, as well as IoT devices that support the MQTT protocol:

Client Type Feature Support Description
Claude Desktop Full support Recommended, supports all MCP functions
Continue Full support Excellent development tool integration
Cline Resources + Tools Supports multiple AI providers
MQTT devices Publish/subscribe IoT devices supporting all MQTT protocols

Get Started Quickly

1. Installation

Windows users

Download install.py

macOS users

This page was translated automatically. Technical details may differ from the original.

Install

uvx mcp2mqtt
New to MCP? Start with the mcpskill.org guide →

Configuration

{ "mcpServers": { "mcp2mqtt": { "command": "uvx", "args": [ "mcp2mqtt" ] } } }