EMQX

by benniu

25 211 downloads Not rated yet Apache-2.0
GitHub

About

Integrates with EMQX MQTT broker to enable real-time IoT device management, client monitoring, and message publishing for MQTT-enabled systems.

Details

Repository
Benniu/emqx-mcp-server
License
Apache-2.0

Explore

- List, inspect, and disconnect MQTT clients
- Publish messages with QoS and retention control
- Subscribe to topics via SSE with duration and message limits
- Flexible client filtering by node, username, client ID
- Support for EMQX Cloud and self-hosted clusters

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name EMQX
    Command (node, npx, python, etc.) docker
    Arguments
    • Argument 1 run
    • Argument 2 -i
    • Argument 3 --rm
    • Argument 4 -e
    • Argument 5 EMQX_API_URL=https://your-emqx-cloud-instance.com:8443/api/v5
    • Argument 6 -e
    • Argument 7 EMQX_API_KEY=<YOUR-API-KEY>
    • Argument 8 -e
    • Argument 9 EMQX_API_SECRET=<YOUR-API-SECRET>
    • Argument 10 benniuji/emqx-mcp-server

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Before using the EMQX MCP Server tools, you need to set up an EMQX cluster with properly configured API Key and client authentication. There are several options:

1. EMQX Cloud Serverless Deployment:
- The easiest way to get started with.
- Obtain a free serverless deployment from EMQX Cloud
- Sign up at EMQX Cloud Serverless

2. EMQX Cloud Dedicated Deployment:
- Provides dedicated resources for production workloads
- Offers enhanced performance, reliability, and customization options
- Supports various cloud providers (AWS, GCP, Azure)
- Includes professional SLA and support
- Create a deployment at EMQX Cloud Dedicated

3. Self-hosted EMQX Platform:
- Download and deploy EMQX Platform locally
- Follow installation instructions at EMQX Platform

> Note: The subscribe_mqtt_topic tool uses the SSE (Server-Sent Events) endpoint, which is available on EMQX Cloud deployments. Not all self-hosted EMQX deployments support the SSE subscribe endpoint.

To install emqx-mcp-server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @Benniu/emqx-mcp-server --client claude

First, ensure you have the uv executable installed. If not, you can install it by following the instructions here.

1. Install Claude Desktop App if you haven't done so yet.
2. Clone this repository.
3. Add the following to your claude_desktop_config.json file:
- On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
- On Windows: %APPDATA%/Claude/claude_desktop_config.json

    {
"mcpServers": {
"EMQX_MCP_Server": {
"command": "uv",
"args": [
"--directory",
"path/to/repo/src/emqx_mcp_server",
"run",
"emqx-mcp-server"
],
"env":{
"EMQX_API_URL":"https://your-emqx-cloud-instance.com:8443/api/v5",
"EMQX_API_KEY":"<YOUR-API-KEY>",
"EMQX_API_SECRET":"<YOUR-API-SECRET>"
}
}
}
}

Note: Make sure to update ``path/to/repo/src/emqx_mcp_server` to the actual path and modify the environment variables `EMQX_API_URL`, `EMQX_API_KEY`, and `EMQX_API_SECRET`` to match your EMQX instance.
4. Open or Restart Claude Desktop App
5. Try asking Claude to do something with the MQTT broker (e.g. ask it to publish an MQTT message to a topic).

list_mqtt_clients

List MQTT clients connected to your EMQX Cluster. Inputs: page (number, optional), limit (number, optional), node (string, optional), clientid (string, optional), username (string, optional), ip_address (string, optional), conn_state (string, optional), clean_start (boolean, optional), proto_ver (string, optional), like_clientid (string, optional), like_username (string, optional), like_ip_address (string, optional).

get_mqtt_client

Get detailed information about a specific MQTT client by client ID. Inputs: clientid (string, required).

kick_mqtt_client

Disconnect a client from the MQTT broker by client ID. Inputs: clientid (string, required).

publish_mqtt_message

Publish an MQTT Message to Your EMQX Cluster on EMQX Cloud or Self-Managed Deployment. Inputs: topic (string, required), payload (string, required), qos (number, optional), retain (boolean, optional).

subscribe_mqtt_topic

Subscribe to an MQTT topic via SSE on EMQX Cloud and collect messages for a specified duration. Inputs: topic (string, required), duration (number, optional), max_messages (number, optional). Returns: Object containing topic, message_count, and messages array.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "emqx": {
            "env": {},
            "args": [
                "run",
                "-i",
                "--rm",
                "-e",
                "EMQX_API_URL=https://your-emqx-cloud-instance.com:8443/api/v5",
                "-e",
                "EMQX_API_KEY=<YOUR-API-KEY>",
                "-e",
                "EMQX_API_SECRET=<YOUR-API-SECRET>",
                "benniuji/emqx-mcp-server"
            ],
            "command": "docker"
        }
    }
}

Linux

{
    "env": [],
    "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "EMQX_API_URL=https://your-emqx-cloud-instance.com:8443/api/v5",
        "-e",
        "EMQX_API_KEY=<YOUR-API-KEY>",
        "-e",
        "EMQX_API_SECRET=<YOUR-API-SECRET>",
        "benniuji/emqx-mcp-server"
    ],
    "command": "docker"
}

Macos

{
    "env": [],
    "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "EMQX_API_URL=https://your-emqx-cloud-instance.com:8443/api/v5",
        "-e",
        "EMQX_API_KEY=<YOUR-API-KEY>",
        "-e",
        "EMQX_API_SECRET=<YOUR-API-SECRET>",
        "benniuji/emqx-mcp-server"
    ],
    "command": "docker"
}

Windows

{
    "env": [],
    "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "EMQX_API_URL=https://your-emqx-cloud-instance.com:8443/api/v5",
        "-e",
        "EMQX_API_KEY=<YOUR-API-KEY>",
        "-e",
        "EMQX_API_SECRET=<YOUR-API-SECRET>",
        "benniuji/emqx-mcp-server"
    ],
    "command": "docker"
}
smithery badge

<a href="https://glama.ai/mcp/servers/m7zgbcr053">
emqx-mcp-server MCP server
</a>

A Model Context Protocol (MCP) server implementation that provides EMQX MQTT broker interaction.
Enabling MCP clients to interact with the MQTT clusters on EMQX Cloud or self-hosted clusters

Features

MQTT Client Management

- Client Listing: View all connected MQTT clients with flexible filtering options
- Client Information: Retrieve detailed information about specific clients
- Connection Control: Disconnect problematic or stale clients from the broker
- Flexible Filtering: Filter clients by node, username, client ID, connection state, and more

MQTT Message Publishing

- Topic-based Publishing: Send messages to any MQTT topics
- QoS Control: Select Quality of Service level (0, 1, or 2) for reliable delivery
- Message Retention: Option to persist messages for new subscribers
- Custom Payloads: Support for any message content format

MQTT Topic Subscription (SSE)

- Real-time Subscription: Subscribe to MQTT topics via Server-Sent Events (SSE)
- Duration Control: Configure how long to listen for messages (1-300 seconds)
- Message Limiting: Set maximum number of messages to collect per subscription
- Automatic Parsing: Messages are automatically parsed from SSE event stream

Tools

list_mqtt_clients

- List MQTT clients connected to your EMQX Cluster - Inputs: - page (number, optional): Page number (default: 1) - limit (number, optional): Results per page (default: 100, max 10000) - node (string, optional): Filter by specific node name - clientid (string, optional): Filter by specific client ID - username (string, optional): Filter by specific username - ip_address (string, optional): Filter by client IP address - conn_state (string, optional): Filter by connection state - clean_start (boolean, optional): Filter by clean start flag - proto_ver (string, optional): Filter by protocol version - like_clientid (string, optional): Fuzzy search by client ID pattern - like_username (string, optional): Fuzzy search by username pattern - like_ip_address (string, optional): Fuzzy search by IP address pattern

get_mqtt_client

- Get detailed information about a specific MQTT client by client ID - Inputs: - clientid (string, required): The unique identifier of the client to retrieve

kick_mqtt_client

- Disconnect a client from the MQTT broker by client ID - Inputs: - clientid (string, required): The unique identifier of the client to disconnect

publish_mqtt_message

- Publish an MQTT Message to Your EMQX Cluster on EMQX Cloud or Self-Managed Deployment - Inputs: - topic (string, required): MQTT topic to publish to - payload (string, required): Message content to publish - qos (number, optional): Quality of Service level (0, 1, or 2) (default: 0) - retain (boolean, optional): Whether to retain the message (default: false)

subscribe_mqtt_topic

- Subscribe to an MQTT topic via SSE on EMQX Cloud and collect messages for a specified duration - Inputs: - topic (string, required): MQTT topic to subscribe to - duration (number, optional): How long to listen in seconds (1-300, default: 30) - max_messages (number, optional): Maximum messages to collect (1-1000, default: 100) - Returns: Object containing topic, message_count, and messages array

Setup EMQX Cluster

Before using the EMQX MCP Server tools, you need to set up an EMQX cluster with properly configured API Key and client authentication. There are several options:

1. EMQX Cloud Serverless Deployment:
- The easiest way to get started with.
- Obtain a free serverless deployment from EMQX Cloud
- Sign up at EMQX Cloud Serverless

2. EMQX Cloud Dedicated Deployment:
- Provides dedicated resources for production workloads
- Offers enhanced performance, reliability, and customization options
- Supports various cloud providers (AWS, GCP, Azure)
- Includes professional SLA and support
- Create a deployment at EMQX Cloud Dedicated

3. Self-hosted EMQX Platform:
- Download and deploy EMQX Platform locally
- Follow installation instructions at EMQX Platform

> Note: The subscribe_mqtt_topic tool uses the SSE (Server-Sent Events) endpoint, which is available on EMQX Cloud deployments. Not all self-hosted EMQX deployments support the SSE subscribe endpoint.

Running locally with the Claude Desktop App

Option 1: Installing via Smithery

To install emqx-mcp-server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @Benniu/emqx-mcp-server --client claude

Option 2: Docker

1. Install Claude Desktop App if you haven't done so yet.
2. Pull the image:

   docker pull benniuji/emqx-mcp-server

3. Add the following to your claude_desktop_config.json file:
- On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
- On Windows: %APPDATA%/Claude/claude_desktop_config.json

    {
      "mcpServers": {
        "EMQX_MCP_Server": {
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "-e", "EMQX_API_URL=https://your-emqx-cloud-instance.com:8443/api/v5",
            "-e", "EMQX_API_KEY=<YOUR-API-KEY>",
            "-e", "EMQX_API_SECRET=<YOUR-API-SECRET>",
            "benniuji/emqx-mcp-server"
          ]
        }
      }
    }
    
Note: Update the env variables:``EMQX_API_URL`, `EMQX_API_KEY`, `EMQX_API_SECRET
4. Open or Restart Claude Desktop App
5. Try asking Claude to do something with the MQTT broker (e.g. ask it to publish an MQTT message to a topic).

Option 3: Manual Installation

First, ensure you have the uv executable installed. If not, you can install it by following the instructions here.

1. Install Claude Desktop App if you haven't done so yet.
2. Clone this repository.
3. Add the following to your
claude_desktop_config.json file:
- On MacOS:
~/Library/Application\ Support/Claude/claude_desktop_config.json
- On Windows:
%APPDATA%/Claude/claude_desktop_config.json


{
"mcpServers": {
"EMQX_MCP_Server": {
"command": "uv",
"args": [
"--directory",
"path/to/repo/src/emqx_mcp_server",
"run",
"emqx-mcp-server"
],
"env":{
"EMQX_API_URL":"https://your-emqx-cloud-instance.com:8443/api/v5",
"EMQX_API_KEY":"<YOUR-API-KEY>",
"EMQX_API_SECRET":"<YOUR-API-SECRET>"
}
}
}
}
    Note: Make sure to update 
path/to/repo/src/emqx_mcp_server
` to the actual path and modify the environment variables `EMQX_API_URL`, `EMQX_API_KEY`, and `EMQX_API_SECRET`` to match your EMQX instance.
4. Open or Restart Claude Desktop App
5. Try asking Claude to do something with the MQTT broker (e.g. ask it to publish an MQTT message to a topic).

Example Prompts

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.

Videos about EMQX

Relevant YouTube tutorials, setups, and demos