mcp2mqtt
About
An MCP service for device communication and PWM control via the MQTT protocol.
Details
- Author
- mcp2everything
- Categories
- Communication, Productivity
Jump to
Setup
Install mcp2mqtt in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/mcp2everything/mcp2mqtt
Follow the installation instructions in the repository README, then restart your MCP client.
mcp2mqtt 是一个将物联网设备接入AI大模型的项目,它通过 Model Context Protocol (MCP) 和 MQTT 协议将物理世界与 AI 大模型无缝连接。最终实现:
- 用自然语言控制你的硬件设备
- AI 实时响应并调整物理参数
- 让你的设备具备理解和执行复杂指令的能力
- 通过MQTT协议实现设备间的互联互通
- 支持MQTT协议的发布/订阅模式
- 支持多种MQTT服务器(如Mosquitto、EMQ X等)
- 支持QoS服务质量保证
- 支持主题过滤和消息路由
- 实时状态监控和错误处理
- 完整支持 Model Context Protocol
- 支持资源管理和工具调用
- 灵活的提示词系统
- 通过MQTT实现命令的发布与响应
commands: set_pwm: command: "CMD_PWM {frequency}" need_parse: false data_type: "ascii" prompts: - "把PWM调到最大" - "把PWM调到最小" mqtt_topic: "mcp/pwm" # MQTT发布主题 response_topic: "mcp/pwm/response" # MQTT响应主题
- 命令:PWM {值}
- 示例:
- PWM 100(最大值)
- PWM 0(关闭)
- PWM 50(50%)
- 命令:LED {状态}
- 示例:
- LED on(打开)
- LED off(关闭)
mcp2mqtt 支持所有实现了 MCP 协议的客户端,以及支持MQTT协议的物联网设备:
# 下载安装脚本 curl -O https://raw.githubusercontent.com/mcp2everything/mcp2mqtt/main/install_macos.py # 运行安装脚本 python3 install_macos.py
# 下载安装脚本 curl -O https://raw.githubusercontent.com/mcp2everything/mcp2mqtt/main/install_ubuntu.py # 运行安装脚本 python3 install_ubuntu.py
- 检查系统环境
- 安装必要的依赖
- 创建默认配置文件
- 配置Claude桌面版(如果已安装)
windows powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" MacOS curl -LsSf https://astral.sh/uv/install.sh | sh
主要依赖uv工具,所以当python和uv以及Claude或Cline安装好后就可以了。
在你的 MCP 客户端(如 Claude Desktop 或 Cline)配置文件中添加以下内容: 注意:如果使用的自动安装那么会自动配置Calude Desktop无需此步。 使用默认配置文件:
{ "mcpServers": { "mcp2mqtt": { "command": "uvx", "args": [ "mcp2mqtt" ] } } }
复制配置文件(config.yaml)可以放在位置: 用户主目录(推荐个人使用)
# Windows系统 C:\Users\用户名\.mcp2mqtt\config.yaml # macOS系统 /Users/用户名/.mcp2mqtt/config.yaml # Linux系统 /home/用户名/.mcp2mqtt/config.yaml
- 适用场景:个人配置
- 需要创建.mcp2mqtt目录:
# Windows系统(在命令提示符中) mkdir "%USERPROFILE%\.mcp2mqtt" # macOS/Linux系统 mkdir -p ~/.mcp2mqtt
{ "mcpServers": { "mcp2mqtt": { "command": "uvx", "args": [ "mcp2mqtt", "--config", "Pico" //指定配置文件名,不需要添加_config.yaml后缀 ] } } }
为了能使用多个mqtt,我们可以新增多个mcp2mqtt的服务 指定不同的配置文件名即可。 如果要接入多个设备,如有要连接第二个设备: 指定加载Pico2配置文件:Pico2_config.yaml
{ "mcpServers": { "mcp2mqtt2": { "command": "uvx", "args": [ "mcp2mqtt", "--config", "Pico2" //指定配置文件名,不需要添加_config.yaml后缀 ] } } }
- 将你的设备通过网络连接到mqtt服务器
- 也可以用tests目录下的responder.py来模拟设备
# 通过源码安装: git clone https://github.com/mcp2everything/mcp2mqtt.git cd mcp2mqtt # 创建虚拟环境 uv venv .venv # 激活虚拟环境 # Windows: .venv\Scripts\activate # Linux/macOS: source .venv/bin/activate # 安装开发依赖 uv pip install --editable .
在使用支持MCP协议的客户端(如Claude Desktop或Cline)时,需要在客户端的配置文件中添加以下内容: 直接自动安装的配置方式 源码开发的配置方式
{ "mcpServers": { "mcp2mqtt": { "command": "uv", "args": [ "--directory", "你的实际路径/mcp2mqtt", // 例如: "C:/Users/Administrator/Documents/develop/my-mcp-server/mcp2mqtt" "run", "mcp2mqtt" ] } } }
{ "mcpServers": { "mcp2mqtt": { "command": "uv", "args": [ "--directory", "你的实际路径/mcp2mqtt", // 例如: "C:/Users/Administrator/Documents/develop/my-mcp-server/mcp2mqtt" "run", "mcp2mqtt", "--config", // 可选参数,指定配置文件名 "Pico" // 可选参数,指定配置文件名,不需要添加_config.yaml后缀 ] } } }
# Windows系统 C:\Users\用户名\.mcp2mqtt\config.yaml # macOS系统 /Users/用户名/.mcp2mqtt/config.yaml # Linux系统 /home/用户名/.mcp2mqtt/config.yaml
- 适用场景:个人配置
- 需要创建.mcp2mqtt目录:
# Windows系统(在命令提示符中) mkdir "%USERPROFILE%\.mcp2mqtt" # macOS/Linux系统 mkdir -p ~/.mcp2mqtt
# Windows系统(需要管理员权限) C:\ProgramData\mcp2mqtt\config.yaml # macOS/Linux系统(需要root权限) /etc/mcp2mqtt/config.yaml
- 适用场景:多用户共享配置
- 创建目录并设置权限:
# Windows系统(以管理员身份运行) mkdir "C:\ProgramData\mcp2mqtt" # macOS/Linux系统(以root身份运行) sudo mkdir -p /etc/mcp2mqtt sudo chown root:root /etc/mcp2mqtt sudo chmod 755 /etc/mcp2mqtt
程序会按照上述顺序查找配置文件,使用找到的第一个有效配置文件。根据你的需求选择合适的位置:
- 开发测试:使用当前目录
- 个人使用:建议使用用户主目录(推荐)
- 多用户环境:使用系统级配置(ProgramData或/etc)
# 确保已激活虚拟环境 .venv\Scripts\activate # 运行服务器(使用默认配置config.yaml 案例中用的LOOP_BACK 模拟串口,无需真实串口和串口设备) uv run src/mcp2mqtt/server.py 或 uv run mcp2mqtt # 运行服务器(使用指定配置Pico_config.yaml) uv run src/mcp2mqtt/server.py --config Pico 或 uv run mcp2mqtt --config Pico
Manage your WhatsApp, SMS and Phone Calls using a single MCP connector
Connect to any function, any language, across network boundaries using AgentRPC.
Access your meeting transcripts, summaries, and action items from any AI assistant.
Connect Claude, ChatGPT, and other AI tools to your Granola meeting notes via MCP. Query your notes, search transcripts, and get meeting insights in your favorite AI assistants.
Build with the Kudosity API to send SMS and MMS. Access developer docs, API references and live testing tools to send messages, manage contact lists, configure webhooks and more.
Send SMS, WhatsApp, and RCS messages programmatically with DLT compliance. Manage contacts, schedule campaigns, and track delivery reports.
Interact with Twilio APIs to send messages, manage phone numbers, configure your account, and more.
The VoIPstudio MCP server gives compatible AI assistants secure access to authorised VoIPstudio account data, including recordings, call detail records, live calls and voicemails in order to query call activity, analyse patterns, identify agent performance issues and generate QA or operations reports in plain English.
A bridge server connecting Agent Communication Protocol (ACP) agents with Model Context Protocol (MCP) clients.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



