Skip to main content
Glama

MQTT MCP Server

An MCP (Model Context Protocol) server that enables Cursor to read messages from an MQTT broker.

Features

  • Subscribe to MQTT topics (supports wildcards + and #)

  • Read buffered messages from subscribed topics

  • List active subscriptions

  • Configurable message buffer size

Related MCP server: OMNI-MQTT-MCP

Installation

  1. Install dependencies:

npm install
  1. Build the project:

npm run build
  1. Copy .env.example to .env and configure your MQTT broker settings:

cp .env.example .env

Configuration

Edit the .env file with your MQTT broker details:

Variable

Description

Default

MQTT_BROKER_URL

MQTT broker URL (mqtt:// or mqtts://)

mqtt://localhost:1883

MQTT_USERNAME

Username for authentication

(none)

MQTT_PASSWORD

Password for authentication

(none)

MQTT_CLIENT_ID

Client ID for MQTT connection

cursor-mqtt-mcp-{timestamp}

MAX_MESSAGES_PER_TOPIC

Max messages to buffer per topic

100

Cursor Configuration

Add this MCP server to your Cursor settings (.cursor/mcp.json or global settings):

{
  "mcpServers": {
    "mqtt": {
      "command": "node",
      "args": ["C:/path/to/mqtt-mcp/dist/index.js"],
      "env": {
        "MQTT_BROKER_URL": "mqtt://your-broker:1883",
        "MQTT_USERNAME": "your_username",
        "MQTT_PASSWORD": "your_password"
      }
    }
  }
}

Alternatively, if using a .env file in the project directory:

{
  "mcpServers": {
    "mqtt": {
      "command": "node",
      "args": ["C:/path/to/mqtt-mcp/dist/index.js"],
      "cwd": "C:/path/to/mqtt-mcp"
    }
  }
}

Available Tools

mqtt_subscribe

Subscribe to an MQTT topic to start receiving messages.

Parameters:

  • topic (required): The MQTT topic to subscribe to

  • qos (optional): Quality of Service level (0, 1, or 2). Default: 0

Example:

Subscribe to "sensors/temperature"
Subscribe to "devices/+/status" (single-level wildcard)
Subscribe to "home/#" (multi-level wildcard)

mqtt_unsubscribe

Unsubscribe from an MQTT topic.

Parameters:

  • topic (required): The MQTT topic to unsubscribe from

mqtt_read_messages

Read buffered messages from subscribed topics.

Parameters:

  • topic (optional): Specific topic to read from. If omitted, reads from all topics

  • limit (optional): Maximum messages to return. Default: 10

  • clear (optional): Clear buffer after reading. Default: false

mqtt_list_subscriptions

List all active subscriptions and their message counts.

Parameters: None

Usage Example

  1. First, subscribe to a topic:

    "Subscribe to the MQTT topic sensors/temperature"

  2. Wait for messages to arrive, then read them:

    "Read the latest messages from sensors/temperature"

  3. Check all active subscriptions:

    "List my MQTT subscriptions"

  4. Unsubscribe when done:

    "Unsubscribe from sensors/temperature"

License

MIT

Available Tools

5 tools
mqtt_list_subscriptionsB

List all active MQTT topic subscriptions and their message counts.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full disclosure burden. It mentions 'active' and 'message counts' but says nothing about whether counts are per-topic cumulative or recent, whether the list is paginated, what happens with zero subscriptions, or connection/auth requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, front-loaded with the verb and resource, no redundant or filler text. Every word contributes to scope.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter list tool with no annotations and no output schema, the description conveys the core purpose but omits return shape, count semantics, and filtering/ordering behavior. Adequate but with clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Parameter count is 0, so there are no parameters to document; baseline is 4. The description adds no parameter noise, appropriately matching the empty schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a clear verb (list) and resource (MQTT topic subscriptions) with additional scope (active, message counts). It is distinguishable from mqtt_subscribe/mqtt_unsubscribe by implication, but does not explicitly differentiate from siblings like mqtt_read_messages.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this versus alternatives like mqtt_read_messages (which might also surface messages) or when subscriptions become inactive. Usage is only implied by the verb.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

mqtt_publishB

Publish a message to an MQTT topic. Useful for sending test data or triggering actions on the broker.

ParametersJSON Schema
NameRequiredDescriptionDefault
qosNoQuality of Service level (0, 1, or 2). Default is 0.
topicYesThe MQTT topic to publish to (e.g., 'agents/test/status')
retainNoWhether to set the retain flag on the message. Default is false.
messageYesThe message payload to publish

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral burden and largely fails it: it says nothing about delivery guarantees, connection/broker prerequisites, error behavior on failure, or whether the call blocks. The only behavioral hints (QoS, retain) live in the schema, not the description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short sentences, the action front-loaded and the rationale second. No redundancy, no filler, immediately scannable.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 4-parameter publish tool with no annotations and no output schema, the description is minimally sufficient on the 'what' but silent on operational context an agent would want (required connection state, failure modes, whether a response is returned).

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so topic, message, qos, and retain are already fully documented with types, defaults, and an example. The description adds no semantic detail beyond the schema, which is the baseline expectation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Publish a message to an MQTT topic'), which is unmistakably distinct from the subscribe/read/list siblings. It does not, however, explicitly name or contrast itself with any sibling tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The second sentence gives a use context ('sending test data or triggering actions on the broker'), which implies when the tool is appropriate. There is no explicit when-not guidance or reference to alternatives such as mqtt_subscribe for consuming messages.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

mqtt_read_messagesA

Read buffered messages from a subscribed topic. Returns the most recent messages received since subscribing. Supports MQTT wildcards: '+' for single level, '#' for multi-level (e.g., 'sensors/#' returns messages from all topics under 'sensors/').

ParametersJSON Schema
NameRequiredDescriptionDefault
clearNoWhether to clear the message buffer after reading. Default is false.
limitNoMaximum number of messages to return. Default is 10. Set to 0 or omit to return all messages.
topicNoThe MQTT topic to read messages from. Supports wildcards (+, #) to read from multiple matching topics. If not provided, returns messages from all subscribed topics.

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does disclose useful behavior: buffered (not live) retrieval, most-recent-first ordering, and wildcard expansion. It omits buffer capacity, eviction/retention behavior, and whether reads are non-destructive by default (that detail lives only in the schema's 'clear' param).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three tight sentences: core action first, then return semantics, then the wildcard capability. Zero filler and the most important fact leads.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read tool with no annotations and no output schema, the description stops short of what an agent needs: the structure of a returned message (topic, payload, timestamp) and the ordering of the returned array are unspecified. Buffer semantics are covered, but the response contract is not.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all three parameters including wildcard support and the clear/limit defaults. The description's wildcard sentence largely restates the topic schema description and adds no format or edge-case detail beyond it, so baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb and resource ('Read buffered messages from a subscribed topic') and characterizes the return set ('most recent messages received since subscribing'), which separates it functionally from siblings like mqtt_list_subscriptions. It never names a sibling to actively steer selection, so it falls short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied: 'from a subscribed topic' and 'since subscribing' suggest a subscription must already exist, and reading buffered history implies this is the retrieval step after mqtt_subscribe. There is no explicit when-to-use/when-not statement and no guidance on choosing this over mqtt_list_subscriptions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

mqtt_subscribeB

Subscribe to an MQTT topic to start receiving messages. Supports MQTT wildcards: '+' for single level, '#' for multi-level.

ParametersJSON Schema
NameRequiredDescriptionDefault
qosNoQuality of Service level (0, 1, or 2). Default is 0.
topicYesThe MQTT topic to subscribe to (e.g., 'sensors/temperature' or 'sensors/+/status')

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full behavioral burden, yet it only adds the wildcard syntax rule. It says nothing about subscription persistence, whether re-subscribing to the same topic replaces or duplicates, error behavior for invalid topics, or required broker/auth state.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two tight sentences with the core action front-loaded and the wildcard syntax as supporting detail. Every sentence earns its place with no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a two-parameter tool with a fully documented schema and no output schema, the description covers the essentials, but with zero annotations it omits subscription lifecycle behavior (persistence, duplicate subscriptions, error handling) that an agent would need to call it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so both parameters are already documented, which sets the baseline at 3. The description adds real meaning for the topic parameter by defining '+' as single-level and '#' as multi-level wildcards, but it says nothing about qos beyond what the schema enum already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb (subscribe) and resource (MQTT topic) and explains the outcome ('start receiving messages'), so the operation is unambiguous. It does not explicitly differentiate itself from siblings such as mqtt_read_messages or mqtt_list_subscriptions, but the verb alone makes the distinction reasonably clear.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied by 'to start receiving messages', which hints at the subscribe-then-receive workflow, but there is no explicit statement of when to subscribe versus use mqtt_read_messages or mqtt_list_subscriptions, nor any prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

mqtt_unsubscribeB

Unsubscribe from an MQTT topic to stop receiving messages.

ParametersJSON Schema
NameRequiredDescriptionDefault
topicYesThe MQTT topic to unsubscribe from

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden and it is thin. It notes that unsubscribing stops receiving messages, but says nothing about scope (per-client vs. global), behavior if the topic was never subscribed, error handling, or whether the unsubscribe is durable across reconnects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One short sentence, front-loaded with the action and outcome, with no filler. It is efficient but almost too terse to be considered polished structure.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter tool with no output schema and no annotations, the description is minimally sufficient but omits error conditions and operational scope. An agent could call it, but with no guidance on edge cases.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There is a single parameter with 100% schema description coverage ('The MQTT topic to unsubscribe from'), so the schema already does the work and the description adds nothing further about topic format or wildcard handling. Baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (unsubscribe) and resource (MQTT topic) with the effect (stop receiving messages), which clearly separates it from mqtt_subscribe and mqtt_publish. It does not, however, explicitly name or contrast a sibling, so it stops short of the top band.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied: an agent can infer that this reverses a subscription, but there is no statement of when to call it, when not to, or how it relates to mqtt_list_subscriptions or mqtt_read_messages. Adequate but with a clear gap.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updatesv1.0.0
    • First observedmqtt_list_subscriptions
    • First observedmqtt_publish
    • First observedmqtt_read_messages
    • First observedmqtt_subscribe
    • First observedmqtt_unsubscribe

TDQS

A3.7/5.0

Scored across 5 tools

Disambiguation5/5

Each tool targets a distinct MQTT operation: subscribe, unsubscribe, publish, read buffered messages, and list active subscriptions. The read and list tools are clearly separated by their descriptions, and no two tools appear to do the same thing.

Naming Consistency4/5

All tool names use the mqtt_ prefix and snake_case, which is highly consistent. The only minor deviation is that some names include an explicit object (read_messages, list_subscriptions) while others rely on implicit context (subscribe, unsubscribe, publish), but the pattern remains predictable.

Tool Count5/5

Five tools is well-scoped for an MQTT interaction server, covering the essential subscribe, unsubscribe, publish, read, and list operations without unnecessary bloat. Each tool earns its place and the set feels complete for typical messaging tasks.

Completeness4/5

The core MQTT lifecycle is covered: subscribe, unsubscribe, publish, read buffered messages, and list subscriptions. Minor gaps exist, such as no explicit tool to clear buffered messages or manage connection state, but these are workaround-able or handled outside the tool surface.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables LLM agents to interact with MQTT brokers through publish, subscribe, and query operations. Provides fine-grained topic permissions with wildcard support for secure IoT device communication and sensor data access.
    1
    BSD 3-Clause
  • A
    license
    B
    quality
    D
    maintenance
    Enables AI assistants to publish and subscribe to MQTT topics with configurable transport options (STDIO, Streamable HTTP, SSE), supporting both local development and web deployments with flexible broker authentication.
    2
    MIT