Parse and generate MQTT packets like a breeze
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.
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.
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.
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', // retainConnect — If protocolVersion is 3, clientId is mandatory and generate will throw if missingConnack — The only mandatory argument is returnCode, as generate will throw if missingSubscribe — The Subscribe tool exposed by this serverSuback — All the granted qos must be < 256, as they are encoded as UInt8. All properties are mandatoryUnsubscribe — The Unsubscribe tool exposed by this serverUnsuback — The Unsuback tool exposed by this serverPublish — Only the topic property is mandatory. Both topic and payload can be Buffer objects instead of strings. messageId is mandatory for qos > 0Puback — The only mandatory property is messageId, as generate will throw if missingPubrec — The only mandatory property is messageId, as generate will throw if missingPubrel — The only mandatory property is messageId, as generate will throw if missingThis 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.
| Tool | What it does |
|---|---|
| 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([ // 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 |
| 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. |
| Pubcomp | The only mandatory property is messageId, as generate will throw if missing. |
| Pingreq | The Pingreq tool exposed by this server. |
{
"mcpServers": {
"mqtt": {
"command": "npx",
"args": ["-y", "mqtt-packet"]
}
}
}Add to claude_desktop_config.json, then restart Claude Desktop.
Kill hallucinated APIs — version-accurate, up-to-date library documentation injected straight into context.
Microsoft's official browser automation server — drive a real browser through the accessibility tree, no screenshots needed.
GitHub's official server — repos, issues, pull requests, Actions and code security, straight from your assistant.
Issue tracking at the speed of conversation — Linear's official hosted server with OAuth and zero install.
Local repository surgery — status, diffs, commits, branches and history for any repo on disk.
Timezone sanity for AI — current time anywhere and correct conversions, without the model doing date math.