diff --git a/README.md b/README.md index 33183ba..53e45ca 100644 --- a/README.md +++ b/README.md @@ -140,37 +140,146 @@ mcmqtt/ - **Robust mocking** for reliable CI/CD - **Edge case coverage** for production reliability -## 🌟 Use Cases +## 🌟 Real-World Use Cases -### 🤖 AI Agent Coordination +### 🤖 AI Agent Orchestration & Swarm Coordination -Perfect for coordinating Claude Code subagents via MQTT: +**Fractal Agent Architecture**: Build sophisticated agent swarms where parent agents delegate tasks to specialized subagents via MQTT messaging. ```bash -# Parent agent publishes tasks -mcmqtt-publish --topic "agents/tasks" --payload '{"task": "analyze_data", "agent_id": "worker-1"}' +# 1. Setup mcmqtt as MCP server for agent coordination +claude mcp add task-buzz -- uvx mcmqtt -# Worker agents subscribe and respond -mcmqtt-subscribe --topic "agents/tasks" --callback process_task +# 2. Now parent Claude Code agents can coordinate with subagents ``` -### 📊 IoT Data Collection +**Example: Multi-Agent Code Analysis Workflow** ```bash -# Collect sensor data -mcmqtt-subscribe --topic "sensors/+/temperature" --format json +# Parent Agent (you) delegates analysis tasks via MQTT: -# Forward to analytics -mcmqtt-publish --topic "analytics/temperature" --payload "$sensor_data" +# 1. Spawn embedded broker for coordination +mqtt_spawn_broker --name "code-analysis" --port 1883 + +# 2. Create specialized subagents for different domains +claude -p "You are a security-analysis-agent. Subscribe to 'tasks/security' topic and analyze code for vulnerabilities. Use mqtt_subscribe and mqtt_publish tools." + +claude -p "You are a performance-agent. Subscribe to 'tasks/performance' and optimize code. Report results to 'results/performance'." + +claude -p "You are a test-agent. Subscribe to 'tasks/testing' and write comprehensive tests. Publish coverage to 'results/testing'." + +# 3. Parent agent coordinates the workflow +mqtt_publish --topic "tasks/security" --payload '{"file": "auth.py", "priority": "high"}' +mqtt_publish --topic "tasks/performance" --payload '{"file": "database.py", "focus": "query_optimization"}' +mqtt_publish --topic "tasks/testing" --payload '{"file": "api.py", "coverage_target": "95%"}' + +# 4. Monitor results from all agents +mqtt_subscribe --topic "results/+" --callback aggregate_analysis_report ``` -### 🔄 Microservice Communication +**Advanced Fractal Patterns:** +- **Recursive Task Delegation**: Subagents can spawn their own sub-subagents for complex domains +- **Dynamic Load Balancing**: Monitor agent workload via heartbeat topics, redistribute tasks automatically +- **Cross-Agent Learning**: Agents share insights via `knowledge/domain` topics +- **Fault Tolerance**: Dead agent detection via missed heartbeats, automatic task redistribution + +**Use Cases:** +- **Large Codebase Analysis**: Break down monolith analysis across specialized agents (security, performance, testing, documentation) +- **Multi-Language Projects**: Deploy language-specific agents (Python-agent, JavaScript-agent, Rust-agent) +- **Distributed Code Review**: Parallel analysis of pull requests with different focuses +- **CI/CD Integration**: Agents monitor git hooks, trigger builds, run tests, deploy services + +### 📊 Real-Time IoT & Sensor Data Processing + +**Zero-Config IoT Integration**: Perfect for collecting, processing, and routing sensor data without complex infrastructure. ```bash -# Service mesh communication -mcmqtt --mqtt-host service-mesh.local --client-id user-service +# Example: Temperature monitoring system +# 1. Start mcmqtt server +uvx mcmqtt + +# 2. Use MCP tools to: +# - Subscribe to sensors/+/temperature +# - Publish alerts to alerts/high-temp +# - Forward to analytics/warehouse ``` +**Use Cases:** +- **Smart building automation**: Collect data from thermostats, motion sensors, lighting systems +- **Industrial monitoring**: Equipment health, production metrics, safety alerts +- **Environmental tracking**: Weather stations, air quality monitors, noise levels +- **Agricultural IoT**: Soil moisture, crop monitoring, automated irrigation + +### 🔄 Microservice Event Streaming + +**Service Mesh Communication**: Replace complex message queues with simple MQTT patterns for microservice coordination. + +```bash +# Start dedicated MQTT server for service mesh +uvx mcmqtt --transport http --port 8080 + +# Services communicate via MQTT topics: +# - orders/created, orders/fulfilled +# - payments/processed, payments/failed +# - inventory/updated, inventory/low-stock +``` + +**Use Cases:** +- **Event sourcing**: Capture all state changes as MQTT events for audit trails +- **Saga patterns**: Coordinate complex business transactions across multiple services +- **Cache invalidation**: Notify services when shared data changes +- **Health monitoring**: Services publish heartbeats and status updates + +### 🎮 Real-Time Gaming & Live Applications + +**Low-Latency Messaging**: Build multiplayer games, live chat, and real-time collaboration tools. + +```bash +# Game server coordination +claude mcp add game-events -- uvx mcmqtt --transport http +``` + +**Use Cases:** +- **Multiplayer game state**: Player positions, actions, world updates +- **Live chat systems**: Message broadcasting, user presence, typing indicators +- **Collaborative editing**: Document changes, cursor positions, user selections +- **Live streaming**: Chat messages, viewer counts, donations, moderation events + +### 🏭 DevOps & Infrastructure Automation + +**Deployment Orchestration**: Coordinate deployments, monitoring, and incident response across infrastructure. + +```bash +# Infrastructure coordination +uvx mcmqtt --mqtt-host production-mqtt.company.com +``` + +**Use Cases:** +- **CI/CD pipelines**: Build status, deployment triggers, rollback coordination +- **Container orchestration**: Service discovery, load balancer updates, scaling events +- **Monitoring alerts**: Error spikes, performance degradation, security incidents +- **Backup coordination**: Database snapshots, file synchronization, disaster recovery + +### 🛍️ E-commerce & Business Process Automation + +**Order Processing Workflows**: Handle complex business processes with event-driven patterns. + +**Use Cases:** +- **Order fulfillment**: Inventory checks → payment processing → shipping → delivery notifications +- **Customer journey**: Cart abandonment → email campaigns → purchase → support follow-up +- **Supply chain**: Supplier updates → inventory management → demand forecasting +- **Fraud detection**: Transaction monitoring → risk scoring → manual review triggers + +### 📱 Mobile & Edge Computing + +**Offline-First Applications**: Handle intermittent connectivity and edge computing scenarios. + +**Use Cases:** +- **Mobile app synchronization**: User data, settings, offline queue processing +- **Edge device coordination**: Factory floor devices, retail kiosks, field equipment +- **Bandwidth optimization**: Intelligent data batching, compression, prioritization +- **Mesh networking**: Device-to-device communication, local data processing + ## ⚙️ Configuration ### Environment Variables