{"_id":"@brightlightrx/mqtt-mcp","_rev":"2-b321b91b2c8fb7ba45801c4f62cb504c","name":"@brightlightrx/mqtt-mcp","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@brightlightrx/mqtt-mcp","version":"1.0.0","keywords":["mcp","mqtt","model-context-protocol"],"author":"","license":"MIT","_id":"@brightlightrx/mqtt-mcp@1.0.0","maintainers":[{"name":"brightlightrx","email":"markus@brightlight.rocks"}],"bin":{"mqtt-mcp":"dist/index.js"},"dist":{"shasum":"63025ea474d01432c29b4975d0133d2f15099229","tarball":"https://registry.npmjs.org/@brightlightrx/mqtt-mcp/-/mqtt-mcp-1.0.0.tgz","fileCount":10,"integrity":"sha512-deV6a+S6flM4JhU/stqrulZdKaPlCQQYgGJViZrpf8+H9rbcmYG3gtgLXPrbU5fdXUkQkgOxYZeNHI8XerwVig==","signatures":[{"sig":"MEUCIQDLkejfUfwivrER5OtACW1ozvpQu1DDttx9CFtsePsVaQIgV6ncFigXDJEqI8dWbSFCY6nbqPP2ViFy8r959ltscqk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33322},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","scripts":{"dev":"tsx src/index.ts","lint":"eslint src --ext .ts","test":"jest","build":"tsc","start":"node dist/index.js","typecheck":"tsc --noEmit"},"_npmUser":{"name":"brightlightrx","email":"markus@brightlight.rocks"},"_npmVersion":"11.4.2","description":"MCP server for sending MQTT messages","directories":{},"_nodeVersion":"22.17.0","dependencies":{"zod":"^3.23.8","mqtt":"^5.10.1","@modelcontextprotocol/sdk":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.7.0","jest":"^29.7.0","eslint":"^8.57.0","ts-jest":"^29.1.0","typescript":"^5.3.0","@types/node":"^20.0.0","@typescript-eslint/parser":"^7.0.0","@typescript-eslint/eslint-plugin":"^7.0.0"},"_npmOperationalInternal":{"tmp":"tmp/mqtt-mcp_1.0.0_1752491375400_0.6526571790988462","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@brightlightrx/mqtt-mcp","version":"1.0.1","description":"MCP server for sending MQTT messages","main":"dist/index.js","type":"module","bin":{"mqtt-mcp":"dist/index.js"},"scripts":{"build":"tsc","dev":"tsx src/index.ts","start":"node dist/index.js","test":"jest","lint":"eslint src --ext .ts","typecheck":"tsc --noEmit"},"keywords":["mcp","mqtt","model-context-protocol"],"author":"","license":"MIT","dependencies":{"@modelcontextprotocol/sdk":"^1.0.0","mqtt":"^5.10.1","zod":"^3.23.8"},"devDependencies":{"@types/node":"^20.0.0","@typescript-eslint/eslint-plugin":"^7.0.0","@typescript-eslint/parser":"^7.0.0","eslint":"^8.57.0","jest":"^29.7.0","ts-jest":"^29.1.0","tsx":"^4.7.0","typescript":"^5.3.0"},"_id":"@brightlightrx/mqtt-mcp@1.0.1","types":"./dist/index.d.ts","_nodeVersion":"22.17.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-PvwnVXzK6TvBVZN4yF9tvHlEa8RKDToWKbLw3BATic2O2euivrjiMBElHltNzwgSkOPq0Lcpqo2YLmKJb8050A==","shasum":"7cd25e367191e25503061dbf0494d753077ea538","tarball":"https://registry.npmjs.org/@brightlightrx/mqtt-mcp/-/mqtt-mcp-1.0.1.tgz","fileCount":10,"unpackedSize":31918,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIBnG5whEC8nkFlYFCxe5GQosO0DQwk50Vjrt3n+qu6VBAiAZ2MFJ7zDeKGWrCHye/F89HgCiq/MiaP0hVoIuH154Vg=="}]},"_npmUser":{"name":"brightlightrx","email":"markus@brightlight.rocks"},"directories":{},"maintainers":[{"name":"brightlightrx","email":"markus@brightlight.rocks"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mqtt-mcp_1.0.1_1752493232082_0.7937277113331553"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-14T11:09:35.300Z","modified":"2025-07-14T11:40:32.440Z","1.0.0":"2025-07-14T11:09:35.563Z","1.0.1":"2025-07-14T11:40:32.247Z"},"license":"MIT","keywords":["mcp","mqtt","model-context-protocol"],"description":"MCP server for sending MQTT messages","maintainers":[{"name":"brightlightrx","email":"markus@brightlight.rocks"}],"readme":"# MQTT MCP Server\n\n[![npm version](https://badge.fury.io/js/@brightlightrx%2Fmqtt-mcp.svg)](https://badge.fury.io/js/@brightlightrx%2Fmqtt-mcp)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nA Model Context Protocol (MCP) server that enables sending MQTT messages to configured brokers. Perfect for integrating MQTT messaging capabilities into Claude Code and other MCP-compatible applications.\n\n## Features\n\n- 🚀 **Easy Installation**: Install directly via npm/npx\n- 🔗 **Multiple Brokers**: Connect to multiple MQTT brokers simultaneously\n- 📊 **Flexible Messaging**: Support for JSON and string message formats\n- ⚙️ **Configurable QoS**: Quality of Service levels 0, 1, and 2\n- 🔒 **Secure**: Environment variable configuration for credentials\n- 🛠️ **Runtime Management**: Add/remove brokers dynamically\n\n## Quick Start\n\n### For Claude Code Users\n\n```bash\nclaude mcp add mqtt -s user -- npx -y @brightlightrx/mqtt-mcp\n```\n\n### For Claude Desktop Users\n\nAdd to your MCP settings file:\n\n```json\n{\n  \"mcpServers\": {\n    \"mqtt\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@brightlightrx/mqtt-mcp\"],\n      \"env\": {\n        \"MQTT_BROKER_URL\": \"mqtt://localhost:1883\",\n        \"MQTT_USERNAME\": \"your_username\",\n        \"MQTT_PASSWORD\": \"your_password\"\n      }\n    }\n  }\n}\n```\n\n## Configuration\n\n### Environment Variables\n\nConfigure brokers using environment variables:\n\n```bash\n# Default broker\nMQTT_BROKER_URL=mqtt://localhost:1883\nMQTT_USERNAME=myuser\nMQTT_PASSWORD=mypass\nMQTT_CLIENT_ID=mqtt-mcp-client\n\n# Additional brokers (up to 10)\nMQTT_BROKER_1_ID=production\nMQTT_BROKER_1_URL=mqtts://prod.example.com:8883\nMQTT_BROKER_1_USERNAME=produser\nMQTT_BROKER_1_PASSWORD=prodpass\n\nMQTT_BROKER_2_ID=staging\nMQTT_BROKER_2_URL=mqtt://staging.example.com:1883\n```\n\n### MCP Client Configuration\n\n#### Configuration File Locations\n\n**Claude Code:**\n- **macOS**: `~/Library/Application Support/Claude Code/claude_code_mcp_settings.json`\n- **Windows**: `%APPDATA%/Claude Code/claude_code_mcp_settings.json`\n- **Linux**: `~/.config/claude-code/claude_code_mcp_settings.json`\n\n**Claude Desktop:**\n- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`\n- **Windows**: `%APPDATA%/Claude/claude_desktop_config.json`\n\n#### Example with Multiple Brokers\n\n```json\n{\n  \"mcpServers\": {\n    \"mqtt\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@brightlightrx/mqtt-mcp\"],\n      \"env\": {\n        \"MQTT_BROKER_URL\": \"mqtt://localhost:1883\",\n        \"MQTT_USERNAME\": \"local_user\",\n        \"MQTT_PASSWORD\": \"local_pass\",\n        \"MQTT_BROKER_1_ID\": \"production\",\n        \"MQTT_BROKER_1_URL\": \"mqtts://prod.example.com:8883\",\n        \"MQTT_BROKER_1_USERNAME\": \"prod_user\",\n        \"MQTT_BROKER_1_PASSWORD\": \"prod_pass\"\n      }\n    }\n  }\n}\n```\n\n## Installation with Environment Variables\n\nYou can set environment variables during installation:\n\n```bash\nMQTT_BROKER_URL=mqtt://localhost:1883 MQTT_USERNAME=user MQTT_PASSWORD=pass claude mcp add mqtt -s user -- npx -y @brightlightrx/mqtt-mcp\n```\n\n## Testing the Installation\n\nAfter installation, test it in Claude Code:\n\n```\nPlease list all available MQTT brokers.\n```\n\n## Available Tools\n\n### mqtt_publish\n\nPublish a message to an MQTT topic.\n\n**Parameters:**\n- `broker_id` (string): ID of the MQTT broker to use\n- `topic` (string): MQTT topic to publish to\n- `message` (string|object): Message to publish (string or JSON object)\n- `qos` (number, optional): Quality of Service level (0, 1, or 2) - default: 0\n- `retain` (boolean, optional): Whether to retain the message on the broker - default: false\n\n**Example:**\n```json\n{\n  \"broker_id\": \"default\",\n  \"topic\": \"sensors/temperature\",\n  \"message\": {\"value\": 23.5, \"unit\": \"celsius\", \"timestamp\": \"2025-01-13T10:30:00Z\"},\n  \"qos\": 1,\n  \"retain\": true\n}\n```\n\n### mqtt_add_broker\n\nAdd a new MQTT broker configuration at runtime.\n\n**Parameters:**\n- `id` (string): Unique identifier for the broker\n- `url` (string): MQTT broker URL (e.g., mqtt://localhost:1883)\n- `username` (string, optional): Username for authentication\n- `password` (string, optional): Password for authentication\n- `client_id` (string, optional): MQTT client ID\n\n**Example:**\n```json\n{\n  \"id\": \"test-broker\",\n  \"url\": \"mqtt://test.example.com:1883\",\n  \"username\": \"testuser\",\n  \"password\": \"testpass\",\n  \"client_id\": \"mcp-test-client\"\n}\n```\n\n### mqtt_list_brokers\n\nList all configured MQTT brokers and their connection status.\n\n**Parameters:** None\n\n**Returns:** JSON array with broker IDs and connection status.\n\n## Usage Examples\n\n### Using with Claude Code\n\nOnce configured, you can use natural language in Claude Code to send MQTT messages:\n\n**Example conversations:**\n```\nYou: \"Send a test message to the topic 'sensors/test' using the default broker\"\n\nClaude Code will use: mqtt_publish with broker_id=\"default\", topic=\"sensors/test\", message=\"test message\"\n```\n\n```\nYou: \"Publish temperature data: 23.5°C and humidity 65% to the IoT topic on the production broker\"\n\nClaude Code will use: mqtt_publish with structured JSON data\n```\n\n```\nYou: \"Add a new MQTT broker for my local testing with URL mqtt://192.168.1.100:1883\"\n\nClaude Code will use: mqtt_add_broker to configure the new connection\n```\n\n```\nYou: \"Configure an MQTT broker with the data in .env and send 'I'm Here' to topic 'test'\"\n\nClaude Code will:\n1. Read .env file to get broker configuration\n2. Add broker using mqtt_add_broker with credentials from .env  \n3. Publish \"I'm Here\" message to \"test\" topic using mqtt_publish\n```\n\n### Direct Tool Usage Examples\n\n### Basic Message Publishing\n\n```json\n// Publish a simple string message\n{\n  \"broker_id\": \"default\",\n  \"topic\": \"test/message\", \n  \"message\": \"Hello MQTT!\"\n}\n\n// Publish JSON data\n{\n  \"broker_id\": \"default\",\n  \"topic\": \"devices/sensor1\",\n  \"message\": {\n    \"temperature\": 25.3,\n    \"humidity\": 60.2,\n    \"timestamp\": \"2025-01-13T10:30:00Z\"\n  }\n}\n```\n\n### High QoS Publishing\n\n```json\n{\n  \"broker_id\": \"production\",\n  \"topic\": \"critical/alerts\",\n  \"message\": {\"alert\": \"Temperature threshold exceeded\", \"level\": \"warning\"},\n  \"qos\": 2,\n  \"retain\": true\n}\n```\n\n### Runtime Broker Configuration\n\n```json\n// Add a new broker\n{\n  \"id\": \"iot-platform\",\n  \"url\": \"mqtts://iot.example.com:8883\",\n  \"username\": \"device123\",\n  \"password\": \"secret\"\n}\n\n// Use the new broker\n{\n  \"broker_id\": \"iot-platform\",\n  \"topic\": \"devices/status\",\n  \"message\": {\"status\": \"online\", \"battery\": 85}\n}\n```\n\n## Development\n\nFor local development and contributions:\n\n```bash\n# Clone the repository\ngit clone https://github.com/brightlightrx/mqtt-mcp.git\ncd mqtt-mcp\n\n# Install dependencies\nnpm install\n\n# Run in development mode\nnpm run dev\n\n# Build for production\nnpm run build\n\n# Run tests\nnpm test\n\n# Type check\nnpm run typecheck\n\n# Lint code\nnpm run lint\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Protocol Support\n\n- MQTT 3.1.1 and 5.0\n- TCP, TLS, and WebSocket transports\n- QoS levels 0, 1, and 2\n- Message retention\n- Authentication (username/password)\n\n## Error Handling\n\nThe server provides detailed error messages for:\n- Connection failures\n- Authentication errors\n- Publishing failures\n- Invalid broker configurations\n- Network timeouts\n\n## Security Notes\n\n- Store sensitive credentials in environment variables\n- Use TLS/SSL for production brokers (mqtts://)\n- Implement proper access controls on your MQTT brokers\n- Consider using client certificates for enhanced security","readmeFilename":"README.md"}