# MQTT MCP Server

> MQTT MCP Server is an open-source MCP server for industrial automation. MCP server for configuring MQTT brokers and sending business messages from AI clients. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, API, Linux, macOS, Windows
- **Repository:** https://github.com/majinju/mqtt-mcp
- **MCP Registry name:** io.github.majinju/mqtt-mcp
- **Categories:** [industrial automation](https://ai-powered.com/categories/industrial-automation)
- **Listing updated:** 2026-11-21

## About

Connection settings for one or more MQTT brokers are saved locally, so an AI client only has to name a connection once. After that, reusable message templates build topics and JSON payloads from variables, including nested fields, defaults, and generated values such as UUIDs and timestamps.

Daily use centres on a single send action that renders a saved template and publishes it, connecting automatically if needed. Raw publish, subscribe, unsubscribe and a buffered message reader are also exposed for lower-level work, with topic wildcards and TLS certificate input supported.

The server suits people wiring AI assistants into industrial or IoT setups who want device commands and status checks without handling broker addresses or message formats each time. The README is written in Chinese and the server runs over stdio through npx or a global npm install.

## Features

- **Saved broker connections:** Named connection profiles with host, port, credentials and TLS options persist between sessions.
- **Reusable message templates:** Topics and payload bodies are defined once with variable placeholders and validation for missing values.
- **One-step sending:** A single send call renders a template and publishes it, connecting first when required.
- **Raw pub/sub tools:** Direct publish, subscribe and unsubscribe operations support wildcard topic filters.
- **Buffered message reading:** Received messages are kept in a per-connection buffer of up to 500 entries and can be filtered by topic or time.
- **Placeholder syntax:** Templates support nested paths, default values, typed substitution and built-in variables for time and UUIDs.

## Good for

- Send device control commands from an AI assistant to IoT hardware
- Read status messages published by factory equipment
- Publish standard business event messages without rebuilding topic strings
- Switch between several brokers or environments by named connection

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add mqtt-mcp -- npx -y mqtt-mcp-server
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```json
{
  "mcpServers": {
    "mqtt-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mqtt-mcp-server"
      ]
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "mqtt-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mqtt-mcp-server"
      ]
    }
  }
}
```

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "mqtt-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mqtt-mcp-server"
      ]
    }
  }
}
```

Use .cursor/mcp.json in a project to share it with the project.

### VS Code (~/.copilot/mcp-config.json)

```json
{
  "mcpServers": {
    "mqtt-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "mqtt-mcp-server"
      ]
    }
  }
}
```

Or put the same entry in .mcp.json at your workspace root to share it.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add mqtt-mcp -- npx -y mqtt-mcp-server
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.mqtt-mcp]
command = "npx"
args = ["-y", "mqtt-mcp-server"]
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```json
{
  "mcpServers": {
    "mqtt-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mqtt-mcp-server"
      ]
    }
  }
}
```

Or run: gemini mcp add -s user mqtt-mcp npx -- -y mqtt-mcp-server

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```json
{
  "mcpServers": {
    "mqtt-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mqtt-mcp-server"
      ]
    }
  }
}
```

Use .agents/mcp_config.json to add it to one workspace only.

### Devin Desktop (~/.config/devin/mcp_config.json)

```json
{
  "mcpServers": {
    "mqtt-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mqtt-mcp-server"
      ]
    }
  }
}
```

On Windows the file is %APPDATA%\\devin\\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

### Cline (cline_mcp_settings.json)

```json
{
  "mcpServers": {
    "mqtt-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mqtt-mcp-server"
      ]
    }
  }
}
```

Open it from the MCP Servers icon → Configure → Configure MCP Servers.

### Zed (Zed settings.json)

```json
{
  "context_servers": {
    "mqtt-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mqtt-mcp-server"
      ]
    }
  }
}
```

Open it with zed: open settings file. Merge context_servers into the settings you already have.

### JetBrains AI Assistant and Junie: AI Assistant (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```json
{
  "mcpServers": {
    "mqtt-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mqtt-mcp-server"
      ]
    }
  }
}
```

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```json
{
  "mcpServers": {
    "mqtt-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mqtt-mcp-server"
      ]
    }
  }
}
```

Use .junie/mcp/mcp.json to share it with a project.

### Kiro (~/.kiro/settings/mcp.json)

```json
{
  "mcpServers": {
    "mqtt-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mqtt-mcp-server"
      ]
    }
  }
}
```

Use .kiro/settings/mcp.json to add it to one workspace only.

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "mqtt-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mqtt-mcp-server"
      ]
    }
  }
}
```

## Tools

From the tool list in its README, going by the names, 2 of 13 tools delete data and 2 change data; 9 names don't say. From the server's own tool labels and tool names; not verified by us.

- `mqtt_configure`: Create or update a named connection configuration and persist it
- `mqtt_connections`: View connection configurations and live status without passwords
- `mqtt_connect`: Establish a named connection
- `mqtt_disconnect`: Disconnect while keeping the configuration
- `mqtt_remove_connection` (name suggests: deletes): Delete a connection configuration
- `mqtt_publish` (name suggests: changes): Publish a raw message
- `mqtt_subscribe`: Subscribe to a topic with + and # wildcards
- `mqtt_unsubscribe`: Cancel a subscription
- `mqtt_messages`: Read received messages with filters and optional clearing
- `mqtt_template_save`: Define or update a business message template
- `mqtt_templates`: List all templates and their required variables
- `mqtt_send` (name suggests: changes): Send a message rendered from a business template
- `mqtt_template_remove` (name suggests: deletes): Delete a business template

## FAQ

### How are broker credentials stored?

Passwords are saved in plain text in a local config file, so the README advises restricting that file's permissions.

### Can TLS connections be used?

Yes. The mqtts and wss protocols are supported, with CA, certificate and key values passed as PEM content, and self-signed certificates can be accepted.

### What is needed to run MQTT MCP Server?

Node.js 18 or later. It can be launched with npx or installed globally from npm.

### Is MQTT MCP Server free?

Yes. MQTT MCP Server is open source, so you can use and self-host it for free.

### How do I add MQTT MCP Server to Claude Code?

Run this command in your terminal: claude mcp add mqtt-mcp -- npx -y mqtt-mcp-server

### What are the best alternatives to MQTT MCP Server?

The closest alternatives to MQTT MCP Server are MQTT, OPC-UA MCP Server and Sparkplug B.

## Where this comes from

- Description: written from the project's README and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [MQTT](https://ai-powered.com/mcp/mqtt): MQTT is an open-source MCP server for industrial automation.
- [OPC-UA MCP Server](https://ai-powered.com/mcp/opc-ua-mcp-server-2): OPC-UA MCP Server is an open-source MCP server for industrial automation.
- [Sparkplug B](https://ai-powered.com/mcp/sparkplug-b): Sparkplug B is an open-source MCP server for industrial automation.

---
Source: https://ai-powered.com/mcp/mqtt-mcp-server
