feat(mcp): analytics MCP tools#331
Conversation
f8890e3 to
ade4490
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit ade4490. Configure here.
ade4490 to
e8368e1
Compare
jamby77
left a comment
There was a problem hiding this comment.
One more from the stack review, on reuse.
e8368e1 to
839748d
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
4 issues from previous reviews remain unresolved.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit a36c4cd. Configure here.
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit a36c4cd. Configure here.
|
bugbot run |
a36c4cd to
f4daf18
Compare
|
bugbot run |
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
1 issue from previous review remains unresolved.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 6946a7c. Configure here.
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit dee1143. Configure here.
dee1143 to
c77f3ae
Compare
|
bugbot run |
|
bugbot run |
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 6736dbf. Configure here.

Adds three read-only analytics MCP tools:
get_forecast— capacity forecast per metric kind (opsPerSec, usedMemory, cpuTotal, memFragmentation)get_latency_regressions— persisted p99 latency-regression events (companion toget_anomalies, same store pre-filtered tocommand_p99), with a graceful note when BetterDB Pro is absentget_largest_keys— largest keys by memory from key-analytics snapshots (companion toget_hot_keys), license-gatedServer side: new community
McpAnalyticsController(forecast + latency regressions, optional anomaly-service injection) and a proprietaryMcpKeyAnalyticsControllermirroring the cache-proposals MCP controller so thekeyAnalyticslicense gate (402) actually runs; bundle-absent installs get a friendly client-side message instead of a raw 404.Stacked on #330. Part of #329.
🤖 Generated with Claude Code
https://claude.ai/code/session_01BeJC3cWSEXFGD7MLMXaCiH
Note
Medium Risk
Changes MCP route ownership and license gating for anomalies/largest-keys, and alters anomaly and largest-key query semantics—worth validating against community vs Pro installs and existing MCP clients.
Overview
Adds read-only MCP analytics tools (
get_forecast,get_latency_regressions,get_largest_keys) backed by new HTTP routes, and improves how missing Pro features show up in the client.API / modules: Community
McpAnalyticsControllerexposesGET …/forecast/:metricKindviaMetricForecastingModule. Anomalies and largest-keys MCP endpoints move out of the monolithicMcpControllerinto proprietaryMcpAnomalyController(anomaly detection license +metricTypevalidation) andMcpKeyAnalyticsController(keyAnalyticslicense).createAgentTokenProviderscentralizes cloud-mode agent token wiring across MCP-related modules;McpModuledrops optional anomaly module import from the core controller.Data behavior:
getLargestKeysnow ranks bymemoryBytes(with multi-snapshot dedupe and a higher storage fetch cap before applying limit).AnomalyService.getRecentAnomaliesunions persisted events with the in-memory cache for recent windows so storage-only events (e.g.command_p99) and cache-only failures both appear.MCP client: HTTP errors carry status via
ApiHttpError; 404 on gated/missing routes returns friendlyunavailableResulttext instead of a raw failure (anomalies, forecast, largest keys).UI: Key Analytics “Largest Keys” copy clarifies memory-based ranking and tracking limits.
Reviewed by Cursor Bugbot for commit 6736dbf. Bugbot is set up for automated code reviews on this repo. Configure here.