Coreflux MCP Server

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • Includes configuration paths and instructions for integration with Claude Desktop on Linux systems.

  • Provides specific configuration paths and instructions for integration with Claude Desktop on macOS systems.

  • Connects to a Coreflux MQTT broker, allowing control of Coreflux resources including models, actions, rules, and routes. Provides capabilities to discover and list available actions, and execute Coreflux commands through the broker.

Coreflux MQTT MCP 服务器

这是一个模型上下文协议 (MCP) 服务器,它连接到 Coreflux MQTT 代理,并使 Coreflux 和 MQTT 操作可作为 Claude 和其他 MCP 兼容 AI 助手的工具。

特征

  • 连接到 Coreflux MQTT 代理
  • 为所有 Coreflux 命令(模型、操作、规则、路线)提供工具
  • 发现并列出可用的操作
  • 包含 LOT 语言文档作为资源
  • 采用官方 MCP SDK 构建,可实现 Claude 无缝集成
  • 用于配置的独立设置助手

设置助手

该服务器包含一个独立的安装助手,可以独立于主服务器运行。在以下情况下运行安装助手:

  • 您需要创建一个初始配置(.env 文件)
  • 您想要更新现有配置
  • 您遇到连接问题,需要重新配置

要运行安装助手:

python setup_assistant.py

设置助手可以帮助您:

  • 使用您的配置创建或更新.env文件
  • 配置 MQTT 代理设置(主机、端口、凭据)
  • 如果需要,设置 TLS 配置
  • 配置日志记录选项

配置完成后即可正常运行服务器。

将 Claude 连接到 MCP 服务器

使用 Claude 桌面配置

  1. 创建或编辑~/Library/Application Support/Claude/claude_desktop_config.json (macOS/Linux) 或%USERPROFILE%\AppData\Roaming\Claude\claude_desktop_config.json (Windows)
  2. 添加以下配置(相应地调整路径):
    { "mcpServers": { "coreflux": { "command": "python", "args": [ "/PATH/TO/server.py", "--mqtt-host", "localhost", "--mqtt-port", "1883", "--mqtt-user", "root", "--mqtt-password", "coreflux", "--mqtt-client-id", "claude-coreflux-client" ], "description": "Coreflux MQTT Broker Control", "icon": "🔄", "env": {} } } }
  3. 重启Claude桌面

命令行参数

该服务器接受以下命令行参数。您也可以使用设置助手通过.env文件配置这些设置:

争论描述默认
--mqtt-hostMQTT 代理地址本地主机
--mqtt-portMQTT 代理端口1883
--mqtt-userMQTT 用户名-
--mqtt-passwordMQTT 密码-
--mqtt-client-idMQTT 客户端 ID克劳德-mcp-客户端
--mqtt-use-tls为 MQTT 连接启用 TLS错误的
--mqtt-ca-certCA证书文件的路径-
--mqtt-client-cert客户端证书文件的路径-
--mqtt-client-key客户端密钥文件路径-
--log-level日志级别(DEBUG/INFO/WARNING/ERROR/CRITICAL)信息

可用工具

服务器提供了常用 Coreflux 命令的工具:

  • add_rule :添加新的权限规则
  • remove_rule :删除权限规则
  • add_route :添加新的路由连接
  • remove_route :删除路由连接
  • add_model :添加新的模型结构
  • remove_model :删除模型结构
  • add_action :添加新的动作事件/功能
  • remove_action :删除动作事件/功能
  • run_action :运行动作事件/函数
  • remove_all_models :删除所有模型
  • remove_all_actions :删除所有操作
  • remove_all_routes :删除所有路线
  • list_discovered_actions :列出所有发现的 Coreflux 操作
  • request_lot_code :根据自然语言提示生成 LOT 代码

调试和故障排除

如果您遇到问题:

  1. 在 Claude 配置中验证您的 MQTT 代理凭据
  2. 确保代理可以访问
  3. 运行安装助手来验证或更新您的配置:
    python setup_assistant.py
  4. 检查 Claude Desktop 日志:
    # Check Claude's logs for errors (macOS/Linux) tail -n 20 -f ~/Library/Logs/Claude/mcp*.log # Windows PowerShell Get-Content -Path "$env:USERPROFILE\AppData\Roaming\Claude\Logs\mcp*.log" -Tail 20 -Wait
  5. 使用调试日志运行服务器:
    # Direct execution with debug logging python server.py --mqtt-host localhost --mqtt-port 1883 --log-level DEBUG

参考

-
security - not tested
A
license - permissive license
-
quality - not tested

将 Claude 和其他与 MCP 兼容的 AI 助手连接到 Coreflux MQTT 代理,使他们能够通过自然语言发现和执行用于管理模型、动作、规则和路线的 Coreflux 命令。

  1. Features
    1. Setup Assistant
      1. Connecting Claude to the MCP Server
        1. Using Claude Desktop Config
        2. Command-Line Arguments
      2. Available Tools
        1. Debugging and Troubleshooting
          1. References
            ID: x3v4154cuw