Skip to main content
Glama
ivanmartinezmorales

RabbitMQ MCP Server

BindingManagement.ts2.29 kB
import { MCPTool, MCPInput } from "mcp-framework"; import { z } from "zod"; import RabbitMQConnection from "./RabbitMQConnection.js"; const BindingSchema = z.object({ action: z .enum(["bind", "unbind"]) .describe("Action to perform: bind or unbind"), queue_name: z.string().describe("Name of the queue to bind/unbind"), exchange_name: z .string() .describe("Name of the exchange to bind/unbind to/from"), routing_key: z .string() .optional() .describe("Routing key for the binding (default: empty string)"), arguments: z .record(z.any()) .optional() .describe("Additional arguments for the binding"), }); class BindingManagement extends MCPTool { name = "binding_management"; description = "Manage RabbitMQ bindings between queues and exchanges"; schema = BindingSchema; async execute(input: MCPInput<this>) { const channel = RabbitMQConnection.getChannel(); if (!channel) { return "Error: No active RabbitMQ connection. Please connect first."; } try { const routingKey = input.routing_key ?? ""; const args = input.arguments ?? {}; switch (input.action) { case "bind": await channel.bindQueue( input.queue_name, input.exchange_name, routingKey, args ); return { message: `Queue '${input.queue_name}' bound to exchange '${input.exchange_name}'`, queue: input.queue_name, exchange: input.exchange_name, routing_key: routingKey, arguments: args, }; case "unbind": await channel.unbindQueue( input.queue_name, input.exchange_name, routingKey, args ); return { message: `Queue '${input.queue_name}' unbound from exchange '${input.exchange_name}'`, queue: input.queue_name, exchange: input.exchange_name, routing_key: routingKey, }; default: return "Invalid action. Use 'bind' or 'unbind'"; } } catch (error) { return `Error: ${ error instanceof Error ? error.message : "Unknown error" }`; } } } export default BindingManagement;

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ivanmartinezmorales/rabbitmq-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server