queue-aiops 0.1.0__tar.gz
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.
- queue_aiops-0.1.0/.github/workflows/mcp-publish.yml +55 -0
- queue_aiops-0.1.0/.github/workflows/publish.yml +26 -0
- queue_aiops-0.1.0/.gitignore +8 -0
- queue_aiops-0.1.0/CHANGELOG.md +29 -0
- queue_aiops-0.1.0/LICENSE +21 -0
- queue_aiops-0.1.0/PKG-INFO +168 -0
- queue_aiops-0.1.0/README.md +151 -0
- queue_aiops-0.1.0/RELEASE_NOTES.md +33 -0
- queue_aiops-0.1.0/SECURITY.md +96 -0
- queue_aiops-0.1.0/mcp_server/__init__.py +1 -0
- queue_aiops-0.1.0/mcp_server/_shared.py +107 -0
- queue_aiops-0.1.0/mcp_server/server.py +38 -0
- queue_aiops-0.1.0/mcp_server/tools/__init__.py +1 -0
- queue_aiops-0.1.0/mcp_server/tools/analysis.py +148 -0
- queue_aiops-0.1.0/mcp_server/tools/overview.py +23 -0
- queue_aiops-0.1.0/mcp_server/tools/rabbit_reads.py +95 -0
- queue_aiops-0.1.0/mcp_server/tools/redis_reads.py +98 -0
- queue_aiops-0.1.0/mcp_server/tools/undo.py +121 -0
- queue_aiops-0.1.0/mcp_server/tools/writes.py +355 -0
- queue_aiops-0.1.0/pyproject.toml +61 -0
- queue_aiops-0.1.0/queue_aiops/__init__.py +14 -0
- queue_aiops-0.1.0/queue_aiops/cli/__init__.py +9 -0
- queue_aiops-0.1.0/queue_aiops/cli/_common.py +78 -0
- queue_aiops-0.1.0/queue_aiops/cli/_root.py +62 -0
- queue_aiops-0.1.0/queue_aiops/cli/analyze.py +85 -0
- queue_aiops-0.1.0/queue_aiops/cli/doctor.py +21 -0
- queue_aiops-0.1.0/queue_aiops/cli/init.py +176 -0
- queue_aiops-0.1.0/queue_aiops/cli/overview.py +16 -0
- queue_aiops-0.1.0/queue_aiops/cli/rabbit_cmds.py +234 -0
- queue_aiops-0.1.0/queue_aiops/cli/redis_cmds.py +147 -0
- queue_aiops-0.1.0/queue_aiops/cli/secret.py +105 -0
- queue_aiops-0.1.0/queue_aiops/cli/undo.py +62 -0
- queue_aiops-0.1.0/queue_aiops/config.py +175 -0
- queue_aiops-0.1.0/queue_aiops/connection.py +277 -0
- queue_aiops-0.1.0/queue_aiops/doctor.py +98 -0
- queue_aiops-0.1.0/queue_aiops/governance/__init__.py +40 -0
- queue_aiops-0.1.0/queue_aiops/governance/audit.py +377 -0
- queue_aiops-0.1.0/queue_aiops/governance/budget.py +225 -0
- queue_aiops-0.1.0/queue_aiops/governance/decorators.py +482 -0
- queue_aiops-0.1.0/queue_aiops/governance/paths.py +23 -0
- queue_aiops-0.1.0/queue_aiops/governance/patterns.py +378 -0
- queue_aiops-0.1.0/queue_aiops/governance/policy.py +430 -0
- queue_aiops-0.1.0/queue_aiops/governance/sanitize.py +45 -0
- queue_aiops-0.1.0/queue_aiops/governance/undo.py +218 -0
- queue_aiops-0.1.0/queue_aiops/ops/__init__.py +1 -0
- queue_aiops-0.1.0/queue_aiops/ops/_util.py +55 -0
- queue_aiops-0.1.0/queue_aiops/ops/analysis.py +591 -0
- queue_aiops-0.1.0/queue_aiops/ops/overview.py +90 -0
- queue_aiops-0.1.0/queue_aiops/ops/rabbit_reads.py +218 -0
- queue_aiops-0.1.0/queue_aiops/ops/redis_reads.py +237 -0
- queue_aiops-0.1.0/queue_aiops/ops/writes.py +284 -0
- queue_aiops-0.1.0/queue_aiops/platform.py +217 -0
- queue_aiops-0.1.0/queue_aiops/secretstore.py +304 -0
- queue_aiops-0.1.0/server.json +21 -0
- queue_aiops-0.1.0/skills/queue-aiops/SKILL.md +156 -0
- queue_aiops-0.1.0/skills/queue-aiops/references/capabilities.md +102 -0
- queue_aiops-0.1.0/skills/queue-aiops/references/cli-reference.md +77 -0
- queue_aiops-0.1.0/skills/queue-aiops/references/setup-guide.md +121 -0
- queue_aiops-0.1.0/smithery.yaml +9 -0
- queue_aiops-0.1.0/tests/conftest.py +34 -0
- queue_aiops-0.1.0/tests/fakes.py +152 -0
- queue_aiops-0.1.0/tests/test_analysis.py +202 -0
- queue_aiops-0.1.0/tests/test_cli_writes.py +132 -0
- queue_aiops-0.1.0/tests/test_doctor.py +212 -0
- queue_aiops-0.1.0/tests/test_governance_persistence.py +175 -0
- queue_aiops-0.1.0/tests/test_init.py +180 -0
- queue_aiops-0.1.0/tests/test_platform.py +112 -0
- queue_aiops-0.1.0/tests/test_reads.py +279 -0
- queue_aiops-0.1.0/tests/test_secretstore.py +99 -0
- queue_aiops-0.1.0/tests/test_smoke.py +155 -0
- queue_aiops-0.1.0/tests/test_undo_executor.py +138 -0
- queue_aiops-0.1.0/tests/test_writes.py +343 -0
- queue_aiops-0.1.0/uv.lock +1144 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
name: mcp-publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
release:
|
|
6
|
+
types: [published]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
id-token: write
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
publish-mcp:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- name: Wait for PyPI
|
|
18
|
+
# The release event also triggers the PyPI publish workflow; the MCP
|
|
19
|
+
# registry validates that the package version exists on PyPI, so poll
|
|
20
|
+
# until it has propagated (every 15s, up to 10 minutes).
|
|
21
|
+
run: |
|
|
22
|
+
python3 - <<'EOF'
|
|
23
|
+
import json
|
|
24
|
+
import sys
|
|
25
|
+
import time
|
|
26
|
+
import urllib.error
|
|
27
|
+
import urllib.request
|
|
28
|
+
|
|
29
|
+
with open("server.json", encoding="utf-8") as f:
|
|
30
|
+
package = json.load(f)["packages"][0]
|
|
31
|
+
name, version = package["identifier"], package["version"]
|
|
32
|
+
url = f"https://pypi.org/pypi/{name}/{version}/json"
|
|
33
|
+
deadline = time.monotonic() + 600
|
|
34
|
+
while True:
|
|
35
|
+
try:
|
|
36
|
+
with urllib.request.urlopen(url, timeout=10):
|
|
37
|
+
print(f"{name}=={version} is available on PyPI.")
|
|
38
|
+
sys.exit(0)
|
|
39
|
+
except (urllib.error.URLError, OSError) as exc:
|
|
40
|
+
print(f"{name}=={version} not on PyPI yet ({exc}); "
|
|
41
|
+
"retrying in 15s...")
|
|
42
|
+
if time.monotonic() >= deadline:
|
|
43
|
+
sys.exit(f"Timed out after 10 minutes waiting for "
|
|
44
|
+
f"{name}=={version} to appear on PyPI. "
|
|
45
|
+
"Check the PyPI publish workflow, then re-run "
|
|
46
|
+
"this workflow via workflow_dispatch.")
|
|
47
|
+
time.sleep(15)
|
|
48
|
+
EOF
|
|
49
|
+
- name: Install mcp-publisher
|
|
50
|
+
run: |
|
|
51
|
+
curl -sL "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
|
|
52
|
+
- name: Login to MCP Registry (GitHub OIDC)
|
|
53
|
+
run: ./mcp-publisher login github-oidc
|
|
54
|
+
- name: Publish server.json
|
|
55
|
+
run: ./mcp-publisher publish
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Trusted Publishing (OIDC) — publishes from GitHub's runners with no API token,
|
|
4
|
+
# sidestepping the local-IP / account new-project rate limit. Configure a matching
|
|
5
|
+
# "trusted publisher" for this package on PyPI (see the repo release notes).
|
|
6
|
+
on:
|
|
7
|
+
release:
|
|
8
|
+
types: [published]
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
publish:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
permissions:
|
|
18
|
+
id-token: write # required for PyPI Trusted Publishing (OIDC)
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
- name: Set up uv
|
|
22
|
+
uses: astral-sh/setup-uv@v5
|
|
23
|
+
- name: Build sdist + wheel
|
|
24
|
+
run: uv build
|
|
25
|
+
- name: Publish to PyPI (Trusted Publishing)
|
|
26
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## v0.1.0 — 2026-07-17
|
|
4
|
+
|
|
5
|
+
Initial preview release.
|
|
6
|
+
|
|
7
|
+
- **Platforms**: redis (RESP via the `redis` Python client; password optional,
|
|
8
|
+
TLS optional) and rabbitmq (management HTTP API, Basic auth) behind a
|
|
9
|
+
name-keyed platform registry; one config spans a mixed estate.
|
|
10
|
+
- **26 MCP tools** (19 reads, 7 governed writes), all wrapped by the bundled
|
|
11
|
+
governance harness (audit / budget / risk tiers / undo).
|
|
12
|
+
- **Flagship RCAs**: `redis_memory_pressure_rca` (maxmemory, eviction policy,
|
|
13
|
+
fragmentation, SCAN-budgeted big keys), `redis_latency_rca` (slowlog digest
|
|
14
|
+
by command pattern, blocked clients, fork/AOF stalls),
|
|
15
|
+
`rabbitmq_queue_backlog_rca` (zero/slow consumers, unacked pileups,
|
|
16
|
+
memory/disk watermark blocks), `connection_churn_analysis` (both platforms,
|
|
17
|
+
optional prior-snapshot deltas, clients by source).
|
|
18
|
+
- **Governed writes**: `redis_config_set` (undo = prior value from CONFIG GET),
|
|
19
|
+
`redis_kill_client` (priorState = client row, no undo), `purge_queue` (high;
|
|
20
|
+
priorState = message count, no undo), `delete_queue` (high; undo re-declares
|
|
21
|
+
the captured definition), `declare_queue`, `set_policy` / `delete_policy`
|
|
22
|
+
(undo = prior policy or delete-if-new). All take `dry_run`; CLI twins add
|
|
23
|
+
double-confirm.
|
|
24
|
+
- **Safety**: typed redis command allow-list (no generic passthrough; never
|
|
25
|
+
`KEYS *`), central percent-encoding of rabbitmq path segments (incl. the
|
|
26
|
+
default vhost `/`), encrypted secret store (Fernet + scrypt), secure-by-default
|
|
27
|
+
approver gate for high-risk writes.
|
|
28
|
+
- Preview / mock-only: exercised against mocked clients; not yet validated on
|
|
29
|
+
live production brokers.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 wei <zhouwei008@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: queue-aiops
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Governed AI-ops for redis + rabbitmq: memory-pressure/latency/queue-backlog/connection-churn RCAs, slowlog and SCAN-budgeted big-key sampling, queues/policies/nodes, and governed writes (config set, client kill, purge/delete queue, policies) with a built-in governance harness (audit, budget, undo, risk tiers)
|
|
5
|
+
Author-email: wei <zhouwei008@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
|
+
Requires-Dist: cryptography>=42.0
|
|
10
|
+
Requires-Dist: httpx<1.0,>=0.27
|
|
11
|
+
Requires-Dist: mcp[cli]<2.0,>=1.10
|
|
12
|
+
Requires-Dist: pyyaml<7.0,>=6.0
|
|
13
|
+
Requires-Dist: redis<7.0,>=5.0
|
|
14
|
+
Requires-Dist: rich<16.0,>=13.0
|
|
15
|
+
Requires-Dist: typer<1.0,>=0.12
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# Queue AIops (preview)
|
|
19
|
+
|
|
20
|
+
**Governed AI-ops for redis + rabbitmq.** queue-aiops is for the team running
|
|
21
|
+
their own cache and message broker — a redis that "suddenly eats memory", a
|
|
22
|
+
rabbitmq whose queues quietly grow until publishers block — without an
|
|
23
|
+
enterprise observability suite. It gives an AI agent (or a human at the CLI) a
|
|
24
|
+
governed toolset over both: transparent root-cause analyses for memory
|
|
25
|
+
pressure, latency, queue backlog, and connection churn, plus the handful of
|
|
26
|
+
writes an operator actually needs (config set, client kill, purge/delete
|
|
27
|
+
queue, policies) — every call audited, budgeted, risk-tiered, and undo-recorded
|
|
28
|
+
by the built-in governance harness.
|
|
29
|
+
|
|
30
|
+
> **Disclaimer**: Community-maintained open-source project, **not affiliated
|
|
31
|
+
> with, endorsed by, or sponsored by the Redis or RabbitMQ projects or their
|
|
32
|
+
> respective owners.** Redis and RabbitMQ are trademarks of their respective owners.
|
|
33
|
+
>
|
|
34
|
+
> **Preview / mock-only**: not yet validated against production brokers. Both
|
|
35
|
+
> redis and rabbitmq are free/self-hostable (one lab container or package install each), so a lab
|
|
36
|
+
> check is easy — `queue-aiops doctor` is the fastest live probe.
|
|
37
|
+
|
|
38
|
+
## Quick start
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
uv tool install queue-aiops
|
|
42
|
+
|
|
43
|
+
queue-aiops init # wizard: pick platform (redis/rabbitmq), host/port, encrypted secret
|
|
44
|
+
queue-aiops doctor # config + secret + connectivity check (PING / /api/overview)
|
|
45
|
+
queue-aiops overview # one-shot health summary for the default target
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Then the interesting parts:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
queue-aiops analyze memory # redis memory-pressure RCA (maxmemory, eviction, frag, big keys)
|
|
52
|
+
queue-aiops analyze latency # redis latency RCA (slowlog digest, fork/AOF stalls)
|
|
53
|
+
queue-aiops analyze backlog # rabbitmq queue-backlog RCA (consumers, unacked, watermarks)
|
|
54
|
+
queue-aiops analyze churn # connection churn, both platforms
|
|
55
|
+
queue-aiops redis bigkeys # SCAN-budgeted big-key sample (never KEYS *)
|
|
56
|
+
queue-aiops rabbitmq queues # deepest backlog first
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Support scope
|
|
60
|
+
|
|
61
|
+
| Platform | Protocol | Coverage |
|
|
62
|
+
|----------|----------|----------|
|
|
63
|
+
| **redis** (5.x–7.x wire protocol via `redis` Python client) | RESP, password optional, TLS optional | INFO (server/memory/clients/stats/persistence/keyspace), SLOWLOG, CLIENT LIST/KILL, CONFIG GET/SET, MEMORY STATS/USAGE, SCAN-budgeted big-key sampling, DBSIZE, PING |
|
|
64
|
+
| **rabbitmq** (management plugin HTTP API) | HTTP(S), Basic auth | /api/overview, /api/queues (+ per-vhost, detail, purge, declare, delete), /api/connections, /api/channels, /api/consumers, /api/policies (get/set/delete), /api/nodes |
|
|
65
|
+
|
|
66
|
+
**26 MCP tools** — 19 reads (incl. 4 flagship RCAs) + 7 governed writes.
|
|
67
|
+
|
|
68
|
+
| Group | Tools | R/W |
|
|
69
|
+
|-------|-------|:---:|
|
|
70
|
+
| Overview | queue_overview | read |
|
|
71
|
+
| redis reads | redis_server_info, redis_memory_stats, redis_clients, redis_slowlog, redis_config_get, redis_keyspace, redis_big_keys | read |
|
|
72
|
+
| rabbitmq reads | rabbitmq_overview, list_queues, queue_detail, list_connections, list_channels, list_policies, node_health | read |
|
|
73
|
+
| Flagship RCAs | redis_memory_pressure_rca, redis_latency_rca, rabbitmq_queue_backlog_rca, connection_churn_analysis | read |
|
|
74
|
+
| Writes (medium) | redis_config_set, redis_kill_client, declare_queue, set_policy, delete_policy | write |
|
|
75
|
+
| Writes (**high**) | purge_queue, delete_queue | write |
|
|
76
|
+
|
|
77
|
+
The four RCAs are transparent heuristics that report their numbers — thresholds
|
|
78
|
+
are named constants, every finding carries its evidence, never a black-box
|
|
79
|
+
verdict. Big-key sampling walks at most 10,000 keys with SCAN and sizes at most
|
|
80
|
+
200 with MEMORY USAGE — **never `KEYS *`** — and reports its coverage.
|
|
81
|
+
|
|
82
|
+
## Governance
|
|
83
|
+
|
|
84
|
+
Every MCP tool runs through the bundled `@governed_tool` harness
|
|
85
|
+
(`queue_aiops.governance` — no external dependency):
|
|
86
|
+
|
|
87
|
+
- **Audit** — every call lands in `~/.queue-aiops/audit.db` (relocatable via
|
|
88
|
+
`QUEUE_AIOPS_HOME`), secret-redacted.
|
|
89
|
+
- **Budget** — call/time ceilings (`QUEUE_MAX_TOOL_CALLS`,
|
|
90
|
+
`QUEUE_MAX_TOOL_SECONDS`) + a runaway-loop breaker.
|
|
91
|
+
- **Risk tiers & approval** — **secure by default**: with no
|
|
92
|
+
`~/.queue-aiops/rules.yaml`, high-risk writes (`purge_queue`,
|
|
93
|
+
`delete_queue`) are denied unless `QUEUE_AUDIT_APPROVED_BY` names an approver
|
|
94
|
+
(set `QUEUE_AUDIT_RATIONALE` too). `queue-aiops init` seeds a starter
|
|
95
|
+
rules.yaml with that dual-control tier; an operator-authored rules file is
|
|
96
|
+
honoured as-is.
|
|
97
|
+
- **Undo** — reversible writes capture the real before-state first:
|
|
98
|
+
`redis_config_set` records the prior value from CONFIG GET;
|
|
99
|
+
`set_policy`/`delete_policy` record the prior policy; `delete_queue` records
|
|
100
|
+
the queue's definition and its undo re-declares it (the **messages are not
|
|
101
|
+
restored** — the descriptor says so). Irreversible writes (`purge_queue`,
|
|
102
|
+
`redis_kill_client`) record priorState only.
|
|
103
|
+
- **Dry-run + double-confirm** — every write takes `dry_run=True` (MCP) /
|
|
104
|
+
`--dry-run` (CLI); CLI writes double-confirm and execute through the same
|
|
105
|
+
governed twins, so they land in the audit log too.
|
|
106
|
+
- Credentials live **encrypted** in `~/.queue-aiops/secrets.enc` (Fernet +
|
|
107
|
+
scrypt master password; `QUEUE_AIOPS_MASTER_PASSWORD` for non-interactive
|
|
108
|
+
use). Redis passwords are optional — an auth-less lab instance is a
|
|
109
|
+
supported target.
|
|
110
|
+
|
|
111
|
+
## MCP configuration
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{
|
|
115
|
+
"mcpServers": {
|
|
116
|
+
"queue-aiops": {
|
|
117
|
+
"command": "uvx",
|
|
118
|
+
"args": ["--from", "queue-aiops", "queue-aiops-mcp"],
|
|
119
|
+
"env": {
|
|
120
|
+
"QUEUE_AIOPS_MASTER_PASSWORD": "your-master-password"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
> **env-block caveat**: MCP clients launch the server with a *minimal*
|
|
128
|
+
> environment — your shell profile is not sourced. Anything the server needs
|
|
129
|
+
> (`QUEUE_AIOPS_MASTER_PASSWORD`, a relocated `QUEUE_AIOPS_HOME`,
|
|
130
|
+
> `QUEUE_AUDIT_APPROVED_BY` for high-risk writes) must be set in the `env`
|
|
131
|
+
> block above, not just in your terminal.
|
|
132
|
+
|
|
133
|
+
Or, with the package installed: `queue-aiops mcp`.
|
|
134
|
+
|
|
135
|
+
## CLI reference (short)
|
|
136
|
+
|
|
137
|
+
```text
|
|
138
|
+
queue-aiops init | doctor | overview | mcp
|
|
139
|
+
queue-aiops secret set|list|migrate ...
|
|
140
|
+
queue-aiops redis info|memory|clients|slowlog|config-get|keyspace|bigkeys
|
|
141
|
+
queue-aiops redis config-set <param> <value> [--dry-run]
|
|
142
|
+
queue-aiops redis kill-client --id <id> | --addr <ip:port> [--dry-run]
|
|
143
|
+
queue-aiops rabbitmq overview|queues|queue|connections|channels|policies|nodes
|
|
144
|
+
queue-aiops rabbitmq purge|delete-queue|declare-queue <name> [--vhost /] [--dry-run]
|
|
145
|
+
queue-aiops rabbitmq set-policy|delete-policy <name> ... [--dry-run]
|
|
146
|
+
queue-aiops analyze memory|latency|backlog|churn
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Verification status
|
|
150
|
+
|
|
151
|
+
Preview / mock-only: the full test suite runs against mocked clients (no live
|
|
152
|
+
broker needed), and the REST paths / INFO fields are modelled from the public
|
|
153
|
+
docs of both platforms. Not yet validated against live production brokers —
|
|
154
|
+
both are trivially self-hostable, so `queue-aiops doctor` against a
|
|
155
|
+
local lab redis instance / rabbitmq broker (management plugin enabled) is
|
|
156
|
+
the quickest live check.
|
|
157
|
+
|
|
158
|
+
## Contributing
|
|
159
|
+
|
|
160
|
+
缺功能提 issue/PR 欢迎留言 — missing a read you need (streams/consumer groups,
|
|
161
|
+
quorum-queue specifics, shovel/federation status), another broker platform, or
|
|
162
|
+
a threshold that doesn't fit your fleet? Open an issue or PR at
|
|
163
|
+
[github.com/AIops-tools/Queue-AIops](https://github.com/AIops-tools/Queue-AIops)
|
|
164
|
+
— platform registry entries are additive and small.
|
|
165
|
+
|
|
166
|
+
## License
|
|
167
|
+
|
|
168
|
+
MIT
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Queue AIops (preview)
|
|
2
|
+
|
|
3
|
+
**Governed AI-ops for redis + rabbitmq.** queue-aiops is for the team running
|
|
4
|
+
their own cache and message broker — a redis that "suddenly eats memory", a
|
|
5
|
+
rabbitmq whose queues quietly grow until publishers block — without an
|
|
6
|
+
enterprise observability suite. It gives an AI agent (or a human at the CLI) a
|
|
7
|
+
governed toolset over both: transparent root-cause analyses for memory
|
|
8
|
+
pressure, latency, queue backlog, and connection churn, plus the handful of
|
|
9
|
+
writes an operator actually needs (config set, client kill, purge/delete
|
|
10
|
+
queue, policies) — every call audited, budgeted, risk-tiered, and undo-recorded
|
|
11
|
+
by the built-in governance harness.
|
|
12
|
+
|
|
13
|
+
> **Disclaimer**: Community-maintained open-source project, **not affiliated
|
|
14
|
+
> with, endorsed by, or sponsored by the Redis or RabbitMQ projects or their
|
|
15
|
+
> respective owners.** Redis and RabbitMQ are trademarks of their respective owners.
|
|
16
|
+
>
|
|
17
|
+
> **Preview / mock-only**: not yet validated against production brokers. Both
|
|
18
|
+
> redis and rabbitmq are free/self-hostable (one lab container or package install each), so a lab
|
|
19
|
+
> check is easy — `queue-aiops doctor` is the fastest live probe.
|
|
20
|
+
|
|
21
|
+
## Quick start
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
uv tool install queue-aiops
|
|
25
|
+
|
|
26
|
+
queue-aiops init # wizard: pick platform (redis/rabbitmq), host/port, encrypted secret
|
|
27
|
+
queue-aiops doctor # config + secret + connectivity check (PING / /api/overview)
|
|
28
|
+
queue-aiops overview # one-shot health summary for the default target
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Then the interesting parts:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
queue-aiops analyze memory # redis memory-pressure RCA (maxmemory, eviction, frag, big keys)
|
|
35
|
+
queue-aiops analyze latency # redis latency RCA (slowlog digest, fork/AOF stalls)
|
|
36
|
+
queue-aiops analyze backlog # rabbitmq queue-backlog RCA (consumers, unacked, watermarks)
|
|
37
|
+
queue-aiops analyze churn # connection churn, both platforms
|
|
38
|
+
queue-aiops redis bigkeys # SCAN-budgeted big-key sample (never KEYS *)
|
|
39
|
+
queue-aiops rabbitmq queues # deepest backlog first
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Support scope
|
|
43
|
+
|
|
44
|
+
| Platform | Protocol | Coverage |
|
|
45
|
+
|----------|----------|----------|
|
|
46
|
+
| **redis** (5.x–7.x wire protocol via `redis` Python client) | RESP, password optional, TLS optional | INFO (server/memory/clients/stats/persistence/keyspace), SLOWLOG, CLIENT LIST/KILL, CONFIG GET/SET, MEMORY STATS/USAGE, SCAN-budgeted big-key sampling, DBSIZE, PING |
|
|
47
|
+
| **rabbitmq** (management plugin HTTP API) | HTTP(S), Basic auth | /api/overview, /api/queues (+ per-vhost, detail, purge, declare, delete), /api/connections, /api/channels, /api/consumers, /api/policies (get/set/delete), /api/nodes |
|
|
48
|
+
|
|
49
|
+
**26 MCP tools** — 19 reads (incl. 4 flagship RCAs) + 7 governed writes.
|
|
50
|
+
|
|
51
|
+
| Group | Tools | R/W |
|
|
52
|
+
|-------|-------|:---:|
|
|
53
|
+
| Overview | queue_overview | read |
|
|
54
|
+
| redis reads | redis_server_info, redis_memory_stats, redis_clients, redis_slowlog, redis_config_get, redis_keyspace, redis_big_keys | read |
|
|
55
|
+
| rabbitmq reads | rabbitmq_overview, list_queues, queue_detail, list_connections, list_channels, list_policies, node_health | read |
|
|
56
|
+
| Flagship RCAs | redis_memory_pressure_rca, redis_latency_rca, rabbitmq_queue_backlog_rca, connection_churn_analysis | read |
|
|
57
|
+
| Writes (medium) | redis_config_set, redis_kill_client, declare_queue, set_policy, delete_policy | write |
|
|
58
|
+
| Writes (**high**) | purge_queue, delete_queue | write |
|
|
59
|
+
|
|
60
|
+
The four RCAs are transparent heuristics that report their numbers — thresholds
|
|
61
|
+
are named constants, every finding carries its evidence, never a black-box
|
|
62
|
+
verdict. Big-key sampling walks at most 10,000 keys with SCAN and sizes at most
|
|
63
|
+
200 with MEMORY USAGE — **never `KEYS *`** — and reports its coverage.
|
|
64
|
+
|
|
65
|
+
## Governance
|
|
66
|
+
|
|
67
|
+
Every MCP tool runs through the bundled `@governed_tool` harness
|
|
68
|
+
(`queue_aiops.governance` — no external dependency):
|
|
69
|
+
|
|
70
|
+
- **Audit** — every call lands in `~/.queue-aiops/audit.db` (relocatable via
|
|
71
|
+
`QUEUE_AIOPS_HOME`), secret-redacted.
|
|
72
|
+
- **Budget** — call/time ceilings (`QUEUE_MAX_TOOL_CALLS`,
|
|
73
|
+
`QUEUE_MAX_TOOL_SECONDS`) + a runaway-loop breaker.
|
|
74
|
+
- **Risk tiers & approval** — **secure by default**: with no
|
|
75
|
+
`~/.queue-aiops/rules.yaml`, high-risk writes (`purge_queue`,
|
|
76
|
+
`delete_queue`) are denied unless `QUEUE_AUDIT_APPROVED_BY` names an approver
|
|
77
|
+
(set `QUEUE_AUDIT_RATIONALE` too). `queue-aiops init` seeds a starter
|
|
78
|
+
rules.yaml with that dual-control tier; an operator-authored rules file is
|
|
79
|
+
honoured as-is.
|
|
80
|
+
- **Undo** — reversible writes capture the real before-state first:
|
|
81
|
+
`redis_config_set` records the prior value from CONFIG GET;
|
|
82
|
+
`set_policy`/`delete_policy` record the prior policy; `delete_queue` records
|
|
83
|
+
the queue's definition and its undo re-declares it (the **messages are not
|
|
84
|
+
restored** — the descriptor says so). Irreversible writes (`purge_queue`,
|
|
85
|
+
`redis_kill_client`) record priorState only.
|
|
86
|
+
- **Dry-run + double-confirm** — every write takes `dry_run=True` (MCP) /
|
|
87
|
+
`--dry-run` (CLI); CLI writes double-confirm and execute through the same
|
|
88
|
+
governed twins, so they land in the audit log too.
|
|
89
|
+
- Credentials live **encrypted** in `~/.queue-aiops/secrets.enc` (Fernet +
|
|
90
|
+
scrypt master password; `QUEUE_AIOPS_MASTER_PASSWORD` for non-interactive
|
|
91
|
+
use). Redis passwords are optional — an auth-less lab instance is a
|
|
92
|
+
supported target.
|
|
93
|
+
|
|
94
|
+
## MCP configuration
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"mcpServers": {
|
|
99
|
+
"queue-aiops": {
|
|
100
|
+
"command": "uvx",
|
|
101
|
+
"args": ["--from", "queue-aiops", "queue-aiops-mcp"],
|
|
102
|
+
"env": {
|
|
103
|
+
"QUEUE_AIOPS_MASTER_PASSWORD": "your-master-password"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
> **env-block caveat**: MCP clients launch the server with a *minimal*
|
|
111
|
+
> environment — your shell profile is not sourced. Anything the server needs
|
|
112
|
+
> (`QUEUE_AIOPS_MASTER_PASSWORD`, a relocated `QUEUE_AIOPS_HOME`,
|
|
113
|
+
> `QUEUE_AUDIT_APPROVED_BY` for high-risk writes) must be set in the `env`
|
|
114
|
+
> block above, not just in your terminal.
|
|
115
|
+
|
|
116
|
+
Or, with the package installed: `queue-aiops mcp`.
|
|
117
|
+
|
|
118
|
+
## CLI reference (short)
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
queue-aiops init | doctor | overview | mcp
|
|
122
|
+
queue-aiops secret set|list|migrate ...
|
|
123
|
+
queue-aiops redis info|memory|clients|slowlog|config-get|keyspace|bigkeys
|
|
124
|
+
queue-aiops redis config-set <param> <value> [--dry-run]
|
|
125
|
+
queue-aiops redis kill-client --id <id> | --addr <ip:port> [--dry-run]
|
|
126
|
+
queue-aiops rabbitmq overview|queues|queue|connections|channels|policies|nodes
|
|
127
|
+
queue-aiops rabbitmq purge|delete-queue|declare-queue <name> [--vhost /] [--dry-run]
|
|
128
|
+
queue-aiops rabbitmq set-policy|delete-policy <name> ... [--dry-run]
|
|
129
|
+
queue-aiops analyze memory|latency|backlog|churn
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Verification status
|
|
133
|
+
|
|
134
|
+
Preview / mock-only: the full test suite runs against mocked clients (no live
|
|
135
|
+
broker needed), and the REST paths / INFO fields are modelled from the public
|
|
136
|
+
docs of both platforms. Not yet validated against live production brokers —
|
|
137
|
+
both are trivially self-hostable, so `queue-aiops doctor` against a
|
|
138
|
+
local lab redis instance / rabbitmq broker (management plugin enabled) is
|
|
139
|
+
the quickest live check.
|
|
140
|
+
|
|
141
|
+
## Contributing
|
|
142
|
+
|
|
143
|
+
缺功能提 issue/PR 欢迎留言 — missing a read you need (streams/consumer groups,
|
|
144
|
+
quorum-queue specifics, shovel/federation status), another broker platform, or
|
|
145
|
+
a threshold that doesn't fit your fleet? Open an issue or PR at
|
|
146
|
+
[github.com/AIops-tools/Queue-AIops](https://github.com/AIops-tools/Queue-AIops)
|
|
147
|
+
— platform registry entries are additive and small.
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
MIT
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# queue-aiops v0.1.0 — 2026-07-17
|
|
2
|
+
|
|
3
|
+
First preview release: governed AI-ops for **redis + rabbitmq**.
|
|
4
|
+
|
|
5
|
+
## Highlights
|
|
6
|
+
|
|
7
|
+
- **Two platforms, one toolset**: a per-target `platform` field selects the
|
|
8
|
+
protocol shape — redis over the RESP client (password optional, TLS
|
|
9
|
+
optional), rabbitmq over the management HTTP API (Basic auth). The platform
|
|
10
|
+
registry makes further brokers additive.
|
|
11
|
+
- **Four flagship RCAs** — transparent heuristics that show their numbers:
|
|
12
|
+
- `redis_memory_pressure_rca` — used vs maxmemory + eviction policy,
|
|
13
|
+
evicted-keys pressure, fragmentation/swap signals, big-key sample.
|
|
14
|
+
- `redis_latency_rca` — SLOWLOG digested by command pattern (O(N) commands
|
|
15
|
+
flagged), blocked clients, fork/AOF-fsync stalls from INFO persistence.
|
|
16
|
+
- `rabbitmq_queue_backlog_rca` — per-queue cause (no consumers / unacked
|
|
17
|
+
pileup / publish outpacing delivery) + global watermark-alarm findings.
|
|
18
|
+
- `connection_churn_analysis` — both platforms; counts vs an optional prior
|
|
19
|
+
snapshot, clients grouped by source.
|
|
20
|
+
- **Governed writes with honest undo**: config set (prior value captured),
|
|
21
|
+
policies (prior policy captured; delete-if-new), delete_queue (undo
|
|
22
|
+
re-declares the captured definition — messages are not restored, and the
|
|
23
|
+
descriptor says so), purge/kill record priorState only.
|
|
24
|
+
- **Safety rails**: SCAN-budgeted big-key sampling (never `KEYS *`), typed
|
|
25
|
+
redis command allow-list, centrally percent-encoded rabbitmq paths (default
|
|
26
|
+
vhost `/` included), encrypted secret store, secure-by-default approver gate
|
|
27
|
+
on high-risk writes, dry-run everywhere.
|
|
28
|
+
|
|
29
|
+
## Known limits (preview)
|
|
30
|
+
|
|
31
|
+
- Mock-validated only; not yet run against live production brokers.
|
|
32
|
+
- redis cluster-wide topology reads and rabbitmq shovel/federation status are
|
|
33
|
+
out of scope for v0.1 — issues/PRs welcome.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Disclaimer
|
|
4
|
+
|
|
5
|
+
Community-maintained open-source project. **Not affiliated with, endorsed by, or
|
|
6
|
+
sponsored by the Redis or RabbitMQ projects or their respective owners.** Product and
|
|
7
|
+
trademark names (Redis, RabbitMQ) belong to their owners. Source is auditable
|
|
8
|
+
under the MIT license.
|
|
9
|
+
|
|
10
|
+
## Reporting Vulnerabilities
|
|
11
|
+
|
|
12
|
+
Report privately via a GitHub Security Advisory on
|
|
13
|
+
[github.com/AIops-tools/Queue-AIops](https://github.com/AIops-tools/Queue-AIops/security/advisories)
|
|
14
|
+
or email zhouwei008@gmail.com. Please do not open public issues for security
|
|
15
|
+
reports.
|
|
16
|
+
|
|
17
|
+
## Security Design
|
|
18
|
+
|
|
19
|
+
### Credential Management
|
|
20
|
+
- Per-target secrets — the redis **password** (optional; auth-less lab
|
|
21
|
+
instances are a supported setup) or the rabbitmq management user's
|
|
22
|
+
**password** (paired with `username` for HTTP Basic auth) — live
|
|
23
|
+
**encrypted** in `~/.queue-aiops/secrets.enc` (Fernet/AES-128 +
|
|
24
|
+
scrypt-derived key; chmod 600), never in `config.yaml` and never in source.
|
|
25
|
+
The master password is never stored — only a per-store random salt and the
|
|
26
|
+
ciphertext are on disk.
|
|
27
|
+
- A legacy plaintext env var `QUEUE_<TARGET_NAME_UPPER>_SECRET` is still
|
|
28
|
+
honoured as a fallback with a deprecation warning (migrate with
|
|
29
|
+
`queue-aiops secret migrate`).
|
|
30
|
+
- The secret is held only in memory and never logged or echoed. It is presented
|
|
31
|
+
as `AUTH` at connect time (redis) or HTTP Basic auth (rabbitmq management
|
|
32
|
+
API); the config file holds only platform, host, port, username, db, and TLS
|
|
33
|
+
settings.
|
|
34
|
+
|
|
35
|
+
### Governed Operations
|
|
36
|
+
Every MCP tool runs through the bundled `@governed_tool` harness
|
|
37
|
+
(`queue_aiops.governance`):
|
|
38
|
+
- **Audit** — every call logged to a local SQLite DB under `~/.queue-aiops/`
|
|
39
|
+
(relocatable via `QUEUE_AIOPS_HOME`), agent-attributed, secret-redacted.
|
|
40
|
+
- **Token/runaway budget** — hard ceilings (`QUEUE_MAX_TOOL_CALLS` /
|
|
41
|
+
`QUEUE_MAX_TOOL_SECONDS`) plus an on-by-default guard that trips a tight
|
|
42
|
+
poll/retry loop, preventing unbounded API consumption.
|
|
43
|
+
- **Graduated risk tiers** — `~/.queue-aiops/rules.yaml` `risk_tiers` gate
|
|
44
|
+
writes by environment/tag; the highest tiers require a recorded approver.
|
|
45
|
+
- **Undo-token recording** — reversible writes capture the BEFORE state (via a
|
|
46
|
+
real read) and record an inverse descriptor (e.g. `redis_config_set` restores
|
|
47
|
+
the prior value from CONFIG GET; `delete_queue` re-declares the captured
|
|
48
|
+
queue definition; `set_policy`/`delete_policy` restore the prior policy) so
|
|
49
|
+
the change can be rolled back.
|
|
50
|
+
|
|
51
|
+
### State-Changing Operations
|
|
52
|
+
The destructive writes — `purge_queue` and `delete_queue` — are
|
|
53
|
+
`risk_level=high`, accept a `dry_run` preview, and (under `risk_tiers`) require
|
|
54
|
+
a recorded approver (`QUEUE_AUDIT_APPROVED_BY` + `QUEUE_AUDIT_RATIONALE`).
|
|
55
|
+
Purged/deleted **messages cannot be restored** — `purge_queue` records the
|
|
56
|
+
prior message count as audit evidence (no undo) and `delete_queue`'s undo
|
|
57
|
+
restores the queue *definition* only. `redis_config_set`, `redis_kill_client`
|
|
58
|
+
(priorState = the client's CLIENT LIST row; no undo), `declare_queue`,
|
|
59
|
+
`set_policy`, and `delete_policy` are `risk_level=medium`; reversible ones
|
|
60
|
+
capture before-state and record an undo token.
|
|
61
|
+
|
|
62
|
+
### Command Surface (redis)
|
|
63
|
+
The connection layer exposes a **typed allow-list of commands only** (INFO,
|
|
64
|
+
SLOWLOG, CLIENT LIST/KILL, CONFIG GET/SET, MEMORY STATS/USAGE, SCAN, DBSIZE,
|
|
65
|
+
PING) — there is no generic "run any command" passthrough, and big-key
|
|
66
|
+
sampling is SCAN-based under a hard budget (never `KEYS *`). `CONFIG SET`
|
|
67
|
+
parameter names are validated against a strict pattern before reaching the
|
|
68
|
+
wire.
|
|
69
|
+
|
|
70
|
+
### SSL/TLS Verification
|
|
71
|
+
`verify_ssl` defaults to true when TLS is enabled; disable only for self-signed
|
|
72
|
+
lab certificates.
|
|
73
|
+
|
|
74
|
+
### Prompt-Injection Protection
|
|
75
|
+
All broker-returned text (key names, client addresses, slowlog commands, queue
|
|
76
|
+
and policy names, node names) is passed through a `sanitize()` truncate +
|
|
77
|
+
control-character strip before reaching the agent. RabbitMQ path segments —
|
|
78
|
+
including the default vhost `/` — are percent-encoded centrally so an
|
|
79
|
+
agent-supplied name can never rewrite a request path.
|
|
80
|
+
|
|
81
|
+
### Network Scope
|
|
82
|
+
No webhooks, no telemetry, no outbound calls beyond the configured redis
|
|
83
|
+
instances and rabbitmq management API endpoints. No post-install scripts or
|
|
84
|
+
background services.
|
|
85
|
+
|
|
86
|
+
## Static Analysis
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
uvx bandit -r queue_aiops/ mcp_server/
|
|
90
|
+
uv run ruff check .
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Supported Versions
|
|
94
|
+
|
|
95
|
+
The latest released version receives security fixes. This is a preview (0.x);
|
|
96
|
+
pin a version in production.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""MCP server package for queue-aiops."""
|