EMQX MCP 服务器
提供与 EMQX MQTT 代理交互的模型上下文协议 (MCP)服务器实现。使 MCP 客户端能够与EMQX Cloud或自托管集群上的 MQTT 集群进行交互。
特征
MQTT 客户端管理
客户端列表:使用灵活的过滤选项查看所有连接的 MQTT 客户端
客户信息:检索特定客户的详细信息
连接控制:断开有问题或过时的客户端与代理的连接
灵活过滤:按节点、用户名、客户端 ID、连接状态等过滤客户端
MQTT消息发布
基于主题的发布:向任何 MQTT 主题发送消息
QoS 控制:选择服务质量级别(0、1 或 2)以实现可靠交付
消息保留:为新订阅者保留消息的选项
自定义有效负载:支持任何消息内容格式
Related MCP server: MCP REST API Server
工具
列出 mqtt 客户端
列出连接到 EMQX 集群的 MQTT 客户端
输入:
page(数字,可选):页码(默认值:1)
limit(数字,可选):每页结果数(默认值:100,最大 10000)
节点(字符串,可选):按特定节点名称过滤
clientid(字符串,可选):按特定客户端 ID 进行过滤
用户名(字符串,可选):按特定用户名过滤
ip_address(字符串,可选):按客户端 IP 地址过滤
conn_state(字符串,可选):按连接状态过滤
clean_start(布尔值,可选):按干净启动标志过滤
proto_ver(字符串,可选):按协议版本过滤
like_clientid (string,可选):按客户端 ID 模式进行模糊搜索
like_username(字符串,可选):按用户名模式模糊搜索
like_ip_address(字符串,可选):按 IP 地址模式进行模糊搜索
获取mqtt客户端
通过客户端 ID 获取特定 MQTT 客户端的详细信息
输入:
clientid(字符串,必需):要检索的客户端的唯一标识符
kick_mqtt_客户端
根据客户端 ID 断开客户端与 MQTT 代理的连接
输入:
clientid(字符串,必需):要断开连接的客户端的唯一标识符
发布_mqtt_消息
在 EMQX 云或自管理部署上向 EMQX 集群发布 MQTT 消息
输入:
topic(字符串,必需):要发布的 MQTT 主题
有效载荷(字符串,必需):要发布的消息内容
qos(数字,可选):服务质量级别(0、1 或 2)(默认值:0)
retain(布尔值,可选):是否保留消息(默认值:false)
设置 EMQX 集群
在使用 EMQX MCP 服务器工具之前,您需要搭建一个 EMQX 集群,并正确配置 API 密钥和客户端身份验证。有以下几种选择:
EMQX Cloud 无服务器部署:
最简单的入门方法。
从 EMQX Cloud 获取免费的无服务器部署
EMQX 云专属部署:
为生产工作负载提供专用资源
提供增强的性能、可靠性和定制选项
支持各种云提供商(AWS、GCP、Azure)
包括专业的 SLA 和支持
在EMQX Cloud Dedicated上创建部署
自托管 EMQX 平台:
下载并本地部署 EMQX 平台
按照EMQX 平台的安装说明进行操作
使用 Claude 桌面应用程序在本地运行
选项 1:通过 Smithery 安装
通过Smithery自动为 Claude Desktop 安装 emqx-mcp-server:
npx -y @smithery/cli install @Benniu/emqx-mcp-server --client claude选项 2:Docker
如果您还没有安装Claude 桌面应用程序,请安装。
拉取镜像:
docker pull benniuji/emqx-mcp-server将以下内容添加到您的
claude_desktop_config.json文件中:在 MacOS 上:
~/Library/Application\ Support/Claude/claude_desktop_config.json在 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" ] } } }注意:更新环境变量:
EMQX_API_URL,EMQX_API_KEY,EMQX_API_SECRET打开或重新启动 Claude 桌面应用程序
尝试要求 Claude 使用 MQTT 代理执行某些操作(例如,要求它将 MQTT 消息发布到主题)。
选项 3:手动安装
首先,请确保您已安装uv可执行文件。如果没有,您可以按照此处的说明进行安装。
如果您还没有安装Claude 桌面应用程序,请安装。
克隆此存储库。
将以下内容添加到您的
claude_desktop_config.json文件中:在 MacOS 上:
~/Library/Application\ Support/Claude/claude_desktop_config.json在 Windows 上:
%APPDATA%/Claude/claude_desktop_config.jsonGXP4
注意:请确保将
path/to/repo/src/emqx_mcp_server更新为实际路径,并修改环境变量EMQX_API_URL、EMQX_API_KEY和EMQX_API_SECRET以匹配您的 EMQX 实例。打开或重新启动 Claude 桌面应用程序
尝试要求 Claude 使用 MQTT 代理执行某些操作(例如,要求它将 MQTT 消息发布到主题)。
示例提示
用户:
Please list the clients connected to the MQTT broker.法学硕士:
Here are the clients currently connected to your MQTT broker:
Connected Client:
- Client ID: mqttx_2232bdb1
- Username: test
- Protocol: MQTT v5
...
There is currently 1 client connected to your MQTT broker. Would you like more detailed information about this specific client or would you like to perform another action with your MQTT broker?用户:
Yes, please provide the detail info of this client. 法学硕士:
I'll retrieve the detailed information for this client for you.
...
Here's the detailed information for client "mqttx_2232bdb1":
**Basic Information:**
- **Client ID:** mqttx_2232bdb1
- **Username:** test
...
**Connection Details:**
- **Connected:** Yes
- **Created At:** 2025-03-02T05:29:51.103+00:00
...
Would you like to perform any actions with this client, such as publishing a message to a topic or disconnecting the client?用户:
Please write a poem and send it to the topic '/poem' with QoS 1.法学硕士:
I'll create a poem and publish it to the topic '/poem' with QoS 1. Let me do that for you.
...
I've successfully published the poem to the topic '/poem' with QoS 1. The message has been delivered with ID: 00062F55A1EFB1156ABC481240B30000.
The poem I sent was:
- Signals in the ether,
- Invisible threads that bind,
- Devices speak in whispers,
- Across the digital divide.
- Messages like leaves falling,
- From cloud to waiting ground,
- Connected yet untethered,
- Where silence makes no sound.
- Brokers of the modern age,
- Routing dreams from here to there,
- In this web of connections,
- We find ourselves everywhere.
- Like stars in constellation,
- Each point of light has worth,
- The language of machines,
- Redefining our Earth.
Is there anything else you'd like to do with your MQTT broker?用户:
Please kick out the client mqttx_2232bdb1法学硕士
I'll disconnect the client from the MQTT broker for you.
...
The client has been successfully disconnected. The system returned:
> Client mqttx_2232bdb1 has been disconnected
The MQTT client with ID "mqttx_2232bdb1" is now disconnected from your broker. Is there anything else you would like to do with your MQTT broker?执照
该项目根据 Apache 许可证版本 2.0 获得许可 - 有关详细信息,请参阅LICENSE文件。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Benniu/emqx-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
