queue-pilot 0.2.0 → 0.5.1

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 +213 -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,37 @@
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.
13
+
14
+ <p align="center">
15
+ <img src="docs/queue-pilot-diagram.svg" alt="Queue Pilot architecture: MCP clients connect to Queue Pilot, which interfaces with RabbitMQ and Kafka" width="720">
16
+ </p>
6
17
 
7
18
  ## Features
8
19
 
9
- - **Message Inspection** — Browse queues, peek at messages without consuming them
20
+ - **Multi-broker support** — RabbitMQ and Apache Kafka via a unified adapter interface
21
+ - **Message Inspection** — Browse queues/topics, peek at messages without consuming them
10
22
  - **Schema Validation** — Validate message payloads against JSON Schema definitions
11
23
  - **Combined Inspection** — `inspect_queue` peeks messages AND validates each against its schema
12
24
  - **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
25
+ - **Queue Management** — Create queues/topics, bindings, and purge messages for dev/test workflows
26
+ - **Broker Info** — List exchanges, bindings, consumer groups, and partition details
27
+
28
+ ## Prerequisites
29
+
30
+ - **Node.js >= 22** — Required runtime ([check with `node --version`](https://nodejs.org/))
31
+ - **A message broker:**
32
+ - **RabbitMQ** with the [management plugin](https://www.rabbitmq.com/docs/management) enabled (HTTP API on port 15672), or
33
+ - **Apache Kafka** (requires `@confluentinc/kafka-javascript` — install separately: `npm install @confluentinc/kafka-javascript`)
34
+ - **An MCP-compatible client** — Claude Code, Claude Desktop, Cursor, VS Code (Copilot), Windsurf, etc.
15
35
 
16
36
  ## Quick Start
17
37
 
@@ -19,8 +39,9 @@ Designed for integration projects where multiple teams communicate via RabbitMQ:
19
39
 
20
40
  Create JSON Schema files in a directory:
21
41
 
42
+ `schemas/order.created.json`:
43
+
22
44
  ```json
23
- // schemas/order.created.json
24
45
  {
25
46
  "$id": "order.created",
26
47
  "$schema": "http://json-schema.org/draft-07/schema#",
@@ -38,34 +59,98 @@ Create JSON Schema files in a directory:
38
59
 
39
60
  ### 2. Add to your MCP client
40
61
 
62
+ Generate the config for your client with `queue-pilot init`:
63
+
64
+ ```bash
65
+ # RabbitMQ (default)
66
+ npx queue-pilot init --schemas /absolute/path/to/your/schemas
67
+
68
+ # Kafka
69
+ npx queue-pilot init --schemas /absolute/path/to/your/schemas --broker kafka
70
+ ```
71
+
72
+ For a specific client, use `--client`:
73
+
74
+ ```bash
75
+ # Claude Code — outputs a ready-to-run `claude mcp add` command
76
+ npx queue-pilot init --schemas ./schemas --client claude-code
77
+
78
+ # VS Code (Copilot)
79
+ npx queue-pilot init --schemas ./schemas --client vscode
80
+
81
+ # Cursor
82
+ npx queue-pilot init --schemas ./schemas --client cursor
83
+
84
+ # Claude Desktop
85
+ npx queue-pilot init --schemas ./schemas --client claude-desktop
86
+
87
+ # Windsurf
88
+ npx queue-pilot init --schemas ./schemas --client windsurf
89
+ ```
90
+
91
+ Non-default settings are included as environment variables (not CLI args) to avoid exposing credentials in `ps` output:
92
+
93
+ ```bash
94
+ # RabbitMQ with custom credentials
95
+ npx queue-pilot init --schemas ./schemas --rabbitmq-user admin --rabbitmq-pass secret
96
+
97
+ # Kafka with SASL authentication
98
+ npx queue-pilot init --schemas ./schemas --broker kafka --kafka-brokers kafka:9092 --kafka-sasl-mechanism plain --kafka-sasl-username admin --kafka-sasl-password secret
99
+ ```
100
+
101
+ > **Windows note:** If `npx` fails to resolve the package, try `cmd /c npx queue-pilot init ...`.
102
+
103
+ <details>
104
+ <summary>Manual configuration (without init)</summary>
105
+
41
106
  Add the following server configuration to your MCP client:
42
107
 
108
+ **RabbitMQ:**
109
+
43
110
  ```json
44
111
  {
45
112
  "mcpServers": {
46
113
  "queue-pilot": {
47
114
  "command": "npx",
48
115
  "args": [
116
+ "-y",
49
117
  "queue-pilot",
50
- "--schemas", "./schemas",
51
- "--rabbitmq-url", "http://localhost:15672",
52
- "--rabbitmq-user", "guest",
53
- "--rabbitmq-pass", "guest"
118
+ "--schemas", "/absolute/path/to/your/schemas"
54
119
  ]
55
120
  }
56
121
  }
57
122
  }
58
123
  ```
59
124
 
60
- <details>
61
- <summary>Where does this config go?</summary>
125
+ **Kafka:**
126
+
127
+ ```json
128
+ {
129
+ "mcpServers": {
130
+ "queue-pilot": {
131
+ "command": "npx",
132
+ "args": [
133
+ "-y",
134
+ "queue-pilot",
135
+ "--schemas", "/absolute/path/to/your/schemas",
136
+ "--broker", "kafka"
137
+ ],
138
+ "env": {
139
+ "KAFKA_BROKERS": "localhost:9092"
140
+ }
141
+ }
142
+ }
143
+ }
144
+ ```
145
+
146
+ > **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
147
 
63
148
  | Client | Config file |
64
149
  |--------|------------|
65
150
  | Claude Code | `.claude/mcp.json` (project) or `~/.claude/mcp.json` (global) |
66
151
  | Claude Desktop | `claude_desktop_config.json` |
67
152
  | Cursor | `.cursor/mcp.json` |
68
- | VS Code (Copilot) | `.vscode/mcp.json` |
153
+ | VS Code (Copilot) | `.vscode/mcp.json` (uses `"servers"` instead of `"mcpServers"`) |
69
154
  | Windsurf | `~/.codeium/windsurf/mcp_config.json` |
70
155
 
71
156
  </details>
@@ -81,11 +166,9 @@ Add the following server configuration to your MCP client:
81
166
  "args": [
82
167
  "tsx",
83
168
  "src/index.ts",
84
- "--schemas", "./schemas",
85
- "--rabbitmq-url", "http://localhost:15672",
86
- "--rabbitmq-user", "guest",
87
- "--rabbitmq-pass", "guest"
88
- ]
169
+ "--schemas", "./schemas"
170
+ ],
171
+ "cwd": "/path/to/queue-pilot"
89
172
  }
90
173
  }
91
174
  }
@@ -105,36 +188,76 @@ Ask your assistant things like:
105
188
  - "Publish an order.created event to the events exchange"
106
189
  - "Create a queue called dead-letters and bind it to the events exchange"
107
190
  - "Purge all messages from the orders queue"
191
+ - "List all consumer groups" (Kafka)
192
+ - "Show me the partition details for the orders topic" (Kafka)
108
193
 
109
194
  ## MCP Tools
110
195
 
111
- ### Read
196
+ ### Universal tools (all brokers)
112
197
 
113
198
  | Tool | Description |
114
199
  |------|-------------|
115
200
  | `list_schemas` | List all loaded message schemas |
116
201
  | `get_schema` | Get the full definition of a specific schema |
117
202
  | `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 |
203
+ | `list_queues` | List all queues/topics with message counts |
204
+ | `peek_messages` | View messages in a queue/topic without consuming them |
120
205
  | `inspect_queue` | Peek messages + validate each against its schema |
206
+ | `get_overview` | Get broker cluster overview |
207
+ | `check_health` | Check broker health status |
208
+ | `get_queue` | Get detailed information about a specific queue/topic |
209
+ | `list_consumers` | List consumers (RabbitMQ) or consumer groups (Kafka) |
210
+ | `publish_message` | Publish a message with optional schema validation gate |
211
+ | `purge_queue` | Remove all messages from a queue/topic |
212
+ | `create_queue` | Create a new queue/topic |
213
+ | `delete_queue` | Delete a queue/topic |
214
+
215
+ ### RabbitMQ-specific tools
216
+
217
+ | Tool | Description |
218
+ |------|-------------|
121
219
  | `list_exchanges` | List all RabbitMQ exchanges |
220
+ | `create_exchange` | Create a new exchange |
221
+ | `delete_exchange` | Delete an exchange |
122
222
  | `list_bindings` | List bindings between exchanges and queues |
223
+ | `create_binding` | Bind a queue to an exchange with a routing key |
224
+ | `delete_binding` | Delete a binding |
225
+ | `list_connections` | List all client connections to the broker |
123
226
 
124
- ### Write
227
+ ### Kafka-specific tools
125
228
 
126
229
  | Tool | Description |
127
230
  |------|-------------|
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 |
231
+ | `list_consumer_groups` | List all consumer groups with their state |
232
+ | `describe_consumer_group` | Show members, assignments, and state of a consumer group |
233
+ | `list_partitions` | Show partition details for a topic (leader, replicas, ISR) |
234
+ | `get_offsets` | Show earliest/latest offsets per partition |
235
+
236
+ ## MCP Prompts
237
+
238
+ Pre-built workflow templates that guide your AI assistant through multi-step operations.
239
+
240
+ | Prompt | Parameters | Description |
241
+ |--------|-----------|-------------|
242
+ | `debug-flow` | `exchange`, `queue` | Trace bindings from exchange to queue, peek messages, and validate each against its schema |
243
+ | `health-report` | _(none)_ | Check broker health, get cluster overview, flag queues with backed-up messages |
244
+ | `schema-compliance` | `queue` _(optional)_ | Peek messages and validate each against its schema — for one queue or all queues |
245
+
246
+ Usage example (in any MCP-compatible client):
247
+
248
+ > "Use the debug-flow prompt for exchange 'events' and queue 'orders'"
249
+
250
+ ## MCP Resources
251
+
252
+ Each loaded schema is exposed as a readable MCP resource at `schema:///<schema-name>`.
253
+
254
+ 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
255
 
133
256
  ## Schema Format
134
257
 
135
258
  Schemas follow JSON Schema draft-07 with a few conventions:
136
259
 
137
- - `$id` — Message type identifier (matches the `type` property on RabbitMQ messages)
260
+ - `$id` — Message type identifier (matches the `type` property on messages)
138
261
  - `version` — Schema version (custom field, not validated by JSON Schema)
139
262
  - Standard JSON Schema validation including `required`, `properties`, `format` etc.
140
263
 
@@ -142,24 +265,82 @@ Schema matching: when inspecting a queue, the message's `type` property is used
142
265
 
143
266
  ## CLI Arguments
144
267
 
268
+ ### General
269
+
145
270
  | Argument | Default | Description |
146
271
  |----------|---------|-------------|
147
272
  | `--schemas` | (required) | Path to directory containing JSON Schema files |
273
+ | `--broker` | `rabbitmq` | Broker type: `rabbitmq` or `kafka` |
274
+
275
+ ### RabbitMQ
276
+
277
+ | Argument | Default | Description |
278
+ |----------|---------|-------------|
148
279
  | `--rabbitmq-url` | `http://localhost:15672` | RabbitMQ Management API URL |
149
280
  | `--rabbitmq-user` | `guest` | RabbitMQ username |
150
281
  | `--rabbitmq-pass` | `guest` | RabbitMQ password |
151
282
 
283
+ ### Kafka
284
+
285
+ | Argument | Default | Description |
286
+ |----------|---------|-------------|
287
+ | `--kafka-brokers` | `localhost:9092` | Comma-separated broker addresses |
288
+ | `--kafka-client-id` | `queue-pilot` | Kafka client ID |
289
+ | `--kafka-sasl-mechanism` | _(none)_ | SASL mechanism: `plain`, `scram-sha-256`, `scram-sha-512` |
290
+ | `--kafka-sasl-username` | _(none)_ | SASL username |
291
+ | `--kafka-sasl-password` | _(none)_ | SASL password |
292
+
293
+ ## Environment Variables
294
+
295
+ Connection settings can also be configured via environment variables. CLI arguments take priority over environment variables, which take priority over defaults.
296
+
297
+ ### RabbitMQ
298
+
299
+ | Variable | Default | Description |
300
+ |----------|---------|-------------|
301
+ | `RABBITMQ_URL` | `http://localhost:15672` | RabbitMQ Management API URL |
302
+ | `RABBITMQ_USER` | `guest` | RabbitMQ username |
303
+ | `RABBITMQ_PASS` | `guest` | RabbitMQ password |
304
+
305
+ ### Kafka
306
+
307
+ | Variable | Default | Description |
308
+ |----------|---------|-------------|
309
+ | `KAFKA_BROKERS` | `localhost:9092` | Comma-separated broker addresses |
310
+ | `KAFKA_CLIENT_ID` | `queue-pilot` | Kafka client ID |
311
+ | `KAFKA_SASL_MECHANISM` | _(none)_ | SASL mechanism |
312
+ | `KAFKA_SASL_USERNAME` | _(none)_ | SASL username |
313
+ | `KAFKA_SASL_PASSWORD` | _(none)_ | SASL password |
314
+
315
+ This is useful with MCP client `env` blocks to avoid exposing credentials in `ps` output:
316
+
317
+ ```json
318
+ {
319
+ "mcpServers": {
320
+ "queue-pilot": {
321
+ "command": "npx",
322
+ "args": ["-y", "queue-pilot", "--schemas", "/absolute/path/to/your/schemas"],
323
+ "env": {
324
+ "RABBITMQ_URL": "http://localhost:15672",
325
+ "RABBITMQ_USER": "admin",
326
+ "RABBITMQ_PASS": "secret"
327
+ }
328
+ }
329
+ }
330
+ }
331
+ ```
332
+
152
333
  ## Development
153
334
 
154
335
  ```bash
155
336
  npm install
156
- npm test # Unit tests (103 tests)
337
+ npm test # Unit tests
157
338
  npm run test:coverage # Coverage report
158
339
  npm run build # TypeScript compilation
159
- npm run lint # Type check
340
+ npm run typecheck # Type check
160
341
 
161
342
  # Integration tests (requires RabbitMQ)
162
- docker compose up -d
343
+ docker compose up -d --wait
163
344
  npm run test:integration
164
345
  ```
165
346
 
@@ -170,7 +351,8 @@ npm run test:integration
170
351
  - [Ajv](https://ajv.js.org/) for JSON Schema validation
171
352
  - [Zod](https://zod.dev/) for MCP tool parameter definitions
172
353
  - [Vitest](https://vitest.dev/) for testing
173
- - RabbitMQ Management HTTP API (no additional broker dependencies)
354
+ - RabbitMQ Management HTTP API
355
+ - [Confluent Kafka JavaScript](https://github.com/confluentinc/confluent-kafka-javascript) (optional, for Kafka support)
174
356
 
175
357
  ## License
176
358
 
@@ -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,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KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,CAAC,IAAI,CACT,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,WAAW,EAChB,IAAI,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"}