
BetterDB MCP Server: Ask Your Assistant About Your Valkey and Redis Databases
Lets Claude, Cursor and other assistants check the health, slow commands and hot keys of your Valkey and Redis databases through BetterDB.
This is the MCP server of BetterDB, a monitoring tool for Valkey and Redis, and it only works with a BetterDB instance. That can be BetterDB Cloud, a self-hosted monitor, or one the MCP server starts for you on your computer.
Most tools only read monitoring data. A few can add or remove connections, apply cache changes and delete stored memories, and they act with the sign-in of the token you give. Leave the token out on a self-hosted monitor to stay on read tools.
Good for
- Engineers who run Valkey or Redis and want answers about slow commands and memory in chat
- On-call teams investigating an incident from stored history
- Teams with AI semantic caches or agent memory on Valkey who tune them with BetterDB
Works in
12 should work
Tap an app to see how to set it up and any known problems.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Supports local MCP servers.
Client does not support this transport.
Client does not support this transport.
Install BetterDB MCP
Claude Code
- 1
Copy this prompt.
Add the BetterDB MCP server to Claude Code. Run this command: claude mcp add betterdb -e BETTERDB_URL=<BETTERDB_URL> -- npx -y @betterdb/mcp Ask me for BETTERDB_URL and only put the values in that config, nowhere else. Then check that it loaded and tell me if I need to sign in or restart.
- 2
Paste it into Claude Code. It shows the change and asks before running it.
Requires Node.js.
Built from the package data we hold. Not yet tested by us.
Tools
Lists the Valkey/Redis servers BetterDB watches
Shows every database registered in BetterDB with its connection status and capabilities. It is how the assistant finds the instance to look at.
Try: “Which Valkey instances does BetterDB monitor, and are they connected?”
Read ·
list_instancesChooses which instance later calls use
Sets the active instance for the session so the other tools do not need an instance id each time. It changes only the assistant's own selection.
Try: “Switch to my production Valkey instance.”
Read ·
select_instanceRegisters a new database in BetterDB
Sends a host, port, username and password for a Valkey or Redis server to BetterDB so it starts monitoring it, and can make it the default. The password passes through the chat.
Try: “Add my staging Valkey at cache.internal:6379 and make it the default.”
Write ·
add_connectionChecks database credentials without saving them
Tries to connect to a Valkey or Redis server with the details you give and reports whether it worked. Nothing is stored.
Try: “Test whether I can connect to cache.internal on port 6379.”
Network ·
test_connectionRemoves a database from BetterDB
Deletes a registered connection from BetterDB so it is no longer monitored. It does not delete data on the database itself.
Try: “Remove the old staging connection from BetterDB.”
Delete ·
remove_connectionSets the default database
Marks one registered connection as the default that BetterDB uses when no instance is named.
Try: “Make the production connection the default.”
Write ·
set_default_connectionReads the full INFO stats
Returns the INFO output for the active instance: memory, clients, replication, keyspace, hit rate and ops per second. You can limit it to one section such as memory or stats.
Try: “Show me the memory section of INFO for my cache.”
Read ·
get_infoLists the latest slow commands
Reads the most recent entries from the live slowlog, the commands that took longer than the server's slow threshold.
Try: “What were the last 20 slow commands?”
Read ·
get_slowlogLists recent COMMANDLOG entries
Reads the newest COMMANDLOG entries, which also cover large requests and replies. Works on Valkey 8 and later only.
Try: “Show recent COMMANDLOG entries for large replies.”
Read ·
get_commandlogReads latency event history
Returns the server's recorded latency events so you can see which kinds of delay happened and when.
Try: “Has my server logged any latency events?”
Read ·
get_latencyRuns a memory diagnosis
Returns the MEMORY DOCTOR verdict and the MEMORY STATS breakdown for the active instance.
Try: “Is there a memory problem on this instance?”
Read ·
get_memoryLists connected clients
Returns the active client list with connection details such as address, age and last command.
Try: “Which clients are connected right now?”
Read ·
get_clientsGives a one-call health summary
Summarizes keyspace hit rate, memory fragmentation, connected clients, replication lag on replicas and keyspace size. Its description tells the assistant to call it first in any investigation.
Try: “How healthy is my production Valkey?”
Read ·
get_healthGroups slow commands into patterns
Reads stored slowlog data and groups commands by normalized pattern, with how often each ran and the average time. The history survives the server's own slowlog rotation.
Try: “Which command patterns are slowest over the past day?”
Read ·
get_slowlog_patternsReads stored COMMANDLOG entries
Returns persisted COMMANDLOG entries and lets you filter by time range to look into a specific incident. Valkey 8 and later only.
Try: “Show COMMANDLOG entries between 14:00 and 15:00 yesterday.”
Read ·
get_commandlog_historyGroups COMMANDLOG entries into patterns
Like the slowlog patterns tool, but it also includes large-request and large-reply patterns. Valkey 8 and later only.
Try: “Which commands send the largest replies?”
Read ·
get_commandlog_patternsLists detected anomalies
Returns events that BetterDB's Z-score checks flagged on memory, hit rate, CPU and other metrics. Needs a BetterDB license tier that includes it.
Try: “Were there any anomalies in the last 24 hours?”
Read ·
get_anomaliesShows client activity over time
Returns time-bucketed snapshots of connection counts, command mix and buffer use, with start and end times to focus on one window.
Try: “How did client connections change during last night's incident?”
Read ·
get_client_activityFinds the busiest keys
Returns hot keys from stored scans, using LFU frequency scores when the eviction policy is an LFU one, or idle time and COMMANDLOG data otherwise.
Try: “Are any hot keys causing uneven load?”
Read ·
get_hot_keysLists cluster nodes
Finds every node in a Valkey cluster with its role, address, health and slot ranges. Returns a message if the instance is not a cluster.
Try: “List the nodes in my cluster and their slot ranges.”
Read ·
get_cluster_nodesCompares node performance
Returns memory, ops per second, clients, replication offset and CPU for each cluster node, to spot hot nodes or lagging replicas.
Try: “Which cluster node has the highest memory usage?”
Read ·
get_cluster_node_statsMerges slowlogs across the cluster
Combines the slowlogs of all nodes into one list, because a single node's slowlog misses the rest of the cluster.
Try: “Show the slowest commands across the whole cluster.”
Read ·
get_cluster_slowlogShows per-slot key counts and CPU
Returns key counts and CPU time per hash slot, ordered by either one. Valkey 8.0 and later only.
Try: “Which slots use the most CPU?”
Read ·
get_slot_statsShows one latency event over time
Returns the full history of one named latency event such as command or fast-command. Run the latency tool first to see the event names.
Try: “Show the history of the fast-command latency event.”
Read ·
get_latency_historyReads the ACL audit log
Returns stored ACL audit entries that you can filter by user, reason (auth, command, key, channel) or time, to see why a connection fails.
Try: “Show failed authentication attempts from the last hour.”
Read ·
get_acl_auditStarts a local BetterDB monitor
Starts BetterDB Monitor as a background process on your computer by running the @betterdb/monitor package with npx, then points the MCP server at it. It keeps running until stop_monitor.
Try: “Start a local BetterDB monitor on port 3001.”
Runs code ·
start_monitorStops the background monitor
Stops a monitor that was started by start_monitor or by the autostart option.
Try: “Stop the local BetterDB monitor.”
Runs code ·
stop_monitorLists registered caches
Lists the semantic caches and agent caches registered on the active instance, with hit rate and total operations.
Try: “Which AI caches are on this instance and how are they doing?”
Read ·
cache_listReports one cache's health
Gives detailed health for one cache. For a semantic cache it breaks results down by category, and for an agent cache by tool.
Try: “How healthy is the faq-cache?”
Read ·
cache_healthSuggests a similarity threshold
Looks at the rolling window of similarity scores for a semantic cache and recommends a threshold. It returns an error for agent caches.
Try: “What similarity threshold should faq-cache use?”
Read ·
cache_threshold_recommendationRates each tool's caching
Shows hit rate, cost saved and a TTL recommendation for each tool in an agent cache. It returns an error for semantic caches.
Try: “Why is the weather_lookup tool's hit rate so low?”
Read ·
cache_tool_effectivenessShows similarity scores as a histogram
Returns 20 buckets of width 0.1 for recent similarity scores in a semantic cache.
Try: “Show the similarity score distribution for faq-cache.”
Read ·
cache_similarity_distributionLists recent change proposals for a cache
Shows the latest proposals for one cache, in any status, so the assistant does not propose something already pending or applied.
Try: “What changes were recently proposed for faq-cache?”
Read ·
cache_recent_changesProposes a new similarity threshold
Creates a pending proposal to change a semantic cache's threshold, globally or per category. It needs a reason of at least 20 characters and waits for approval.
Try: “Propose lowering the faq-cache threshold and explain why.”
Write ·
cache_propose_threshold_adjustProposes a new TTL for a tool
Creates a pending proposal to change one tool's time to live in an agent cache. It needs a reason of at least 20 characters.
Try: “Propose a longer TTL for the weather_lookup tool.”
Write ·
cache_propose_tool_ttl_adjustProposes clearing cache entries
Creates a pending proposal to invalidate entries, by search filter for semantic caches or by tool, key prefix or session for agent caches. It warns when more than 10,000 entries would be affected.
Try: “Propose invalidating all cached entries for the session abc123.”
Write ·
cache_propose_invalidateLists proposals waiting for approval
Shows pending cache proposals on the active instance, newest first, optionally for one cache.
Try: “What cache proposals are waiting for review?”
Read ·
cache_list_pending_proposalsReads one proposal and its history
Returns a single proposal by id with its audit trail.
Try: “Show proposal prop_123 and who touched it.”
Read ·
cache_get_proposalApproves a proposal and applies it
Approves a pending proposal and applies the change to Valkey right away: a new threshold, a new TTL or an invalidation that removes cache entries. Calling it again on an applied proposal returns the earlier result.
Try: “Approve proposal prop_123.”
Delete ·
cache_approve_proposalRejects a pending proposal
Marks a pending proposal as rejected and can record a reason in the audit trail. Nothing is changed in Valkey.
Try: “Reject proposal prop_123 because the TTL is too short.”
Write ·
cache_reject_proposalEdits a proposal and approves it
Changes the threshold or TTL of a pending proposal and approves it in one step, which applies it to Valkey. Invalidate proposals cannot be edited.
Try: “Set the threshold in prop_123 to 0.12 and approve it.”
Write ·
cache_edit_and_approve_proposalLists agent-memory stores
Shows the agent-memory stores found on an instance, with their names and capabilities.
Try: “Which agent memory stores exist on this instance?”
Read ·
memory_storesLists memories in a store
Returns memories from a store, newest first, filtered by scope or tags.
Try: “Show the 20 newest memories in the support-agent store.”
Read ·
memory_listReads one memory
Fetches a single memory from a store by its id.
Try: “Show memory mem_42 from the support-agent store.”
Read ·
memory_getShows a memory store's size
Returns the item count, eviction count and live configuration of a memory store.
Try: “How many memories does the support-agent store hold?”
Read ·
memory_statsFinds memories similar to a vector
Searches a store for memories near an embedding you supply, with a result limit and a maximum distance.
Try: “Recall the 5 closest memories to this embedding.”
Read ·
memory_recallProposes deleting memories
Creates a pending proposal to forget one memory or a scope or tag group. Nothing is deleted until someone approves it.
Try: “Propose forgetting all memories tagged outdated.”
Write ·
memory_forgetLists delete proposals waiting
Shows pending forget proposals, optionally for one store.
Try: “Which forget proposals are pending?”
Read ·
memory_list_pending_forgetsApproves a delete and applies it
Approves a pending forget proposal and deletes the memories from the live store.
Try: “Approve forget proposal fp_7.”
Delete ·
memory_approve_forgetRejects a delete proposal
Rejects a pending forget proposal so nothing is deleted.
Try: “Reject forget proposal fp_7.”
Write ·
memory_reject_forgetLists AI components found on the database
Shows semantic caches, agent caches, memory stores and retrieval pipelines BetterDB found, with liveness and the latest metrics.
Try: “Which AI components are running on this Valkey?”
Read ·
ai_list_instancesShows an AI component's metrics over time
Returns stored time series for one component: hits, misses, hit rate, cost saved, evictions, item count, index size and threshold.
Try: “Plot the hit rate history of faq-cache this week.”
Read ·
ai_instance_historyLists recent AI traces
Lists traces ingested through OpenTelemetry, covering LLM calls, cache lookups, memory recalls and retrieval spans. They come from your instrumented apps, not one database.
Try: “Show the latest AI traces with cache misses.”
Read ·
list_ai_tracesReads one trace in full
Returns every span of a trace with timing, parent links and attributes such as model, cache hit or miss and similarity score.
Try: “Show the span waterfall for trace abc.”
Read ·
get_ai_traceExplains why a trace missed
Joins a trace's cache and memory spans with live Valkey state: whether the key still exists, its TTL, the active threshold and the index state.
Try: “Why did trace abc miss the cache?”
Read ·
correlate_ai_traceForecasts when a limit is reached
Projects one metric (ops per second, used memory, CPU or memory fragmentation) forward and estimates the time until it hits its ceiling.
Try: “When will used memory reach its limit?”
Read ·
get_forecastLists sustained latency regressions
Returns detected cases where p99 command latency stayed worse than baseline, from the same store as the anomaly tool. Needs a license tier that includes it.
Try: “Any latency regressions this week?”
Read ·
get_latency_regressionsLists the biggest keys
Ranks the largest keys by measured memory from key analytics snapshots. The snapshots favor collections with many elements. Needs a license tier that includes it.
Try: “What are the 10 largest keys?”
Read ·
get_largest_keysChecks vector search indexes
Shows each search index with document count, memory use, indexing failures and percent indexed. It needs the Search module on the database.
Try: “Are my vector indexes fully indexed?”
Read ·
get_vector_indexesShows search latency per index
Returns p50, p95 and p99 FT.SEARCH latency for each vector index, plus SLA breach status when the license tier supports it.
Try: “What is the p99 search latency of my vector indexes?”
Read ·
get_inference_latency
Read from the source code
Permissions
high risk · 5 things to watch · 3 advisories
High risk
The server can remove connections, apply cache changes and delete stored memories, and nothing stops the assistant from approving its own proposals. Use a non-admin token, or leave the token out on a self-hosted monitor so only read tools work.
What it can do
- Read your data
- Create and change things
- Delete things
- Read-only modeHow to turn it on
Watch out for
The assistant can approve its own changes
The propose tools say a human must approve, but the approve tools are part of the same server. An assistant that can call them can apply cache changes and delete memories itself. Use a token without admin rights, or tell the assistant never to approve. npmjs.com
It can delete memories and cache entries
Approving a forget proposal deletes memories from the live store. Approving an invalidate proposal removes cache entries in Valkey. remove_connection also removes a monitored database from BetterDB. npmjs.com
Autostart runs a second package on your machine
The --autostart option and start_monitor run npx --yes @betterdb/monitor in the background, with your environment variables passed on. Skip autostart if you do not want that, and point BETTERDB_URL at a monitor you already trust. npmjs.com
Database passwords pass through the chat
add_connection and test_connection take a database host and password as tool inputs, so the password appears in your conversation. Add connections in the BetterDB settings instead. npmjs.com
Tool usage is reported to your BetterDB instance
The server sends each tool name, success, duration and error to your BetterDB instance. Set BETTERDB_TELEMETRY=false to turn this off. npmjs.com
Security advisories
3 known advisories, 3 with no fixed version yet.
- BetterDB Monitor: unauthenticated OTLP trace ingest endpoint allows unbounded span retention (DoS). Affects the monitor app, not the npm package; no patched version listed.high · GHSA-3pjj-rg9v-86fc
- BetterDB Cloud: entitlement API accepts unencoded, tenant-unscoped IDs for user and invitation deletion. Affects the monitor product, not the npm package; no patched version listed.high · GHSA-2rwf-9ffp-8pf2
- BetterDB Monitor: unauthenticated /health endpoints disclose connection hosts and engine versions. Affects the monitor app, not the npm package; no patched version listed.medium · GHSA-ghwq-qv69-9vc9
3 other advisories are about the wider monitor project, not this MCP server. See them on GitHub
Technical details
| Turning on read-only | On a self-hosted monitor, leave BETTERDB_TOKEN unset. The README says read tools work anonymously and write tools need an admin token. BetterDB Cloud always needs a token. |
|---|---|
| Talks to | The BetterDB instance at BETTERDB_URL (BetterDB Cloud or your own monitor) |
| Sign-in and keys | The token goes in the env block of your MCP client config. It acts as the token owner, and changes are recorded under that owner's name in the BetterDB activity log. |
| Scopes |
|
Questions
Is the BetterDB MCP server official?
Yes. It is published by BetterDB-inc, the company behind BetterDB, from the same repository as the BetterDB Monitor app.
Do I need BetterDB to use it?
Yes. The server only talks to a BetterDB instance, which can be BetterDB Cloud, a self-hosted monitor (the README shows a Docker image), or one the MCP server starts on your computer with the autostart option.
Do I need a token?
For BetterDB Cloud, yes: create one in Settings, then MCP Tokens. For a self-hosted monitor it is optional. The README says read tools work without it, and write tools need an admin token.
Can it run read-only?
Partly. On a self-hosted monitor, leave the token out and the README says only read tools work. There is no read-only switch in the MCP server itself, so with a token the write and delete tools are available.
Can it change or delete things?
Yes. It can add and remove connections, apply cache threshold, TTL and invalidation changes, and delete agent memories once a proposal is approved. The assistant can approve proposals itself.
Are all tools free?
No. Some tools, such as anomalies, latency regressions and largest keys, need a BetterDB Pro or Enterprise license. Without it they return a message that names the required tier.
Which databases does it support?
Valkey and Redis, with a few tools limited to Valkey 8 and later, such as the COMMANDLOG and slot tools, or to databases with the Search module.
Does the tool list match the README?
Not exactly. The published package registers 60 tools. The README table lists fewer and names a few tools that this release does not register.
Information
updated Nov 2, 2026
- Publisher
- Official
- Package
@betterdb/mcp- Registry
- npm
- Transport
- stdio
- Auth
- token in env
- Version
- 0.1.4
- License
- MIT
- Last commit
- Oct 31, 2026
- Open issues
- 11
- Listed in
- Official MCP registry
Sources
Docs, issue trackers and discussions this page is built from. Issues, quotes and findings above link to their own source.