RabbitMQ MCP Server

RabbitMQ MCP server enables AI models to interact with RabbitMQ message brokers, providing capabilities for queue management, message operations, system monitoring, and broker administration through the RabbitMQ HTTP Management API.

GitHub starsnpm version

Overview

The RabbitMQ MCP Server bridges AI agents with RabbitMQ's management capabilities through natural language interactions. It exposes the RabbitMQ HTTP Management API as MCP tools, enabling programmatic queue management, message operations, and system monitoring.

Created by:

Developed by Kyle Mitchell

Management Plugin Required:

This server requires the RabbitMQ management plugin to be enabled on your broker. It uses the HTTP API, not direct AMQP connections.

Key Features

📊

Queue Monitoring

Monitor message counts, queue health metrics, and consumer status in real-time

🔄

Message Operations

Transfer messages between queues and manage deadletter operations programmatically

🚨

System Alarms

Check system alarms, vhost status, and broker health conditions

🔐

TLS/HTTPS Support

Secure connections with optional TLS certificate validation and custom CA support

Available Tools

Quick Reference

ToolPurposeCategory
get_queue_infoGet message count and queue detailsMonitoring
move_messagesTransfer messages between queuesOperations
purge_queueRemove all messages from a queueManagement
list_queuesList all queues in a vhostDiscovery
check_alarmsCheck system alarms and healthMonitoring
get_vhost_statusGet virtual host statusMonitoring

Detailed Usage

get_queue_info

Retrieve detailed information about a specific queue including message count, consumer count, and memory usage.

use_mcp_tool({
  server_name: "rabbitmq",
  tool_name: "get_queue_info",
  arguments: {
    queue_name: "orders",
    vhost: "/"
  }
});

Returns message counts (ready, unacknowledged, total), consumer information, and queue state.

move_messages

Transfer a specified number of messages from one queue to another within the same vhost.

use_mcp_tool({
  server_name: "rabbitmq",
  tool_name: "move_messages",
  arguments: {
    source_queue: "orders",
    destination_queue: "orders-priority",
    message_count: 500,
    vhost: "/"
  }
});

Useful for load balancing, queue reorganization, and deadletter recovery.

purge_queue

Remove all messages from a queue. This operation is irreversible.

use_mcp_tool({
  server_name: "rabbitmq",
  tool_name: "purge_queue",
  arguments: {
    queue_name: "test-queue",
    vhost: "/"
  }
});

Destructive Operation:

This permanently deletes all messages in the queue. Use with caution in production environments.

list_queues

List all queues in a virtual host with summary statistics.

use_mcp_tool({
  server_name: "rabbitmq",
  tool_name: "list_queues",
  arguments: {
    vhost: "/"
  }
});

Returns queue names, message counts, and consumer information.

check_alarms

Check for triggered system alarms such as memory or disk space warnings.

use_mcp_tool({
  server_name: "rabbitmq",
  tool_name: "check_alarms",
  arguments: {}
});

Returns active alarms for monitoring broker health and preventing service degradation.

get_vhost_status

Get the operational status of a virtual host.

use_mcp_tool({
  server_name: "rabbitmq",
  tool_name: "get_vhost_status",
  arguments: {
    vhost: "/"
  }
});

Useful for verifying vhost availability and configuration.

Installation

Prerequisites

  • RabbitMQ with management plugin enabled
  • Node.js installed (for npx)

Configuration

Edit your MCP client configuration file:

Basic HTTP Configuration:

{
  "mcpServers": {
    "rabbitmq": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "rabbitmq-mcp"],
      "env": {
        "RABBITMQ_HOST": "localhost",
        "RABBITMQ_USERNAME": "guest",
        "RABBITMQ_PASSWORD": "guest",
        "RABBITMQ_MANAGEMENT_PORT": "15672",
        "RABBITMQ_PROTOCOL": "http"
      }
    }
  }
}

HTTPS Configuration with TLS:

{
  "mcpServers": {
    "rabbitmq": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "rabbitmq-mcp"],
      "env": {
        "RABBITMQ_HOST": "rabbitmq.example.com",
        "RABBITMQ_USERNAME": "admin",
        "RABBITMQ_PASSWORD": "your-password",
        "RABBITMQ_MANAGEMENT_PORT": "15671",
        "RABBITMQ_PROTOCOL": "https",
        "RABBITMQ_CA_PATH": "/path/to/ca-certificate.crt"
      }
    }
  }
}

Configuration Reference

Required Environment Variables

VariableDescriptionExample
RABBITMQ_HOSTRabbitMQ server hostnamelocalhost, rabbitmq.example.com
RABBITMQ_USERNAMEAuthentication usernameadmin, guest
RABBITMQ_PASSWORDAuthentication passwordyour-password
RABBITMQ_MANAGEMENT_PORTManagement API port15672 (HTTP), 15671 (HTTPS)
RABBITMQ_PROTOCOLConnection protocolhttp, https

Optional TLS/HTTPS Variables

Configure TLS for secure connections (inline or file-based):

Inline PEM Strings:

VariableDescription
RABBITMQ_CACA certificate (PEM string)
RABBITMQ_CERTClient certificate (PEM string)
RABBITMQ_KEYClient private key (PEM string)

File Paths:

VariableDescription
RABBITMQ_CA_PATHPath to CA certificate file
RABBITMQ_CERT_PATHPath to client certificate file
RABBITMQ_KEY_PATHPath to client private key file

Additional Options:

VariableDescriptionDefault
RABBITMQ_REJECT_UNAUTHORIZEDValidate TLS certificatestrue

Development Only:

Set RABBITMQ_REJECT_UNAUTHORIZED to false only for debugging with self-signed certificates. Never use in production.

Enable RabbitMQ Management Plugin

The management plugin must be enabled on your RabbitMQ broker:

# Enable the management plugin
rabbitmq-plugins enable rabbitmq_management

# Verify it's running
curl -u guest:guest http://localhost:15672/api/overview

Common Use Cases

Conditional Queue Operations

Handle queue thresholds automatically:

"Get the message count in the orders queue. If it exceeds 10,000 messages,
move half of them to the orders-overflow queue"

Production Monitoring

Check system health before deployments:

"Check for any triggered alarms in the production RabbitMQ cluster"

Queue Maintenance

Reorganize queues during maintenance windows:

"List all queues in the / vhost and show me which ones have more than
1,000 unacknowledged messages"

Deadletter Recovery

Recover messages from deadletter queues:

"Move 100 messages from the orders.dlq deadletter queue back to the
orders queue for reprocessing"

Best Practices

Security

  • Use HTTPS in production with RABBITMQ_PROTOCOL="https"
  • Never commit credentials to version control
  • Use environment variables or secure secret management
  • Create dedicated RabbitMQ users with minimal required permissions
  • Enable TLS certificate validation (RABBITMQ_REJECT_UNAUTHORIZED="true")

Monitoring

  • Check alarms regularly with check_alarms
  • Monitor queue depths to prevent memory issues
  • Track unacknowledged message counts
  • Set up alerting for abnormal queue growth

Queue Management

  • Use descriptive queue names with environment prefixes
  • Implement deadletter queues for failed messages
  • Test purge_queue operations in non-production first
  • Document queue purposes and message schemas

Performance

  • Move messages in batches to avoid API rate limits
  • Monitor management API response times
  • Consider using AMQP directly for high-throughput publishing
  • Use the HTTP API (MCP) for monitoring and management operations

Troubleshooting

Connection Refused

If you can't connect to RabbitMQ:

  1. Verify the management plugin is enabled: rabbitmq-plugins list
  2. Check the management port: default is 15672 (HTTP) or 15671 (HTTPS)
  3. Test connectivity: curl http://localhost:15672/api/overview
  4. Verify firewall rules allow access to the management port

Authentication Failed

If authentication fails:

  1. Verify credentials with curl: curl -u username:password http://localhost:15672/api/overview
  2. Check user permissions in RabbitMQ management UI
  3. Ensure the user has the monitoring tag for read operations
  4. Ensure the user has the administrator tag for write operations

TLS Certificate Errors

If you encounter TLS certificate errors:

  1. Verify certificate paths are absolute, not relative
  2. Check certificate validity: openssl x509 -in cert.crt -text -noout
  3. Ensure CA certificate matches the server certificate chain
  4. For self-signed certificates in development, set RABBITMQ_REJECT_UNAUTHORIZED="false"

Command Not Found

If npx or rabbitmq-mcp command is not found:

  1. Verify Node.js is installed: node --version
  2. Try absolute paths in configuration:
    {
      "command": "/usr/local/bin/node",
      "args": ["/usr/local/bin/rabbitmq-mcp"]
    }
    
  3. For Claude Desktop on macOS, use full paths: /usr/local/bin/npx

Sources