Coreflux MCP Server

by CorefluxCommunity

3 159 downloads Not rated yet Apache-2.0

About

An MCP server that connects to a Coreflux MQTT broker, providing Coreflux and MQTT actions as tools for AI assistants.

Details

License
Apache-2.0

Explore

- LOT Code Generation - Generate Language-of-Things code from natural language
- Automation Assistance - Get help with Coreflux automation tasks
- Best Practices - Receive guidance on optimal implementations
- Troubleshooting - Get assistance with debugging and optimization

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 Coreflux MCP Server
    Command (node, npx, python, etc.)

    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

- Python 3.11 or higher
- Docker (optional, for containerized deployment)
- Access to a Coreflux MQTT broker
- Coreflux Copilot API key (optional, for AI assistance)

- 🐳 Container Ready: Full Docker and Kubernetes deployment support with health checks
- πŸ”„ CI/CD Pipeline: GitHub Actions with automated testing, security scanning, and quality checks
- πŸ“¦ Development Tools: Pre-commit hooks, code formatting, linting, and documentation generation
- βš™οΈ Easy Setup: Interactive setup assistant with validation and testing
- πŸ“š Rich Documentation: API documentation, security guides, and deployment instructions

1. Clone and configure:
``bash
git clone https://github.com/CorefluxCommunity/Coreflux-MQTT-MCP-Server.git
cd Coreflux-MQTT-MCP-Server
cp .env.example .env

`

2. Deploy with Docker:
`bash
docker-compose up -d


1. Clone and configure:
bash
git clone https://github.com/CorefluxCommunity/Coreflux-MQTT-MCP-Server.git
cd Coreflux-MQTT-MCP-Server
cp .env.example .env

1. Clone and setup:
`bash
git clone https://github.com/CorefluxCommunity/Coreflux-MQTT-MCP-Server.git
cd Coreflux-MQTT-MCP-Server
`

2. Install dependencies:
`bash
pip install -r requirements.txt

The server includes a comprehensive setup assistant that guides you through configuration:

`bash
python setup_assistant.py
`

The assistant helps with:
- πŸ”§ MQTT broker connection settings
- πŸ” TLS certificate configuration
- πŸ€– Coreflux Copilot API integration
- πŸ“ Logging and monitoring setup
- βœ… Configuration validation and testing

Use the setup assistant when:
- Creating initial configuration
- Updating existing settings
- Troubleshooting connection issues
- Setting up TLS certificates
- Migrating between environments

Copy .env.example to .env and configure:


MQTT_BROKER=your-broker-host.com
MQTT_PORT=8883
MQTT_USER=your-username
MQTT_PASSWORD=your-password
MQTT_USE_TLS=true

MQTT_CA_CERT=/path/to/ca.crt
MQTT_CERT_FILE=/path/to/client.crt
MQTT_KEY_FILE=/path/to/client.key

LOG_LEVEL=INFO
LOG_FILE=/var/log/coreflux-mcp.log



For detailed configuration options, see the Configuration Guide.

For better security, use environment variables instead of hardcoding credentials:

`json
{
"mcpServers": {
"coreflux": {
"command": "python",
"args": ["/path/to/your/server.py"],
"env": {
"MQTT_BROKER": "${COREFLUX_MQTT_BROKER}",
"MQTT_PORT": "${COREFLUX_MQTT_PORT}",
"MQTT_USER": "${COREFLUX_MQTT_USER}",
"MQTT_PASSWORD": "${COREFLUX_MQTT_PASSWORD}",
"DO_AGENT_API_KEY": "${COREFLUX_API_KEY}"
}
}
}
}


1. Install development dependencies:
bash
pip install -r requirements-dev.txt
`

2. Install pre-commit hooks:
`bash
pre-commit install
`

3. Run the full development setup:
`bash
make dev-setup # Complete development environment setup

bash

git clone https://github.com/CorefluxCommunity/Coreflux-MQTT-MCP-Server.git
cd Coreflux-MQTT-MCP-Server

cp .env.example .env
nano .env # Configure your settings

See DEPLOYMENT.md for comprehensive production deployment instructions including:

- Multi-stage Docker builds
- Kubernetes deployments
- Health checks and monitoring
- Load balancing and scaling
- Security configurations

echo "DO_AGENT_API_KEY=your_api_key_here" >> .env

export DO_AGENT_API_KEY=your_api_key_here


Ask Claude to help with Coreflux automation:


Generate LOT code for a temperature monitoring system that triggers an alert when the temperature exceeds 75Β°F
`

`
Help me create a rule that processes sensor data and stores it in a database
``

Robust validation system that checks:

- Environment Variables - Validates all required configuration
- File Permissions - Ensures certificate files are accessible
- Network Connectivity - Tests MQTT broker connectivity
- API Availability - Validates Copilot API access

- GitHub Issues: Report bugs and request features
- Discussions: Community support and questions
- Documentation: Complete documentation
- Security Issues: Report to [email protected]

python setup_assistant.py # Interactive setup
make validate # Validate configuration

docker-compose up -d # Docker deployment
make docker-build # Build Docker image

get_connection_status

Get detailed connection status with troubleshooting guidance

setup_mqtt_connection

Configure a new MQTT broker connection dynamically

mqtt_connect

Connect to a specific MQTT broker with custom parameters

check_broker_health

Test broker connectivity and attempt reconnection

reconnect_mqtt

Force reconnection to the configured broker

- get_connection_status: Get detailed connection status with troubleshooting guidance
- setup_mqtt_connection: Configure a new MQTT broker connection dynamically
- mqtt_connect: Connect to a specific MQTT broker with custom parameters
- check_broker_health: Test broker connectivity and attempt reconnection
- reconnect_mqtt: Force reconnection to the configured broker

Claude Desktop / Cursor

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

{
    "mcpServers": {
        "coreflux mcp server": {
            "CorefluxMCPServer": {
                "command": "python",
                "args": [
                    "setup_assistant.py"
                ]
            }
        }
    }
}

McpServers

{
    "CorefluxMCPServer": {
        "command": "python",
        "args": [
            "setup_assistant.py"
        ]
    }
}

"Please run a comprehensive health check on the Coreflux MCP server"

``

Monitoring Metrics

The server provides detailed metrics: - Connection Status - MQTT broker connectivity - Message Processing - Queue size and processing rates - System Resources - Memory and CPU usage - Error Rates - Failed operations and error statistics - API Status - Copilot API availability and response times

Alerting

Configure alerts for: - Connection failures - High error rates - Resource exhaustion - Security events

🀝 Contributing

We welcome contributions! Please see our contribution guidelines:

Development Process

1. Fork the repository 2. Create a feature branch:
git checkout -b feature/amazing-feature 3. Install development dependencies: pip install -r requirements-dev.txt 4. Setup pre-commit hooks: pre-commit install 5. Make your changes with tests 6. Run quality checks: make quality-check 7. Commit your changes: git commit -am 'Add amazing feature' 8. Push to the branch: git push origin feature/amazing-feature 9. Create a Pull Request

Code Standards

- Python 3.11+ compatibility - Type hints for all functions - Comprehensive tests with >90% coverage - Security scanning with bandit - Code formatting with black and isort - Documentation for all public APIs

πŸ“„ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

πŸ†˜ Support & Troubleshooting

Common Issues

Connection Refused
` Error: MQTT connection failed ` - Check broker hostname and port - Verify network connectivity - Confirm TLS configuration Authentication Failed ` Error: Authentication failed ` - Verify username/password - Check API key validity - Confirm broker permissions TLS Handshake Failed ` Error: TLS handshake failed ` - Verify certificate paths - Check certificate validity - Confirm TLS version compatibility

Debug Mode

Enable detailed logging for troubleshooting:
`bash export LOG_LEVEL=DEBUG python server.py `

Getting Help

- GitHub Issues: Report bugs and request features - Discussions: Community support and questions - Documentation: Complete documentation - Security Issues: Report to [email protected]

πŸ—ΊοΈ Roadmap

Current Status: v1.0.0 βœ…

- βœ… Core MQTT functionality - βœ… Copilot API integration - βœ… Enterprise security features - βœ… Comprehensive testing - βœ… Production deployment support

Upcoming Features

- v1.1.0 - Enhanced monitoring and metrics - v1.2.0 - Additional Coreflux API endpoints - v1.3.0 - WebSocket support for real-time data - v2.0.0 - Multi-broker support and federation ---

πŸ“‹ Quick Reference

Essential Commands

``bash
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.