# rabbitmq-mcp

RabbitMQ MCP server for management and AMQP operations, with OpenAPI-driven `call_id` execution and semantic search.

## Features

- MCP tools: `search_ids` / `get_id` / `call_id`
- OpenAPI-driven full HTTP management API calls
- Semantic search (optional embeddings, keyword fallback when dependencies are missing)
- Request/response validation (Pydantic first, jsonschema fallback)
- Destructive operation safety guard (disabled by default)
- AMQP: `publish/consume/ack/nack/reject`

## Requirements

- Python 3.12+
- RabbitMQ Management Plugin (Management API)

## Install & Run

### Using uvx

```bash
uvx rabbitmq-mcp \
  --host localhost \
  --port 15672 \
  --user admin \
  --password admin123 \
  --allow-destructive false
```

### From source

```bash
uv run --project . rabbitmq-mcp \
  --host localhost \
  --port 15672 \
  --user admin \
  --password admin123 \
  --allow-destructive false
```

## CLI Parameters

Required:

- `--host`
- `--port`
- `--user`
- `--password`
- `--allow-destructive` (`true|false`)

Optional (with defaults):

- `--amqp-port` (default `5672`)
- `--vhost` (default `/`)
- `--scheme` (default `http`)
- `--verify-ssl` (default inferred from `scheme`)
- `--timeout` (default `10.0`)
- `--max-connections` (default `20`)
- `--max-keepalive` (default `10`)
- `--retries` (default `1`)
- `--retry-backoff` (default `0.2`)
- `--vhost-cache-ttl` (default `60`)

## MCP Tools

- `search_ids`: Search operationId by keyword/semantics (pagination supported).
- `get_id`: Return input/output schema for the given operationId.
- `call_id`: Execute the operationId (HTTP/AMQP auto routing).

## MCP Config Example

Example JSON config for MCP clients that accept command/args (e.g., Claude Desktop):

```json
{
  "mcpServers": {
    "rabbitmq": {
      "command": "uvx",
      "args": [
        "rabbitmq-mcp",
        "--host",
        "localhost",
        "--port",
        "15672",
        "--user",
        "admin",
        "--password",
        "CHANGE_ME",
        "--allow-destructive",
        "false"
      ]
    }
  }
}
```

## Generation & Validation Scripts

```bash
# Validate OpenAPI
uv run --project . validate-openapi

# Generate Pydantic schemas
uv run --project . generate-schemas

# Generate registry
uv run --project . python scripts/generate_registry.py

# Generate embeddings (requires vector extra)
uv run --project . --extra vector python scripts/generate_embeddings.py
```