Browse docs

MCP

Tap to expand

Contribute

MCPUpdated 2026-03-18

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:

json
{
  "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

VariableRequiredDescription
RETAINDB_API_KEYYesYour rdb_* API key
RETAINDB_PROJECTNoDefault project for retrieval and ingest
RETAINDB_API_URLNoCustom API URL
RETAINDB_MCP_MODENoremote, local, or auto
RetainDB_LOCAL_ALLOWLISTNoRequired if you enable local ingest paths

Start with these tools in Claude Code

Primary verbs:

  • search
  • search_code
  • grep
  • read
  • explore
  • research
  • remember
  • record
  • learn
  • share_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:

  1. ask Claude to run remember with a short project fact
  2. ask Claude to run search for that fact
  3. ask Claude to run search_code for a concept in the current repo
  4. ask Claude to read one 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.