myco-brain — Claude Code MCP server: shared agent memory on Postgres
Keeps a shared memory for your agents in your own Postgres. Each fact carries its source, and a newer value replaces the old one without erasing it.
claude mcp add myco-brain -- npx -y @mycobrain/mcp-serverWhat myco-brain does
Myco Brain runs on top of a Postgres database with pgvector. The installer looks for one on your machine or brings one up in Docker, and you can also hand it a connection string for Supabase, Neon, RDS or a self-hosted instance by reference, so the string stays out of your command history. Node.js 20 or later is required.
In Claude and Codex the memory works through hooks: they pull relevant facts at session start and before each prompt, while a background worker reads the finished session and files what is worth keeping. Cursor, Windsurf and Claude Desktop have no hooks, so the server exposes two tools there, brain_memory_context and brain_memory_write. Clients are separated into houses, and a contractor's agent sees one client only. Every tool holds its own credential, so you can revoke one without disturbing the rest.
No API keys are involved: the worker reads sessions through the claude or codex CLI you are already signed in to. Ollama handles local embeddings when it is present; without it, recall matches the words in your prompt, which covers names, places and numbers. Dream mode is off and only proposes merging duplicates — nothing changes until you approve. Run mycobrain-doctor --memory to check the setup.
What it helps with
- give several agents one memory backed by your own Postgres
- keep the source of every fact and preserve its edit history
- keep one client's data away from another client's agent
- surface relevant facts at session start without searching by hand
- revoke access for a single tool while others keep working
Example prompts for the agent
- Remember this: the Acme account moves to the new billing in January.
- Show me the history of the fact about the database schema.
How to install myco-brain
Platform CLI
claude mcp add myco-brain -- npx -y @mycobrain/mcp-serverPlatform CLI
codex mcp add myco-brain -- npx -y @mycobrain/mcp-serverConfig file
{
"mcpServers": {
"myco-brain": {
"command": "npx",
"args": [
"-y",
"@mycobrain/mcp-server"
]
}
}
}Config file
{
"servers": {
"myco-brain": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@mycobrain/mcp-server"
]
}
}
}Platform CLI
gemini mcp add myco-brain npx -y @mycobrain/mcp-serverStep 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 myco-brain
How do I install myco-brain in Claude Code?
Run claude mcp add myco-brain -- npx -y @mycobrain/mcp-server. Node.js 20 or later needs to be on the machine first.
What does myco-brain do?
It stores the facts your agents write in your Postgres and brings the relevant ones back in later sessions. Each fact keeps its source, and a new value supersedes the old one while the history stays.
Does it need API keys?
No. The worker reads sessions through the claude or codex CLI you are already signed in to. Ollama computes local embeddings when available; otherwise recall matches the words in your prompt.