MCP Setup and Tools
Connect RetainDB to an MCP host, verify the modern tool surface, and know when to use the primary verbs versus namespaced tools.
Applies to: RetainDB MCP
Use RetainDB MCP when your main workflow lives in an MCP-compatible client and you want retrieval, local code exploration, and durable memory without building your own wrapper first.
Environment note: MCP calls use the API URL in
RETAINDB_API_URLand default tohttps://api.retaindb.comwhen unset.
Start with the primary agent verbs
These are the first tools to learn:
searchfor grounded retrieval over stored RetainDB contextsearch_codefor meaning-based local code search in the live workspacegrepfor exact local text searchreadfor opening a local file after searchexplorefor browsing the repo treeresearchfor deeper synthesis over indexed sourcesrememberfor durable facts, preferences, and decisionsrecordfor session-oriented conversation capturelearnfor adding text, files, repos, or sourcesshare_contextfor handing context to another agent or teammate
When the namespaced tools matter
The namespaced tools remain the canonical advanced surface:
search_code->code.search_semanticgrep->code.search_textresearch->research.oracleremember->memory.addlearn->context.add_text,context.add_document, orcontext.add_sourceshare_context->context.share- use
context.query,context.evidence_answer, ormemory.searchwhen you want the explicit advanced contract instead of the primary shorthand
Live workspace vs stored project retrieval
grepandexploreread the live local workspace directlysearch_codeis also live local search, and now returns richer workspace diagnostics plus fallback details when lexical rescue was neededindex.workspace_runonly refreshes local workspace freshness metadata; it does not prove that stored project retrieval already contains this repoindex.local_scan_ingestor another real source ingest path is what makes project-backed retrieval ready for local repo evidencesearchandcontext.get_relevantprefer verified project repo sources, but now auto-fallback to live local workspace retrieval for repo-grounded queries when the bound project lacks this repocontext.evidence_answerandcontext.claim_verifystill fail closed unless the evidence is explicitly repo-grounded
What you need before setup
- a RetainDB API key starting with
rdb_ - an optional default project slug or id
- an MCP host such as Claude Desktop or Claude Code
Basic MCP server config
{
"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": "retaindb-quickstart"
}
}
}
}First verification flow
- start or reload the MCP host
- confirm the RetainDB tools are visible
- run
rememberwith a small fact - run
searchto confirm the fact is retrievable - run
search_codeorgrepagainst a known workspace
That gives you better signal than only checking whether the process starts.
Which tool to use when
- need project-scoped retrieval:
search - need exact local text lookup:
grep - need concept-based code search in the current repo:
search_code - need to inspect the matching file:
read - need a durable preference or fact:
remember - need to index new content:
learn - need a citation-constrained answer:
context.evidence_answer
Security notes
Keep the MCP server on trusted infrastructure, scope RETAINDB_PROJECT where possible, and use RETAINDB_MCP_MODE=remote unless you intentionally need local ingestion or local file search.
Next step
Continue with Claude Desktop setup or Claude Code setup. For the local-search side of the tool surface, read semantic search tools.
Was this page helpful?
Your feedback helps us prioritize docs improvements weekly.