Standalone MCP server that bridges Codex (or any MCP client) to a second-brain HTTP gateway.
remember(content, tags=[], force=false)recall(query, limit=10)recent(limit=20)forget(id)remember_for_project(project, content, tags=[], force=false)recall_for_project(project, query, limit=10, scan_limit=60)recent_for_project(project, limit=20, scan_limit=120)list_projects(scan_limit=300)
Project notes use tag namespace project:<name> (for example project:kostula).
SECOND_BRAIN_URL(default:http://localhost:8088)SECOND_BRAIN_TIMEOUT_SECONDS(default:20)SECOND_BRAIN_DEFAULT_PROJECT(optional; auto-addsproject:<name>tag inremember)SECOND_BRAIN_API_KEY(optional; sent as header for gateway auth)SECOND_BRAIN_API_KEY_HEADER(default:X-Second-Brain-Key)
python -m venv .venv
.venv/bin/pip install -e .
SECOND_BRAIN_URL=http://localhost:8088 .venv/bin/second-brain-mcpThe process uses stdio transport (for MCP clients).
Expected endpoints:
POST /api/rememberwith{"content": "...", "tags": ["..."], "force": false}POST /api/recallwith{"query": "...", "limit": 10, "project": "optional", "tags": ["optional"]}GET /api/recent?limit=20&project=optional&tags=comma,separatedGET /api/projects?limit=200POST /api/forgetwith{"id": "..."}
Expected response shape:
- Ack responses:
{"ok": true, "id": "...", "created_at": "...", "updated_at": "..."} - List responses:
{"ok": true, "results": [ ...notes ]}
Note shape consumed by MCP:
id,content,tags,source,created_at,updated_at, optionalrank
Project tools namespace memories with tag project:<name>.
Current behavior:
recall_for_projectrequests gateway-side filtering viaproject.recent_for_projectrequests gateway-side filtering viaproject.list_projectsuses gateway endpoint/api/projects.
Backward compatibility:
- If the gateway does not support these filters/endpoints yet, MCP falls back to client-side filtering of recent/recall results.
- Do not expose your gateway on the public internet without auth.
- Prefer API-key auth (
SECOND_BRAIN_API_KEY) and TLS at your reverse proxy. - This MCP bridge intentionally avoids storing DB credentials; it only calls your gateway.
- If gateway secret-guard blocks a note, you can intentionally override with
force=trueinremember/remember_for_project.