queue-pilot 0.2.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +209 -31
  3. package/dist/broker/factory.d.ts +25 -0
  4. package/dist/broker/factory.js +35 -0
  5. package/dist/broker/factory.js.map +1 -0
  6. package/dist/broker/registry.d.ts +8 -0
  7. package/dist/broker/registry.js +95 -0
  8. package/dist/broker/registry.js.map +1 -0
  9. package/dist/broker/tool-definition.d.ts +7 -0
  10. package/dist/broker/tool-definition.js +2 -0
  11. package/dist/broker/tool-definition.js.map +1 -0
  12. package/dist/broker/types.d.ts +71 -0
  13. package/dist/broker/types.js +10 -0
  14. package/dist/broker/types.js.map +1 -0
  15. package/dist/brokers/kafka/adapter.d.ts +18 -0
  16. package/dist/brokers/kafka/adapter.js +83 -0
  17. package/dist/brokers/kafka/adapter.js.map +1 -0
  18. package/dist/brokers/kafka/tools.d.ts +3 -0
  19. package/dist/brokers/kafka/tools.js +51 -0
  20. package/dist/brokers/kafka/tools.js.map +1 -0
  21. package/dist/brokers/rabbitmq/adapter.d.ts +19 -0
  22. package/dist/brokers/rabbitmq/adapter.js +114 -0
  23. package/dist/brokers/rabbitmq/adapter.js.map +1 -0
  24. package/dist/brokers/rabbitmq/tools.d.ts +3 -0
  25. package/dist/brokers/rabbitmq/tools.js +124 -0
  26. package/dist/brokers/rabbitmq/tools.js.map +1 -0
  27. package/dist/index.d.ts +8 -1
  28. package/dist/index.js +208 -30
  29. package/dist/index.js.map +1 -1
  30. package/dist/init.d.ts +24 -0
  31. package/dist/init.js +269 -0
  32. package/dist/init.js.map +1 -0
  33. package/dist/kafka/client.d.ts +63 -0
  34. package/dist/kafka/client.js +256 -0
  35. package/dist/kafka/client.js.map +1 -0
  36. package/dist/kafka/types.d.ts +48 -0
  37. package/dist/kafka/types.js +2 -0
  38. package/dist/kafka/types.js.map +1 -0
  39. package/dist/rabbitmq/client.d.ts +14 -2
  40. package/dist/rabbitmq/client.js +44 -7
  41. package/dist/rabbitmq/client.js.map +1 -1
  42. package/dist/rabbitmq/types.d.ts +64 -4
  43. package/dist/schemas/loader.d.ts +0 -1
  44. package/dist/schemas/loader.js +23 -7
  45. package/dist/schemas/loader.js.map +1 -1
  46. package/dist/schemas/types.d.ts +5 -6
  47. package/dist/schemas/validator.d.ts +0 -1
  48. package/dist/schemas/validator.js +11 -64
  49. package/dist/schemas/validator.js.map +1 -1
  50. package/dist/server.d.ts +5 -4
  51. package/dist/server.js +92 -194
  52. package/dist/server.js.map +1 -1
  53. package/dist/startup.d.ts +18 -0
  54. package/dist/startup.js +36 -0
  55. package/dist/startup.js.map +1 -0
  56. package/dist/tools/check-health.d.ts +6 -0
  57. package/dist/tools/check-health.js +9 -0
  58. package/dist/tools/check-health.js.map +1 -0
  59. package/dist/tools/create-queue.d.ts +2 -3
  60. package/dist/tools/create-queue.js +4 -2
  61. package/dist/tools/create-queue.js.map +1 -1
  62. package/dist/tools/delete-queue.d.ts +11 -0
  63. package/dist/tools/delete-queue.js +9 -0
  64. package/dist/tools/delete-queue.js.map +1 -0
  65. package/dist/tools/get-overview.d.ts +23 -0
  66. package/dist/tools/get-overview.js +13 -0
  67. package/dist/tools/get-overview.js.map +1 -0
  68. package/dist/tools/get-queue.d.ts +19 -0
  69. package/dist/tools/get-queue.js +18 -0
  70. package/dist/tools/get-queue.js.map +1 -0
  71. package/dist/tools/get-schema.d.ts +8 -6
  72. package/dist/tools/get-schema.js.map +1 -1
  73. package/dist/tools/inspect-queue.d.ts +5 -3
  74. package/dist/tools/inspect-queue.js +45 -27
  75. package/dist/tools/inspect-queue.js.map +1 -1
  76. package/dist/tools/list-connections.d.ts +14 -0
  77. package/dist/tools/list-connections.js +16 -0
  78. package/dist/tools/list-connections.js.map +1 -0
  79. package/dist/tools/list-consumers.d.ts +11 -0
  80. package/dist/tools/list-consumers.js +13 -0
  81. package/dist/tools/list-consumers.js.map +1 -0
  82. package/dist/tools/list-queues.d.ts +2 -3
  83. package/dist/tools/list-queues.js +4 -4
  84. package/dist/tools/list-queues.js.map +1 -1
  85. package/dist/tools/list-schemas.d.ts +0 -1
  86. package/dist/tools/list-schemas.js +6 -2
  87. package/dist/tools/list-schemas.js.map +1 -1
  88. package/dist/tools/peek-messages.d.ts +3 -3
  89. package/dist/tools/peek-messages.js +5 -4
  90. package/dist/tools/peek-messages.js.map +1 -1
  91. package/dist/tools/publish-message.d.ts +3 -4
  92. package/dist/tools/publish-message.js +12 -6
  93. package/dist/tools/publish-message.js.map +1 -1
  94. package/dist/tools/purge-queue.d.ts +2 -3
  95. package/dist/tools/purge-queue.js +3 -3
  96. package/dist/tools/purge-queue.js.map +1 -1
  97. package/dist/tools/validate-message.d.ts +0 -1
  98. package/dist/tools/validate-message.js.map +1 -1
  99. package/dist/version.d.ts +1 -0
  100. package/dist/version.js +5 -0
  101. package/dist/version.js.map +1 -0
  102. package/package.json +21 -6
  103. package/dist/index.d.ts.map +0 -1
  104. package/dist/rabbitmq/client.d.ts.map +0 -1
  105. package/dist/rabbitmq/types.d.ts.map +0 -1
  106. package/dist/schemas/loader.d.ts.map +0 -1
  107. package/dist/schemas/types.d.ts.map +0 -1
  108. package/dist/schemas/validator.d.ts.map +0 -1
  109. package/dist/server.d.ts.map +0 -1
  110. package/dist/tools/create-binding.d.ts +0 -15
  111. package/dist/tools/create-binding.d.ts.map +0 -1
  112. package/dist/tools/create-binding.js +0 -10
  113. package/dist/tools/create-binding.js.map +0 -1
  114. package/dist/tools/create-queue.d.ts.map +0 -1
  115. package/dist/tools/get-schema.d.ts.map +0 -1
  116. package/dist/tools/inspect-queue.d.ts.map +0 -1
  117. package/dist/tools/list-bindings.d.ts +0 -11
  118. package/dist/tools/list-bindings.d.ts.map +0 -1
  119. package/dist/tools/list-bindings.js +0 -12
  120. package/dist/tools/list-bindings.js.map +0 -1
  121. package/dist/tools/list-exchanges.d.ts +0 -10
  122. package/dist/tools/list-exchanges.d.ts.map +0 -1
  123. package/dist/tools/list-exchanges.js +0 -11
  124. package/dist/tools/list-exchanges.js.map +0 -1
  125. package/dist/tools/list-queues.d.ts.map +0 -1
  126. package/dist/tools/list-schemas.d.ts.map +0 -1
  127. package/dist/tools/peek-messages.d.ts.map +0 -1
  128. package/dist/tools/publish-message.d.ts.map +0 -1
  129. package/dist/tools/purge-queue.d.ts.map +0 -1
  130. package/dist/tools/validate-message.d.ts.map +0 -1
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Lars
3
+ Copyright (c) 2025-2026 Lars
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,17 +1,33 @@
1
1
  # Queue Pilot
2
2
 
3
- MCP server for message queue development — combines RabbitMQ message inspection with JSON Schema validation.
3
+ [![npm version](https://img.shields.io/npm/v/queue-pilot)](https://www.npmjs.com/package/queue-pilot)
4
+ [![license](https://img.shields.io/npm/l/queue-pilot)](LICENSE)
5
+ [![CI](https://github.com/LarsCowe/queue-pilot/actions/workflows/ci.yml/badge.svg)](https://github.com/LarsCowe/queue-pilot/actions/workflows/ci.yml)
6
+ [![npm downloads](https://img.shields.io/npm/dm/queue-pilot)](https://www.npmjs.com/package/queue-pilot)
7
+ [![node](https://img.shields.io/node/v/queue-pilot)](https://nodejs.org/)
8
+ [![TypeScript](https://img.shields.io/badge/TypeScript-strict-blue)](https://www.typescriptlang.org/)
4
9
 
5
- Designed for integration projects where multiple teams communicate via RabbitMQ: inspect queues, view messages, and validate payloads against agreed-upon schemas — all from your AI assistant.
10
+ MCP server for message queue development combines message inspection with JSON Schema validation. Supports **RabbitMQ** and **Kafka**.
11
+
12
+ Designed for integration projects where multiple teams communicate via message brokers: inspect queues/topics, view messages, and validate payloads against agreed-upon schemas — all from your AI assistant.
6
13
 
7
14
  ## Features
8
15
 
9
- - **Message Inspection** — Browse queues, peek at messages without consuming them
16
+ - **Multi-broker support** — RabbitMQ and Apache Kafka via a unified adapter interface
17
+ - **Message Inspection** — Browse queues/topics, peek at messages without consuming them
10
18
  - **Schema Validation** — Validate message payloads against JSON Schema definitions
11
19
  - **Combined Inspection** — `inspect_queue` peeks messages AND validates each against its schema
12
20
  - **Validated Publishing** — `publish_message` validates against a schema before sending — invalid messages never hit the broker
13
- - **Queue Management** — Create queues, bindings, and purge messages for dev/test workflows
14
- - **Broker Info** — List exchanges and bindings to understand message routing
21
+ - **Queue Management** — Create queues/topics, bindings, and purge messages for dev/test workflows
22
+ - **Broker Info** — List exchanges, bindings, consumer groups, and partition details
23
+
24
+ ## Prerequisites
25
+
26
+ - **Node.js >= 22** — Required runtime ([check with `node --version`](https://nodejs.org/))
27
+ - **A message broker:**
28
+ - **RabbitMQ** with the [management plugin](https://www.rabbitmq.com/docs/management) enabled (HTTP API on port 15672), or
29
+ - **Apache Kafka** (requires `@confluentinc/kafka-javascript` — install separately: `npm install @confluentinc/kafka-javascript`)
30
+ - **An MCP-compatible client** — Claude Code, Claude Desktop, Cursor, VS Code (Copilot), Windsurf, etc.
15
31
 
16
32
  ## Quick Start
17
33
 
@@ -19,8 +35,9 @@ Designed for integration projects where multiple teams communicate via RabbitMQ:
19
35
 
20
36
  Create JSON Schema files in a directory:
21
37
 
38
+ `schemas/order.created.json`:
39
+
22
40
  ```json
23
- // schemas/order.created.json
24
41
  {
25
42
  "$id": "order.created",
26
43
  "$schema": "http://json-schema.org/draft-07/schema#",
@@ -38,34 +55,98 @@ Create JSON Schema files in a directory:
38
55
 
39
56
  ### 2. Add to your MCP client
40
57
 
58
+ Generate the config for your client with `queue-pilot init`:
59
+
60
+ ```bash
61
+ # RabbitMQ (default)
62
+ npx queue-pilot init --schemas /absolute/path/to/your/schemas
63
+
64
+ # Kafka
65
+ npx queue-pilot init --schemas /absolute/path/to/your/schemas --broker kafka
66
+ ```
67
+
68
+ For a specific client, use `--client`:
69
+
70
+ ```bash
71
+ # Claude Code — outputs a ready-to-run `claude mcp add` command
72
+ npx queue-pilot init --schemas ./schemas --client claude-code
73
+
74
+ # VS Code (Copilot)
75
+ npx queue-pilot init --schemas ./schemas --client vscode
76
+
77
+ # Cursor
78
+ npx queue-pilot init --schemas ./schemas --client cursor
79
+
80
+ # Claude Desktop
81
+ npx queue-pilot init --schemas ./schemas --client claude-desktop
82
+
83
+ # Windsurf
84
+ npx queue-pilot init --schemas ./schemas --client windsurf
85
+ ```
86
+
87
+ Non-default settings are included as environment variables (not CLI args) to avoid exposing credentials in `ps` output:
88
+
89
+ ```bash
90
+ # RabbitMQ with custom credentials
91
+ npx queue-pilot init --schemas ./schemas --rabbitmq-user admin --rabbitmq-pass secret
92
+
93
+ # Kafka with SASL authentication
94
+ npx queue-pilot init --schemas ./schemas --broker kafka --kafka-brokers kafka:9092 --kafka-sasl-mechanism plain --kafka-sasl-username admin --kafka-sasl-password secret
95
+ ```
96
+
97
+ > **Windows note:** If `npx` fails to resolve the package, try `cmd /c npx queue-pilot init ...`.
98
+
99
+ <details>
100
+ <summary>Manual configuration (without init)</summary>
101
+
41
102
  Add the following server configuration to your MCP client:
42
103
 
104
+ **RabbitMQ:**
105
+
43
106
  ```json
44
107
  {
45
108
  "mcpServers": {
46
109
  "queue-pilot": {
47
110
  "command": "npx",
48
111
  "args": [
112
+ "-y",
49
113
  "queue-pilot",
50
- "--schemas", "./schemas",
51
- "--rabbitmq-url", "http://localhost:15672",
52
- "--rabbitmq-user", "guest",
53
- "--rabbitmq-pass", "guest"
114
+ "--schemas", "/absolute/path/to/your/schemas"
54
115
  ]
55
116
  }
56
117
  }
57
118
  }
58
119
  ```
59
120
 
60
- <details>
61
- <summary>Where does this config go?</summary>
121
+ **Kafka:**
122
+
123
+ ```json
124
+ {
125
+ "mcpServers": {
126
+ "queue-pilot": {
127
+ "command": "npx",
128
+ "args": [
129
+ "-y",
130
+ "queue-pilot",
131
+ "--schemas", "/absolute/path/to/your/schemas",
132
+ "--broker", "kafka"
133
+ ],
134
+ "env": {
135
+ "KAFKA_BROKERS": "localhost:9092"
136
+ }
137
+ }
138
+ }
139
+ }
140
+ ```
141
+
142
+ > **Schema path tip:** Use an absolute path for `--schemas`. Relative paths resolve from the MCP client's working directory, which may not be your project root.
62
143
 
63
144
  | Client | Config file |
64
145
  |--------|------------|
65
146
  | Claude Code | `.claude/mcp.json` (project) or `~/.claude/mcp.json` (global) |
66
147
  | Claude Desktop | `claude_desktop_config.json` |
67
148
  | Cursor | `.cursor/mcp.json` |
68
- | VS Code (Copilot) | `.vscode/mcp.json` |
149
+ | VS Code (Copilot) | `.vscode/mcp.json` (uses `"servers"` instead of `"mcpServers"`) |
69
150
  | Windsurf | `~/.codeium/windsurf/mcp_config.json` |
70
151
 
71
152
  </details>
@@ -81,11 +162,9 @@ Add the following server configuration to your MCP client:
81
162
  "args": [
82
163
  "tsx",
83
164
  "src/index.ts",
84
- "--schemas", "./schemas",
85
- "--rabbitmq-url", "http://localhost:15672",
86
- "--rabbitmq-user", "guest",
87
- "--rabbitmq-pass", "guest"
88
- ]
165
+ "--schemas", "./schemas"
166
+ ],
167
+ "cwd": "/path/to/queue-pilot"
89
168
  }
90
169
  }
91
170
  }
@@ -105,36 +184,76 @@ Ask your assistant things like:
105
184
  - "Publish an order.created event to the events exchange"
106
185
  - "Create a queue called dead-letters and bind it to the events exchange"
107
186
  - "Purge all messages from the orders queue"
187
+ - "List all consumer groups" (Kafka)
188
+ - "Show me the partition details for the orders topic" (Kafka)
108
189
 
109
190
  ## MCP Tools
110
191
 
111
- ### Read
192
+ ### Universal tools (all brokers)
112
193
 
113
194
  | Tool | Description |
114
195
  |------|-------------|
115
196
  | `list_schemas` | List all loaded message schemas |
116
197
  | `get_schema` | Get the full definition of a specific schema |
117
198
  | `validate_message` | Validate a JSON message against a schema |
118
- | `list_queues` | List all RabbitMQ queues with message counts |
119
- | `peek_messages` | View messages in a queue without consuming them |
199
+ | `list_queues` | List all queues/topics with message counts |
200
+ | `peek_messages` | View messages in a queue/topic without consuming them |
120
201
  | `inspect_queue` | Peek messages + validate each against its schema |
202
+ | `get_overview` | Get broker cluster overview |
203
+ | `check_health` | Check broker health status |
204
+ | `get_queue` | Get detailed information about a specific queue/topic |
205
+ | `list_consumers` | List consumers (RabbitMQ) or consumer groups (Kafka) |
206
+ | `publish_message` | Publish a message with optional schema validation gate |
207
+ | `purge_queue` | Remove all messages from a queue/topic |
208
+ | `create_queue` | Create a new queue/topic |
209
+ | `delete_queue` | Delete a queue/topic |
210
+
211
+ ### RabbitMQ-specific tools
212
+
213
+ | Tool | Description |
214
+ |------|-------------|
121
215
  | `list_exchanges` | List all RabbitMQ exchanges |
216
+ | `create_exchange` | Create a new exchange |
217
+ | `delete_exchange` | Delete an exchange |
122
218
  | `list_bindings` | List bindings between exchanges and queues |
219
+ | `create_binding` | Bind a queue to an exchange with a routing key |
220
+ | `delete_binding` | Delete a binding |
221
+ | `list_connections` | List all client connections to the broker |
123
222
 
124
- ### Write
223
+ ### Kafka-specific tools
125
224
 
126
225
  | Tool | Description |
127
226
  |------|-------------|
128
- | `publish_message` | Publish a message to an exchange with optional schema validation gate |
129
- | `purge_queue` | Remove all messages from a queue (returns count purged) |
130
- | `create_queue` | Create a new queue (idempotent if settings match) |
131
- | `create_binding` | Bind a queue to an exchange with a routing key |
227
+ | `list_consumer_groups` | List all consumer groups with their state |
228
+ | `describe_consumer_group` | Show members, assignments, and state of a consumer group |
229
+ | `list_partitions` | Show partition details for a topic (leader, replicas, ISR) |
230
+ | `get_offsets` | Show earliest/latest offsets per partition |
231
+
232
+ ## MCP Prompts
233
+
234
+ Pre-built workflow templates that guide your AI assistant through multi-step operations.
235
+
236
+ | Prompt | Parameters | Description |
237
+ |--------|-----------|-------------|
238
+ | `debug-flow` | `exchange`, `queue` | Trace bindings from exchange to queue, peek messages, and validate each against its schema |
239
+ | `health-report` | _(none)_ | Check broker health, get cluster overview, flag queues with backed-up messages |
240
+ | `schema-compliance` | `queue` _(optional)_ | Peek messages and validate each against its schema — for one queue or all queues |
241
+
242
+ Usage example (in any MCP-compatible client):
243
+
244
+ > "Use the debug-flow prompt for exchange 'events' and queue 'orders'"
245
+
246
+ ## MCP Resources
247
+
248
+ Each loaded schema is exposed as a readable MCP resource at `schema:///<schema-name>`.
249
+
250
+ Clients that support MCP resources can read schema definitions directly without calling tools. For example, a schema loaded from `order.created.json` is available at `schema:///order.created`.
132
251
 
133
252
  ## Schema Format
134
253
 
135
254
  Schemas follow JSON Schema draft-07 with a few conventions:
136
255
 
137
- - `$id` — Message type identifier (matches the `type` property on RabbitMQ messages)
256
+ - `$id` — Message type identifier (matches the `type` property on messages)
138
257
  - `version` — Schema version (custom field, not validated by JSON Schema)
139
258
  - Standard JSON Schema validation including `required`, `properties`, `format` etc.
140
259
 
@@ -142,24 +261,82 @@ Schema matching: when inspecting a queue, the message's `type` property is used
142
261
 
143
262
  ## CLI Arguments
144
263
 
264
+ ### General
265
+
145
266
  | Argument | Default | Description |
146
267
  |----------|---------|-------------|
147
268
  | `--schemas` | (required) | Path to directory containing JSON Schema files |
269
+ | `--broker` | `rabbitmq` | Broker type: `rabbitmq` or `kafka` |
270
+
271
+ ### RabbitMQ
272
+
273
+ | Argument | Default | Description |
274
+ |----------|---------|-------------|
148
275
  | `--rabbitmq-url` | `http://localhost:15672` | RabbitMQ Management API URL |
149
276
  | `--rabbitmq-user` | `guest` | RabbitMQ username |
150
277
  | `--rabbitmq-pass` | `guest` | RabbitMQ password |
151
278
 
279
+ ### Kafka
280
+
281
+ | Argument | Default | Description |
282
+ |----------|---------|-------------|
283
+ | `--kafka-brokers` | `localhost:9092` | Comma-separated broker addresses |
284
+ | `--kafka-client-id` | `queue-pilot` | Kafka client ID |
285
+ | `--kafka-sasl-mechanism` | _(none)_ | SASL mechanism: `plain`, `scram-sha-256`, `scram-sha-512` |
286
+ | `--kafka-sasl-username` | _(none)_ | SASL username |
287
+ | `--kafka-sasl-password` | _(none)_ | SASL password |
288
+
289
+ ## Environment Variables
290
+
291
+ Connection settings can also be configured via environment variables. CLI arguments take priority over environment variables, which take priority over defaults.
292
+
293
+ ### RabbitMQ
294
+
295
+ | Variable | Default | Description |
296
+ |----------|---------|-------------|
297
+ | `RABBITMQ_URL` | `http://localhost:15672` | RabbitMQ Management API URL |
298
+ | `RABBITMQ_USER` | `guest` | RabbitMQ username |
299
+ | `RABBITMQ_PASS` | `guest` | RabbitMQ password |
300
+
301
+ ### Kafka
302
+
303
+ | Variable | Default | Description |
304
+ |----------|---------|-------------|
305
+ | `KAFKA_BROKERS` | `localhost:9092` | Comma-separated broker addresses |
306
+ | `KAFKA_CLIENT_ID` | `queue-pilot` | Kafka client ID |
307
+ | `KAFKA_SASL_MECHANISM` | _(none)_ | SASL mechanism |
308
+ | `KAFKA_SASL_USERNAME` | _(none)_ | SASL username |
309
+ | `KAFKA_SASL_PASSWORD` | _(none)_ | SASL password |
310
+
311
+ This is useful with MCP client `env` blocks to avoid exposing credentials in `ps` output:
312
+
313
+ ```json
314
+ {
315
+ "mcpServers": {
316
+ "queue-pilot": {
317
+ "command": "npx",
318
+ "args": ["-y", "queue-pilot", "--schemas", "/absolute/path/to/your/schemas"],
319
+ "env": {
320
+ "RABBITMQ_URL": "http://localhost:15672",
321
+ "RABBITMQ_USER": "admin",
322
+ "RABBITMQ_PASS": "secret"
323
+ }
324
+ }
325
+ }
326
+ }
327
+ ```
328
+
152
329
  ## Development
153
330
 
154
331
  ```bash
155
332
  npm install
156
- npm test # Unit tests (103 tests)
333
+ npm test # Unit tests
157
334
  npm run test:coverage # Coverage report
158
335
  npm run build # TypeScript compilation
159
- npm run lint # Type check
336
+ npm run typecheck # Type check
160
337
 
161
338
  # Integration tests (requires RabbitMQ)
162
- docker compose up -d
339
+ docker compose up -d --wait
163
340
  npm run test:integration
164
341
  ```
165
342
 
@@ -170,7 +347,8 @@ npm run test:integration
170
347
  - [Ajv](https://ajv.js.org/) for JSON Schema validation
171
348
  - [Zod](https://zod.dev/) for MCP tool parameter definitions
172
349
  - [Vitest](https://vitest.dev/) for testing
173
- - RabbitMQ Management HTTP API (no additional broker dependencies)
350
+ - RabbitMQ Management HTTP API
351
+ - [Confluent Kafka JavaScript](https://github.com/confluentinc/confluent-kafka-javascript) (optional, for Kafka support)
174
352
 
175
353
  ## License
176
354
 
@@ -0,0 +1,25 @@
1
+ import type { BrokerAdapter } from "./types.js";
2
+ import type { ToolDefinition } from "./tool-definition.js";
3
+ export interface RabbitMQBrokerConfig {
4
+ broker: "rabbitmq";
5
+ url: string;
6
+ username: string;
7
+ password: string;
8
+ }
9
+ export interface KafkaBrokerConfig {
10
+ broker: "kafka";
11
+ brokers: string[];
12
+ clientId?: string;
13
+ sasl?: {
14
+ mechanism: "plain" | "scram-sha-256" | "scram-sha-512";
15
+ username: string;
16
+ password: string;
17
+ };
18
+ ssl?: boolean;
19
+ }
20
+ export type BrokerConfig = RabbitMQBrokerConfig | KafkaBrokerConfig;
21
+ export interface AdapterResult {
22
+ adapter: BrokerAdapter;
23
+ tools: ToolDefinition[];
24
+ }
25
+ export declare function createAdapter(config: BrokerConfig): Promise<AdapterResult>;
@@ -0,0 +1,35 @@
1
+ import { RabbitMQClient } from "../rabbitmq/client.js";
2
+ import { RabbitMQAdapter } from "../brokers/rabbitmq/adapter.js";
3
+ import { createRabbitMQTools } from "../brokers/rabbitmq/tools.js";
4
+ export async function createAdapter(config) {
5
+ switch (config.broker) {
6
+ case "rabbitmq": {
7
+ const client = new RabbitMQClient({
8
+ url: config.url,
9
+ username: config.username,
10
+ password: config.password,
11
+ });
12
+ const adapter = new RabbitMQAdapter(client);
13
+ const tools = createRabbitMQTools(adapter);
14
+ return { adapter, tools };
15
+ }
16
+ case "kafka": {
17
+ const { KafkaClient } = await import("../kafka/client.js");
18
+ const { KafkaAdapter } = await import("../brokers/kafka/adapter.js");
19
+ const { createKafkaTools } = await import("../brokers/kafka/tools.js");
20
+ const client = new KafkaClient({
21
+ brokers: config.brokers,
22
+ clientId: config.clientId,
23
+ sasl: config.sasl,
24
+ ssl: config.ssl,
25
+ });
26
+ const adapter = new KafkaAdapter(client);
27
+ const tools = createKafkaTools(adapter);
28
+ return { adapter, tools };
29
+ }
30
+ default: {
31
+ throw new Error(`Unsupported broker: ${config.broker}`);
32
+ }
33
+ }
34
+ }
35
+ //# sourceMappingURL=factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src/broker/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AA8BnE,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAAoB;IACtD,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,KAAK,UAAU,CAAC,CAAC,CAAC;YAChB,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC;gBAChC,GAAG,EAAE,MAAM,CAAC,GAAG;gBACf,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;aAC1B,CAAC,CAAC;YACH,MAAM,OAAO,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;YAC5C,MAAM,KAAK,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;YAC3C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC5B,CAAC;QACD,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;YAC3D,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC,6BAA6B,CAAC,CAAC;YACrE,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;YAEvE,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC;gBAC7B,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,GAAG,EAAE,MAAM,CAAC,GAAG;aAChB,CAAC,CAAC;YACH,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;YACzC,MAAM,KAAK,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;YACxC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC5B,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,IAAI,KAAK,CAAC,uBAAwB,MAA6B,CAAC,MAAM,EAAE,CAAC,CAAC;QAClF,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { SchemaValidator } from "../schemas/validator.js";
3
+ import type { BrokerAdapter } from "./types.js";
4
+ import type { ToolDefinition } from "./tool-definition.js";
5
+ export declare function registerSchemaTools(server: McpServer, validator: SchemaValidator): void;
6
+ export declare function registerUniversalTools(server: McpServer, adapter: BrokerAdapter, validator: SchemaValidator): void;
7
+ export declare function registerCapabilityTools(server: McpServer, adapter: BrokerAdapter): void;
8
+ export declare function registerBrokerTools(server: McpServer, tools: ToolDefinition[]): void;
@@ -0,0 +1,95 @@
1
+ import { z } from "zod";
2
+ import { hasOverview, hasConsumers, hasConnections } from "./types.js";
3
+ import { listSchemas } from "../tools/list-schemas.js";
4
+ import { getSchema } from "../tools/get-schema.js";
5
+ import { validateMessage } from "../tools/validate-message.js";
6
+ import { listQueues } from "../tools/list-queues.js";
7
+ import { getQueue } from "../tools/get-queue.js";
8
+ import { createQueue } from "../tools/create-queue.js";
9
+ import { deleteQueue } from "../tools/delete-queue.js";
10
+ import { purgeQueue } from "../tools/purge-queue.js";
11
+ import { peekMessages } from "../tools/peek-messages.js";
12
+ import { inspectQueue } from "../tools/inspect-queue.js";
13
+ import { publishMessage } from "../tools/publish-message.js";
14
+ import { checkHealth } from "../tools/check-health.js";
15
+ import { getOverview } from "../tools/get-overview.js";
16
+ import { listConsumers } from "../tools/list-consumers.js";
17
+ import { listConnections } from "../tools/list-connections.js";
18
+ const jsonResponse = (data) => ({
19
+ content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
20
+ });
21
+ export function registerSchemaTools(server, validator) {
22
+ server.tool("list_schemas", "List all loaded message schemas", {}, async () => {
23
+ return jsonResponse(listSchemas(validator));
24
+ });
25
+ server.tool("get_schema", "Get the full definition of a specific schema", { name: z.string().describe("Schema name (e.g. 'order.created')") }, async ({ name }) => jsonResponse(getSchema(validator, name)));
26
+ server.tool("validate_message", "Validate a JSON message against a schema", {
27
+ schemaName: z.string().describe("Schema name to validate against"),
28
+ message: z.string().describe("JSON message payload to validate"),
29
+ }, async ({ schemaName, message }) => jsonResponse(validateMessage(validator, schemaName, message)));
30
+ }
31
+ export function registerUniversalTools(server, adapter, validator) {
32
+ server.tool("list_queues", "List all queues with message counts", {
33
+ vhost: z.string().default("/").describe("Virtual host / scope (default: '/')"),
34
+ }, async ({ vhost }) => jsonResponse(await listQueues(adapter, vhost)));
35
+ server.tool("get_queue", "Get detailed information about a specific queue", {
36
+ queue: z.string().describe("Queue name"),
37
+ vhost: z.string().default("/").describe("Virtual host / scope (default: '/')"),
38
+ }, async ({ queue, vhost }) => jsonResponse(await getQueue(adapter, vhost, queue)));
39
+ server.tool("create_queue", "Create a new queue. Idempotent if settings match; errors if the queue exists with different settings.", {
40
+ queue: z.string().describe("Queue name"),
41
+ durable: z.boolean().default(false).describe("Survive broker restart (default: false)"),
42
+ auto_delete: z.boolean().default(false).describe("Delete when last consumer disconnects (default: false)"),
43
+ vhost: z.string().default("/").describe("Virtual host / scope (default: '/')"),
44
+ }, async ({ queue, durable, auto_delete, vhost }) => jsonResponse(await createQueue(adapter, { queue, durable, auto_delete, vhost })));
45
+ server.tool("delete_queue", "Delete a queue.", {
46
+ queue: z.string().describe("Queue name"),
47
+ vhost: z.string().default("/").describe("Virtual host / scope (default: '/')"),
48
+ }, async ({ queue, vhost }) => jsonResponse(await deleteQueue(adapter, { queue, vhost })));
49
+ server.tool("purge_queue", "Remove all messages from a queue. Returns the number of messages purged.", {
50
+ queue: z.string().describe("Queue name"),
51
+ vhost: z.string().default("/").describe("Virtual host / scope (default: '/')"),
52
+ }, async ({ queue, vhost }) => jsonResponse(await purgeQueue(adapter, vhost, queue)));
53
+ server.tool("peek_messages", "View messages in a queue without consuming them", {
54
+ queue: z.string().describe("Queue name"),
55
+ count: z.number().int().min(1).max(50).default(5).describe("Number of messages to peek (default 5, max 50)"),
56
+ vhost: z.string().default("/").describe("Virtual host / scope (default: '/')"),
57
+ }, async ({ queue, count, vhost }) => jsonResponse(await peekMessages(adapter, vhost, queue, count)));
58
+ server.tool("inspect_queue", "View messages in a queue and validate each against its schema", {
59
+ queue: z.string().describe("Queue name"),
60
+ count: z.number().int().min(1).max(50).default(5).describe("Number of messages to inspect (default 5, max 50)"),
61
+ vhost: z.string().default("/").describe("Virtual host / scope (default: '/')"),
62
+ }, async ({ queue, count, vhost }) => jsonResponse(await inspectQueue(adapter, validator, vhost, queue, count)));
63
+ server.tool("publish_message", "Publish a message to an exchange. Optionally validates against a schema before publishing — if validation fails, the message is NOT sent.", {
64
+ exchange: z.string().describe("Exchange name ('amq.default' for direct-to-queue)"),
65
+ routing_key: z.string().describe("Routing key"),
66
+ payload: z.string().describe("JSON message payload"),
67
+ message_type: z.string().optional().describe("Message type (e.g. 'order.created'), used for schema lookup"),
68
+ headers: z.record(z.union([z.string(), z.number(), z.boolean(), z.null()])).optional().describe("Optional message headers"),
69
+ validate: z.boolean().default(true).describe("Validate before publishing (default: true)"),
70
+ vhost: z.string().default("/").describe("Virtual host / scope (default: '/')"),
71
+ }, async ({ exchange, routing_key, payload, message_type, headers, validate, vhost }) => jsonResponse(await publishMessage(adapter, validator, { exchange, routing_key, payload, message_type, headers, validate, vhost })));
72
+ server.tool("check_health", "Check broker health status. Returns ok or failed with reason.", {}, async () => jsonResponse(await checkHealth(adapter)));
73
+ }
74
+ export function registerCapabilityTools(server, adapter) {
75
+ if (hasOverview(adapter)) {
76
+ const overviewAdapter = adapter;
77
+ server.tool("get_overview", "Get cluster overview: version info, message rates, queue totals, and object counts.", {}, async () => jsonResponse(await getOverview(overviewAdapter)));
78
+ }
79
+ if (hasConsumers(adapter)) {
80
+ const consumerAdapter = adapter;
81
+ server.tool("list_consumers", "List all consumers connected to queues in a scope.", {
82
+ vhost: z.string().default("/").describe("Virtual host / scope (default: '/')"),
83
+ }, async ({ vhost }) => jsonResponse(await listConsumers(consumerAdapter, vhost)));
84
+ }
85
+ if (hasConnections(adapter)) {
86
+ const connectionAdapter = adapter;
87
+ server.tool("list_connections", "List all client connections to the broker.", {}, async () => jsonResponse(await listConnections(connectionAdapter)));
88
+ }
89
+ }
90
+ export function registerBrokerTools(server, tools) {
91
+ for (const tool of tools) {
92
+ server.tool(tool.name, tool.description, tool.parameters, async (args) => jsonResponse(await tool.handler(args)));
93
+ }
94
+ }
95
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/broker/registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEvE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EA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,CAAC,UAAU,EACf,KAAK,EAAE,IAA6B,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAChF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { z } from "zod";
2
+ export interface ToolDefinition {
3
+ name: string;
4
+ description: string;
5
+ parameters: Record<string, z.ZodTypeAny>;
6
+ handler: (args: Record<string, unknown>) => Promise<unknown>;
7
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=tool-definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-definition.js","sourceRoot":"","sources":["../../src/broker/tool-definition.ts"],"names":[],"mappings":""}
@@ -0,0 +1,71 @@
1
+ export interface BrokerQueueInfo {
2
+ name: string;
3
+ messages_ready: number | null;
4
+ messages_unacknowledged: number | null;
5
+ state: string;
6
+ metadata: Record<string, unknown>;
7
+ }
8
+ export interface BrokerMessage {
9
+ payload: string;
10
+ payload_encoding: string;
11
+ properties: {
12
+ correlation_id?: string;
13
+ message_id?: string;
14
+ type?: string;
15
+ timestamp?: number;
16
+ headers?: Record<string, unknown>;
17
+ content_type?: string;
18
+ };
19
+ metadata: Record<string, unknown>;
20
+ }
21
+ export interface BrokerHealthResult {
22
+ status: string;
23
+ reason?: string;
24
+ }
25
+ export interface CreateQueueParams {
26
+ name: string;
27
+ durable?: boolean;
28
+ auto_delete?: boolean;
29
+ scope?: string;
30
+ }
31
+ export interface CreateQueueResult {
32
+ name: string;
33
+ created: boolean;
34
+ }
35
+ export interface PurgeResult {
36
+ messagesRemoved: number;
37
+ }
38
+ export interface PublishParams {
39
+ destination: string;
40
+ routing_key: string;
41
+ payload: string;
42
+ properties?: Record<string, unknown>;
43
+ scope?: string;
44
+ }
45
+ export interface PublishResult {
46
+ published: boolean;
47
+ routed: boolean;
48
+ }
49
+ export interface BrokerAdapter {
50
+ listQueues(scope?: string): Promise<BrokerQueueInfo[]>;
51
+ getQueue(name: string, scope?: string): Promise<BrokerQueueInfo>;
52
+ createQueue(params: CreateQueueParams): Promise<CreateQueueResult>;
53
+ deleteQueue(name: string, scope?: string): Promise<void>;
54
+ purgeQueue(name: string, scope?: string): Promise<PurgeResult>;
55
+ peekMessages(queue: string, count: number, scope?: string): Promise<BrokerMessage[]>;
56
+ publishMessage(params: PublishParams): Promise<PublishResult>;
57
+ checkHealth(): Promise<BrokerHealthResult>;
58
+ disconnect(): Promise<void>;
59
+ }
60
+ export interface OverviewCapability {
61
+ getOverview(): Promise<Record<string, unknown>>;
62
+ }
63
+ export interface ConsumerCapability {
64
+ listConsumers(scope?: string): Promise<Record<string, unknown>[]>;
65
+ }
66
+ export interface ConnectionCapability {
67
+ listConnections(): Promise<Record<string, unknown>[]>;
68
+ }
69
+ export declare function hasOverview(adapter: BrokerAdapter): adapter is BrokerAdapter & OverviewCapability;
70
+ export declare function hasConsumers(adapter: BrokerAdapter): adapter is BrokerAdapter & ConsumerCapability;
71
+ export declare function hasConnections(adapter: BrokerAdapter): adapter is BrokerAdapter & ConnectionCapability;
@@ -0,0 +1,10 @@
1
+ export function hasOverview(adapter) {
2
+ return typeof adapter.getOverview === "function";
3
+ }
4
+ export function hasConsumers(adapter) {
5
+ return typeof adapter.listConsumers === "function";
6
+ }
7
+ export function hasConnections(adapter) {
8
+ return typeof adapter.listConnections === "function";
9
+ }
10
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/broker/types.ts"],"names":[],"mappings":"AAgFA,MAAM,UAAU,WAAW,CAAC,OAAsB;IAChD,OAAO,OAAQ,OAA8C,CAAC,WAAW,KAAK,UAAU,CAAC;AAC3F,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,OAAsB;IACjD,OAAO,OAAQ,OAA8C,CAAC,aAAa,KAAK,UAAU,CAAC;AAC7F,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAsB;IACnD,OAAO,OAAQ,OAAgD,CAAC,eAAe,KAAK,UAAU,CAAC;AACjG,CAAC"}