Mqtt MCP Server

Parse and generate MQTT packets like a breeze

Local serverstdio

What is the Mqtt MCP server?

If you already use Mqtt, the mqtt mcp server is the piece that lets your assistant work with it directly. Parse and generate MQTT packets like a breeze.

What the server does

This library is tested with node v6, v8, v10, v12 and v14. The last version to support older versions of node was mqtt-packet@4.1.2.

Installation

The server ships on npm as mqtt-packet, so your MCP client can launch it on demand — there is no separate build step. Add the server block to your client's configuration, restart it, and the tools register themselves.

Available tools

The toolset is worth reading before you wire it up, because it tells you what the integration is really for:

  • Generating — console.log(mqtt.generate(object)) // Prints: // // <Buffer 30 0a 00 04 74 65 73 74 74 65 73 74> // // Which is the same as: // // Buffer.from([ //
  • Parsing — // Synchronously emits all the parsed packets parser.on('packet', packet => { console.log(packet) // Prints: // // { // cmd: 'publish', // retain
  • Connect — If protocolVersion is 3, clientId is mandatory and generate will throw if missing
  • Connack — The only mandatory argument is returnCode, as generate will throw if missing
  • Subscribe — The Subscribe tool exposed by this server
  • Suback — All the granted qos must be < 256, as they are encoded as UInt8. All properties are mandatory
  • Unsubscribe — The Unsubscribe tool exposed by this server
  • Unsuback — The Unsuback tool exposed by this server
  • Publish — Only the topic property is mandatory. Both topic and payload can be Buffer objects instead of strings. messageId is mandatory for qos > 0
  • Puback — The only mandatory property is messageId, as generate will throw if missing
  • Pubrec — The only mandatory property is messageId, as generate will throw if missing
  • Pubrel — The only mandatory property is messageId, as generate will throw if missing

Worth knowing first

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • With 14 tools registered it takes up a noticeable share of the context window; turn it off in projects that never touch Mqtt.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

Where it fits

This sits in the developer tooling group, where several servers overlap in what they claim to do but differ sharply once you actually set them up. Mqtt's toolset — Generating, Parsing, Connect and 11 more — is a fair guide to whether it matches your workflow. It is maintained by matteo.collina; worth a glance at recent repository activity before you build anything load-bearing on it.

This entry was verified against Mqtt's own documentation before publication; SyncDev keeps the directory reviewed rather than auto-generated.

Available tools

ToolWhat it does
Generatingconsole.log(mqtt.generate(object)) // Prints: // // <Buffer 30 0a 00 04 74 65 73 74 74 65 73 74> // // Which is the same as: // // Buffer.from([ // 48, 10, // Header (publish) // 0, 4, // Topic length // 116, 101, 115, 1
Parsing// Synchronously emits all the parsed packets parser.on('packet', packet => { console.log(packet) // Prints: // // { // cmd: 'publish', // retain: false, // qos: 0, // dup: false, // length: 10, // topic: 'test', // payl
ConnectIf protocolVersion is 3, clientId is mandatory and generate will throw if missing.
ConnackThe only mandatory argument is returnCode, as generate will throw if missing.
SubscribeThe Subscribe tool exposed by this server.
SubackAll the granted qos __must__ be < 256, as they are encoded as UInt8. All properties are mandatory.
UnsubscribeThe Unsubscribe tool exposed by this server.
UnsubackThe Unsuback tool exposed by this server.
PublishOnly the topic property is mandatory. Both topic and payload can be Buffer objects instead of strings. messageId is mandatory for qos > 0.
PubackThe only mandatory property is messageId, as generate will throw if missing.
PubrecThe only mandatory property is messageId, as generate will throw if missing.
PubrelThe only mandatory property is messageId, as generate will throw if missing.
PubcompThe only mandatory property is messageId, as generate will throw if missing.
PingreqThe Pingreq tool exposed by this server.

How to install the Mqtt MCP server

{
  "mcpServers": {
    "mqtt": {
      "command": "npx",
      "args": ["-y", "mqtt-packet"]
    }
  }
}

Add to claude_desktop_config.json, then restart Claude Desktop.

Example prompts to try

  • Use Mqtt to Generating.
  • Use Mqtt to Parsing.
  • Use Mqtt to Connect.

Frequently asked questions

It connects Mqtt to MCP-compatible AI assistants such as Claude and Cursor, exposing 14 tools (Generating, Parsing, Connect, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Mqtt directly.