monitor — Claude Code MCP server: Valkey and Redis metrics
Wires your AI assistant into the BetterDB platform so you can pull Valkey and Redis metrics, dig into slow commands and hunt hot keys without leaving the editor.
claude mcp add --env BETTERDB_URL=<BETTERDB_URL> --env BETTERDB_TOKEN=<BETTERDB_TOKEN> --env BETTERDB_INSTANCE_ID=<BETTERDB_INSTANCE_ID> --transport stdio mcp -- npx -y @betterdb/mcpWhat monitor does
The server runs over stdio and installs through npx. It exposes a set of read tools for your databases: get_health returns a summary of instance state, get_slowlog and get_commandlog surface slow commands, and get_hot_keys finds the keys skewing your load. Rounding that out are get_memory, get_clients, get_acl_audit and latency event history. Some tools are marked Pro.
Cloud access needs a token, generated in BetterDB under Settings → MCP Tokens. Without one the cloud endpoint will not answer. A self-hosted instance serves read tools anonymously, but writes require an admin token, and whatever that token changes lands in the activity log under its owner's name. Tokens cannot manage members or other tokens.
The instance address lives in BETTERDB_URL and defaults to http://localhost:3001. --autostart spawns a local monitor process, --persist keeps it alive after the server exits, and --storage picks between sqlite and memory. Point --port at the right port if your monitor already runs elsewhere, or the server will talk to nothing.
What it helps with
- check production Valkey health from inside the editor
- list the slowest commands from the past hour
- spot hot keys causing uneven load
- compare memory usage across cluster nodes
- review latency event history for one event type
Example prompts for the agent
- What's the health of my production Valkey instance?
- Are there any hot keys causing uneven load?
How to install monitor
Platform CLI
claude mcp add --env BETTERDB_URL=<BETTERDB_URL> --env BETTERDB_TOKEN=<BETTERDB_TOKEN> --env BETTERDB_INSTANCE_ID=<BETTERDB_INSTANCE_ID> --transport stdio mcp -- npx -y @betterdb/mcpReplace <…> with your own values
Platform CLI
codex mcp add mcp --env BETTERDB_URL=<BETTERDB_URL> --env BETTERDB_TOKEN=<BETTERDB_TOKEN> --env BETTERDB_INSTANCE_ID=<BETTERDB_INSTANCE_ID> -- npx -y @betterdb/mcpReplace <…> with your own values
Config file
{
"mcpServers": {
"mcp": {
"command": "npx",
"args": [
"-y",
"@betterdb/mcp"
],
"env": {
"BETTERDB_URL": "<BETTERDB_URL>",
"BETTERDB_TOKEN": "<BETTERDB_TOKEN>",
"BETTERDB_INSTANCE_ID": "<BETTERDB_INSTANCE_ID>"
}
}
}
}Replace <…> with your own values
Config file
{
"servers": {
"mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@betterdb/mcp"
],
"env": {
"BETTERDB_URL": "<BETTERDB_URL>",
"BETTERDB_TOKEN": "<BETTERDB_TOKEN>",
"BETTERDB_INSTANCE_ID": "<BETTERDB_INSTANCE_ID>"
}
}
}
}Replace <…> with your own values
Platform CLI
gemini mcp add -e BETTERDB_URL=<BETTERDB_URL> -e BETTERDB_TOKEN=<BETTERDB_TOKEN> -e BETTERDB_INSTANCE_ID=<BETTERDB_INSTANCE_ID> mcp npx -y @betterdb/mcpReplace <…> with your own values
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about monitor
How do I install monitor in Claude Code?
Run claude mcp add monitor -e BETTERDB_TOKEN=<BETTERDB_TOKEN> -- npx -y @betterdb/mcp. To also set the instance URL and a preselected instance, use `claude mcp add --env BETTERDB_URL=<BETTERDB_URL> --env BETTERDB_TOKEN=<BETTERDB_TOKEN> --env BETTERDB_INSTANCE_ID=<BETTERDB_INSTANCE_ID> --transport stdio mcp -- npx -y @betterdb/mcp`.
What does monitor do?
It links an MCP client to the BetterDB platform and hands the assistant tools for reading Valkey and Redis metrics: health, slow commands, hot keys, memory, clients and ACL audit.
Do I need a token for it to work?
BetterDB Cloud requires one. On a self-hosted instance the read tools work without it, while write tools need an admin token.