MCP Setup
Connect RetainDB to MCP clients and expose the company brain to agents.
Applies to: RetainDB MCP
RetainDB MCP gives agent hosts direct tools for company knowledge, memory, source status, and handoffs.
Use it for Claude Code, Codex, Cursor, OpenCode, Windsurf, Cline, or any MCP-compatible client.
Install By Config
Most hosts can run the MCP server through npx:
{
"mcpServers": {
"retaindb": {
"command": "npx",
"args": ["-y", "@retaindb/mcp-server@latest"],
"env": {
"RETAINDB_API_KEY": "rdb_...",
"RETAINDB_API_URL": "https://api.retaindb.com",
"RETAINDB_PROJECT": "production"
}
}
}
}Merge this into your existing MCP config. Do not replace other servers.
Tool Surface
RetainDB MCP exposes the same core product surfaces as the dashboard and HTTP API.
Company Brain And Sources
| Tool | Use it for |
|---|---|
context | ask the company brain |
search | semantic search across indexed sources and local code |
index | create a source from the agent host |
list_sources | inspect source status before relying on answers |
update_source | update source config and optionally resync |
read_context_file | read /context/company.md or another agent filesystem file |
list_context_files | browse agent filesystem paths |
index is useful for agent-driven setup, but account-backed tools still need valid credentials or a connected account. For normal users, prefer the dashboard Sources and Connected Accounts flows.
Memory
| Tool | Use it for |
|---|---|
remember | store durable facts, preferences, and corrections |
list_memories | review stored memories before deleting or correcting |
forget | delete incorrect memory |
compress | store older conversation context as memory and keep recent turns |
Agent Work
| Tool | Use it for |
|---|---|
agent_event | record decision, failure, tool result, constraint, update, or observation |
agent_context | retrieve task, agent, project, session, and user memory |
agent_handoff | create a handoff packet for another agent |
agent_handoff_resume | resume a handoff into a new session |
Project And Local Code Helpers
| Tool | Use it for |
|---|---|
list_projects | find the right project when multiple projects exist |
grep | text search local files from the agent runtime |
read | read a local file after grep finds it |
First Verification
After restarting your MCP host, ask:
List RetainDB sources and tell me which ones are ready.Then:
Ask RetainDB what the company brain knows about billing retries. Cite the source names if available.Then:
Read /context/company.md from RetainDB.If these work, your agent can see RetainDB.
Suggested Agent Instruction
Add a short instruction to your agent or project rules:
Use RetainDB when the task depends on company knowledge, project history, prior decisions, or user memory.
Call list_sources before relying on source data.
If RetainDB has no relevant context, say what is missing instead of guessing.When To Use Which Tool
| Need | Tool |
|---|---|
| answer from company docs/repos/files | context |
| check whether a source is usable | list_sources |
| create a manual source from the agent host | index |
| inspect agent-readable summary files | read_context_file |
| remember a user preference or correction | remember |
| record important agent work | agent_event |
| pass work to another agent | agent_handoff |
| search local files | grep, then read |
Troubleshooting
| Symptom | Fix |
|---|---|
| tools do not appear | restart host and confirm MCP config path |
| 401 | verify RETAINDB_API_KEY is in the MCP env |
| empty answers | call list_sources; check RETAINDB_PROJECT |
| stale source answers | sync or reconnect the source |
| agent ignores RetainDB | add an instruction that tells it when to call RetainDB |
Next: Agent host snippets, Connect Agents, or Company Brain API.
Was this page useful?
Your feedback helps us make the product easier to ship with.