Get the FREE Ultimate OpenClaw Setup Guide →

mqttx -sse

An implementation of the Model-Context Protocol (MCP) that enables MQTT operations over Server-Sent Events (SSE) transport.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio ysfscream-mqttx-mcp-sse-server node server.js \
  --env PORT="4000" \
  --env MCP_VERSION="2024-11-05"

How to use

This MCP server exposes MQTT operations over Server-Sent Events (SSE) using the MCP protocol. Clients connect to the SSE endpoint to establish a persistent session and then issue JSON-RPC commands to manage MQTT connections, subscriptions, and publications. The server supports initializing an MCP session, listing available tools, and calling MQTT-related tools such as mqttConnect, mqttSubscribe, and mqttPublish, enabling real-time MQTT interactions via MCP transport.

How to install

Prerequisites:

  • Node.js v14 or later
  • npm
  1. Clone the repository git clone https://github.com/yourusername/mqttx-sse-server.git cd mqttx-sse-server

  2. Install dependencies npm install

  3. Configure environment (optional)

    • PORT: Port to run the server (default 4000)
    • MCP_VERSION: MCP protocol version to advertise (e.g., 2024-11-05)
  4. Start the server npm start

The server will start on port 4000 by default and expose the SSE endpoint at /mqttx/sse.

Additional notes

Notes and tips:

  • The MCP tools exposed include mqttConnect, mqttSubscribe, and mqttPublish for interacting with MQTT brokers.
  • Use the SSE endpoint GET /mqttx/sse to establish a persistent connection for real-time updates.
  • Use POST /mqttx/message?sessionId= to send JSON-RPC commands once the SSE connection is established.
  • Ensure your MQTT broker is reachable from the server environment and that firewall rules allow outbound MQTT connections if required.
  • If you encounter connection issues, verify the PORT environment variable and that the MCP_VERSION matches the client expectations.
  • For debugging, inspect server logs for tool invocation requests and responses to trace JSON-RPC exchanges.

Related MCP Servers

Sponsor this space

Reach thousands of developers