Skip to main content
Glama

OMNI-MQTT-MCP

MQTT MCP Server with configurable transport options via CLI: STDIO (default), Streamable HTTP (recommended for web), and SSE (deprecated).

๐Ÿš€ Quick Start

# Install dependencies
pip install -r requirements.txt

# Run with STDIO (default - for local development)
python mqtt_mcp_server.py

# Run with Streamable HTTP (recommended for web)
python mqtt_mcp_server.py --transport streamable-http

# Run with SSE (deprecated)
python mqtt_mcp_server.py --transport sse

Related MCP server: MCP MQTT Server

๐Ÿ“‹ Transport Options

Choose your transport with the --transport CLI argument:

1. STDIO Transport (Default) โœ…

python mqtt_mcp_server.py --transport stdio
# or simply:
python mqtt_mcp_server.py
  • Best for: Local development, Claude Desktop integration

  • Pros: Simple, secure, works with MCP clients like Claude Desktop

  • Cons: Local only, no remote access

2. Streamable HTTP (Recommended for Web) ๐ŸŒ

python mqtt_mcp_server.py --transport streamable-http
python mqtt_mcp_server.py --transport streamable-http --host 0.0.0.0 --http-port 9000
  • Best for: Web deployments, remote access, microservices

  • Default URL: http://127.0.0.1:8000/mcp

  • Pros: Modern, efficient, supports multiple clients, easy deployment

  • Cons: Requires network setup, security considerations

3. SSE (Server-Sent Events) โš ๏ธ Deprecated

python mqtt_mcp_server.py --transport sse
  • Best for: Legacy deployments (not recommended for new projects)

  • Default URL: http://127.0.0.1:8000/sse

  • Status: Being phased out in favor of Streamable HTTP

๐Ÿ›  Available Tools

  • mqtt_publish: Publish messages to MQTT topics

  • mqtt_subscribe: Subscribe to MQTT topics and receive messages

โš™๏ธ Configuration Options

MQTT Configuration

python mqtt_mcp_server.py \
  --broker localhost \
  --port 1883 \
  --client-id mcp-mqtt-client \
  --username your_username \
  --password your_password

Transport Configuration

python mqtt_mcp_server.py \
  --transport streamable-http \
  --host 127.0.0.1 \
  --http-port 8000 \
  --path /mcp

All Options

python mqtt_mcp_server.py --help

Environment Variables

You can also use environment variables for MQTT settings:

export MQTT_BROKER_ADDRESS=localhost
export MQTT_PORT=1883
export MQTT_CLIENT_ID=mcp-mqtt-client
export MQTT_USERNAME=your_username
export MQTT_PASSWORD=your_password

python mqtt_mcp_server.py --transport streamable-http

๐Ÿงช Testing

Test HTTP Server

# Terminal 1: Start server
python mqtt_mcp_server.py --transport streamable-http

# Terminal 2: Test it
python test_http_client.py

Test with Claude Desktop

Add to your Claude Desktop MCP configuration:

{
  "mcpServers": {
    "mqtt": {
      "command": "python",
      "args": ["/path/to/mqtt_mcp_server.py"],
      "env": {
        "MQTT_BROKER_ADDRESS": "localhost",
        "MQTT_PORT": "1883"
      }
    }
  }
}

๐Ÿ”ง Development

Using the MCP CLI

# Run in development mode with MCP Inspector
mcp dev mqtt_mcp_server.py

# Run with specific transport via MCP CLI
mcp run mqtt_mcp_server.py -- --transport streamable-http --http-port 9000

๐Ÿ“š Examples

Local Development

# Default STDIO for Claude Desktop
python mqtt_mcp_server.py

Web Deployment

# HTTP server on port 8000
python mqtt_mcp_server.py --transport streamable-http

# HTTP server on custom port and host
python mqtt_mcp_server.py --transport streamable-http --host 0.0.0.0 --http-port 9000

# Custom path
python mqtt_mcp_server.py --transport streamable-http --path /api/mcp

Production with Custom MQTT

python mqtt_mcp_server.py \
  --transport streamable-http \
  --broker mqtt.example.com \
  --port 8883 \
  --username prod_user \
  --password secret123 \
  --host 0.0.0.0 \
  --http-port 80

๐Ÿค” Which Transport Should I Choose?

Use Case

Command

Why?

Local development

python mqtt_mcp_server.py

Simple, secure, works with Claude Desktop

Web deployment

python mqtt_mcp_server.py --transport streamable-http

Modern, efficient, easy to deploy

Remote AI agents

python mqtt_mcp_server.py --transport streamable-http --host 0.0.0.0

Supports authentication, scalable

Legacy systems

python mqtt_mcp_server.py --transport sse

Only if you're already using SSE

๐Ÿณ Docker with Ngrok

Run the server inside Docker and automatically expose it with an ngrok tunnel.

Build

docker build -t mqtt-mcp-ngrok .

Run

docker run -d \
  -p 8000:8000 \
  -e NGROK_AUTHTOKEN=<YOUR_TOKEN> \
  -e TRANSPORT=sse \
  -e FASTMCP_PORT=8000 \
  -e MQTT_BROKER_ADDRESS=mqtt.example.com \
  -e MQTT_PORT=8883 \
  -e MQTT_CLIENT_ID=my-client \
  -e MQTT_USERNAME=prod_user \
  -e MQTT_PASSWORD=secret123 \
  mqtt-mcp-ngrok

The container exposes the MCP server via ngrok. Pass environment variables to configure the MQTT broker and server transport. Check the container logs to discover the public URL.

๐Ÿ“š Learn More

๐Ÿ”’ Security Notes

  • STDIO: Runs locally, inherently secure

  • HTTP/SSE: Consider adding authentication for production deployments

  • MQTT: Configure MQTT broker security (TLS, authentication)

Available Tools

2 tools
mqtt_publishB
Publishes a message to a specific MQTT topic.

Args:
    topic: The MQTT topic to publish to.
    message: The message payload to send.
    qos: The Quality of Service level (0, 1, or 2). Defaults to 0.
    retain: Whether the message should be retained by the broker. Defaults to False.

Returns:
    A confirmation message string.
ParametersJSON Schema
NameRequiredDescriptionDefault
topicYes
messageYes
qosNo
retainNo

TDQS

B3.2/5.0
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the basic action (publishing) and return value (confirmation message), but lacks critical behavioral details like authentication requirements, error handling, network behavior, or what happens if the broker is unavailable. For a network operation with potential side effects, this is insufficient transparency.

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?

The description is perfectly structured and concise: a clear purpose statement followed by well-organized parameter documentation with defaults indicated. Every sentence adds value with no redundancy or unnecessary information. The Args/Returns format makes it easy to parse while maintaining readability.

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?

Given the tool's moderate complexity (network operation with 4 parameters) and complete lack of annotations/output schema, the description does an adequate job covering the basics but has significant gaps. It explains parameters well and states the return type, but misses critical behavioral context about authentication, error conditions, and MQTT-specific behaviors that would help an agent use it correctly.

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?

The description adds significant value beyond the schema, which has 0% description coverage. It explains each parameter's purpose: 'topic' as the destination, 'message' as the payload, 'qos' with valid values (0,1,2) and default, and 'retain' with meaning and default. This compensates well for the schema's lack of descriptions, though it could provide more context about QoS implications.

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 clearly states the action ('Publishes a message') and target resource ('to a specific MQTT topic'), making the purpose immediately understandable. It distinguishes from the sibling 'mqtt_subscribe' by specifying the opposite operation (publish vs subscribe). However, it doesn't explicitly mention what makes this tool unique beyond the basic verb, so it falls short of a perfect 5.

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?

The description provides no guidance on when to use this tool versus alternatives or in what context it should be applied. While the sibling tool 'mqtt_subscribe' exists, there's no explicit comparison or recommendation about choosing between publish and subscribe operations. This leaves the agent without usage context beyond the basic purpose.

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

mqtt_subscribeA
Subscribes to an MQTT topic and receives a specified number of messages or waits for a timeout.

Args:
    topic: The MQTT topic to subscribe to (can include wildcards like + or #).
    num_messages: The maximum number of messages to receive. Defaults to 1.
    timeout: The maximum time (in seconds) to wait for messages. Defaults to 10.

Returns:
    A list of dictionaries, where each dictionary represents a received message
    with 'topic' and 'payload' keys.
ParametersJSON Schema
NameRequiredDescriptionDefault
topicYes
num_messagesNo
timeoutNo

TDQS

A3.8/5.0
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It explains the subscription behavior, message collection, and timeout mechanism, but lacks details about connection requirements, error handling, or what happens if no messages arrive. It provides basic operational context but misses important behavioral aspects.

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?

The description is perfectly structured with a clear opening sentence followed by well-organized Args and Returns sections. Every sentence earns its place by providing essential information without redundancy. The formatting enhances readability while maintaining brevity.

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?

Given the tool's moderate complexity (3 parameters, no annotations, no output schema), the description covers the basic operation and parameters well but lacks information about connection state, authentication requirements, error conditions, and the format of the returned payload. It's adequate for basic use but incomplete for robust implementation.

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

Parameters5/5

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

The schema description coverage is 0%, so the description must fully compensate. It provides detailed semantic information for all three parameters: explains topic wildcards (+ and #), clarifies num_messages as a maximum with default, and specifies timeout units (seconds) with default. This adds significant value beyond the bare schema.

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

Purpose5/5

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

The description clearly states the specific action ('Subscribes to an MQTT topic') and resource ('receives a specified number of messages or waits for a timeout'), distinguishing it from the sibling tool mqtt_publish. It provides a complete picture of what the tool does beyond just the verb.

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?

The description provides no guidance on when to use this tool versus alternatives like mqtt_publish, nor does it mention prerequisites, error conditions, or typical use cases. It only describes what the tool does without contextual usage information.

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. 2 tool updatesv1.0.0
    • First observedmqtt_publish
    • First observedmqtt_subscribe

TDQS

B3.4/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have clearly distinct purposes: mqtt_publish sends messages to a topic, while mqtt_subscribe receives messages from a topic. There is no overlap in functionality, and an agent can easily tell them apart based on their names and descriptions.

Naming Consistency5/5

Both tools follow a consistent mqtt_verb pattern (mqtt_publish and mqtt_subscribe), which clearly indicates they belong to the MQTT domain. The naming is predictable and readable throughout the set.

Tool Count2/5

With only 2 tools, the server feels thin for an MQTT domain, which typically involves operations like connect, disconnect, list topics, or manage brokers. While publish and subscribe are core, the lack of other essential functions limits its scope and utility.

Completeness2/5

The tool set is severely incomplete for MQTT operations. It lacks basic functionality such as connecting to/disconnecting from a broker, listing topics, or managing subscriptions beyond a single call. This will cause agent failures when trying to perform common MQTT workflows.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Connects Claude and other MCP-compatible AI assistants to a Coreflux MQTT broker, enabling them to discover and execute Coreflux commands for managing models, actions, rules, and routes through natural language.
    4
    Apache 2.0
  • 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
    Not graded
    quality
    D
    maintenance
    Connects AI assistants to MQTT brokers for smart home automation and IoT device control, enabling topic discovery, sensor reading, command sending, and event monitoring.
    2
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables LLM agents to securely monitor and control MQTT devices for building automation, industrial control, and smart home systems through a standardized MCP interface.
    21
    MIT