RabbitMQ MCP Server: Publish and Consume Messages
Publish and consume messages with the RabbitMQ MCP server to streamline reliable messaging, routing, and processing across services.
npx -y @kenliao94/mcp-server-rabbitmqOverview
The RabbitMQ MCP Server is a lightweight Model Context Protocol (MCP) server implementation that uses RabbitMQ as its transport layer. It provides a simple way to publish and consume structured model-context messages across services, leveraging AMQP for durable routing, acknowledgements, and retries. By combining the MCP semantics with RabbitMQ’s reliable messaging primitives, you can decouple producers and consumers while preserving delivery guarantees.
This server is useful when you need a dependable message bus for ML model inputs/outputs, feature updates, event streaming, or any cross-service coordination that benefits from structured context messages. It is designed for developers who want to plug RabbitMQ into an MCP-driven architecture without building the AMQP plumbing from scratch.
Features
- Publish and consume MCP-style messages over RabbitMQ (AMQP)
- Exchange/queue-based routing and topic-style routing keys
- Durable queues and persistent messages for reliable delivery
- Acknowledgement and retry-friendly consumer behavior
- Configuration via environment variables or Docker Compose
- Lightweight, easy to run locally or in containers
- Useful for model-driven pipelines, background jobs, and event routing
Installation / Configuration
You can run the server locally by cloning the repository and using Docker / Docker Compose, or by building the project and running it directly (Node.js runtime assumed). The examples below show common deployment patterns.
Clone the repo
Docker Compose example (runs RabbitMQ + MCP server)
# docker-compose.yml
version: "3.8"
services:
rabbitmq:
image: rabbitmq:3-management
ports:
- "5672:5672"
- "15672:15672"
environment:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
mcp-server:
build: .
depends_on:
- rabbitmq
environment:
RABBITMQ_URI: amqp://guest:guest@rabbitmq:5672
MCP_EXCHANGE: mcp.exchange
PORT: 3000
ports:
- "3000:3000"
Run with Docker Compose:
Environment variables (typical)
RABBITMQ_URI # AMQP URI, e.g. amqp://user:pass@host:5672
MCP_EXCHANGE # Exchange name used for MCP messages (default: mcp)
MCP_QUEUE # Default queue name for consumers (optional)
PORT # HTTP/management port if the server exposes one (optional)
LOG_LEVEL # Logging verbosity (info, debug, warn)
If you prefer to run the server directly (Node.js):
# Install dependencies and start
# or
Available Resources
- Source code and issues: https://github.com/kenliao94/mcp-server-rabbitmq
- RabbitMQ management UI (if using docker-compose): http://localhost:15672 (default guest/guest)
- AMQP libraries:
- Node: amqplib (https://github.com/squaremo/amqp.node)
- Python: pika (https://pika.readthedocs.io)
- Useful commands:
- docker logs
- rabbitmqctl list_queues (inside container)
Use Cases
Microservices event bus
- Producers publish model context events (feature updates, inference requests) to the MCP exchange with topic routing keys like “model.X.request” or “model.Y.update”. Multiple services can subscribe to only the topics they care about.
Background job / task queue
- Use durable queues with persistent messages for long-running model re-training tasks. Consumers acknowledge messages after successful processing; unacknowledged messages can be retried or moved to dead-letter queues.
Model inference pipeline
- Frontend service publishes inference requests with context (input features, metadata). A pool of worker services consumes requests, runs models, and publishes responses or follow-up events to the exchange for downstream processing.
Fan-out notifications
- Broadcast contextual updates to several downstream services by binding multiple queues to the same exchange with different routing keys.
Quick Example: Publish & Consume (Node.js)
Publisher (amqplib)
; 'amqp://guest:guest@localhost:5672', 'mcp.exchange', 'model.myModel.request', ;Consumer (amqplib)
; 'amqp://guest:guest@localhost:5672', 'mcp.exchange', 'worker.queue', 'model.#',
- docker logs