Claude Code Setup
Configure RetainDB MCP in Claude Code with the current server package, current API key format, and the modern primary tool verbs.
Applies to: Claude Code
Set up RetainDB MCP in Claude Code when you want Claude to search project context, inspect local code, and remember durable decisions during coding sessions.
Prerequisites
- Claude Code installed
- Node.js 18+
- a RetainDB API key starting with
rdb_ - an optional RetainDB project slug
Quick setup
Add RetainDB to your Claude Code MCP settings:
{
"mcpServers": {
"retaindb-context": {
"command": "npx",
"args": ["-y", "@retaindb/mcp-server@latest"],
"env": {
"RETAINDB_API_KEY": "rdb_...",
"RETAINDB_API_URL": "https://api.retaindb.com",
"RETAINDB_PROJECT": "my-project"
}
}
}
}Then reload Claude Code so the MCP host restarts.
Environment variables
| Variable | Required | Description |
|---|---|---|
RETAINDB_API_KEY | Yes | Your rdb_* API key |
RETAINDB_PROJECT | No | Default project for retrieval and ingest |
RETAINDB_API_URL | No | Custom API URL |
RETAINDB_MCP_MODE | No | remote, local, or auto |
RetainDB_LOCAL_ALLOWLIST | No | Required if you enable local ingest paths |
Start with these tools in Claude Code
Primary verbs:
searchsearch_codegrepreadexploreresearchrememberrecordlearnshare_context
Canonical namespaced tools remain available when you need the advanced surface, such as context.query, context.evidence_answer, memory.add, or code.search_semantic.
First smoke test
Try this sequence inside Claude Code:
- ask Claude to run
rememberwith a short project fact - ask Claude to run
searchfor that fact - ask Claude to run
search_codefor a concept in the current repo - ask Claude to
readone of the matching files
That verifies memory, retrieval, local search, and file access together.
Common mistakes
Wrong API key format
Use rdb_*, not older sk_* examples from stale docs.
Wrong base URL variable
Use RETAINDB_API_URL, not guessed variants from older configurations.
Expecting local ingest without allowlisting
If you switch to RETAINDB_MCP_MODE=local or auto, local ingestion still respects RetainDB_LOCAL_ALLOWLIST.
Troubleshooting
- tools not visible: reload Claude Code and re-check the JSON
- auth failures: verify the
rdb_*key and base URL - local search missing files: confirm Claude Code launched in the correct workspace
- local ingest denied: add the intended roots to
RetainDB_LOCAL_ALLOWLIST
Next step
Was this page helpful?
Your feedback helps us prioritize docs improvements weekly.