New to this? The Give your coding agent a memory tutorial walks both paths (local-from-nothing and connect-to-an-existing-brain) end to end, plus the brain-first protocol that makes it worth it. This page is the connection reference.
claude mcp add gbrain -- gbrain serveThat's it. Claude Code spawns gbrain serve as a stdio subprocess. No server, no
tunnel, no token needed. Works with both PGLite and Supabase engines.
If GBrain is running somewhere as an HTTP server (gbrain serve --http, see the
ngrok-tunnel recipe) and you have a bearer token,
let gbrain connect generate the wire-up for you.
On the host (or anywhere gbrain is installed), mint a token and print the block:
gbrain auth create "claude-code"
gbrain connect https://YOUR-DOMAIN.ngrok.app/mcp --token gbrain_xxxgbrain connect prints a short, copy-paste block. Paste it into Claude Code — it
runs the claude mcp add for you and tells the agent to call get_brain_identity
and list_skills so it immediately knows what the brain can do.
Already on the machine you want to wire up? Skip the copy-paste and let connect
do it directly, with a built-in token smoke-test:
gbrain connect https://YOUR-DOMAIN.ngrok.app --token gbrain_xxx --install(--install runs claude mcp add, then verifies the token by calling
get_brain_identity — so a wrong or expired token fails now, not silently on the
agent's first request. The URL is normalized: a bare host without /mcp gets it
appended; pass an explicit https:// scheme.)
Pipe-friendly machine output (token redacted unless --show-token):
gbrain connect https://YOUR-DOMAIN.ngrok.app/mcp --token gbrain_xxx --jsonEquivalent to what gbrain connect generates, if you'd rather run it yourself:
claude mcp add gbrain -t http \
https://YOUR-DOMAIN.ngrok.app/mcp \
-H "Authorization: Bearer YOUR_TOKEN"Replace YOUR-DOMAIN with your ngrok domain and YOUR_TOKEN with a token from
gbrain auth create "claude-code".
A
gbrain auth createtoken is a long-lived, full-access secret. Keep it private (it lands in~/.claude.json), and prefer a scoped/short-lived token where your host supports one.
In Claude Code, try:
search for [any topic in your brain]
You should see results from your GBrain knowledge base.
list_skillsreturns nothing? Skill discovery is gated bymcp.publish_skillson the host. New brains fromgbrain initdefault it ON; brains upgraded from an older release stay OFF until you opt in. Enable it on the host withgbrain config set mcp.publish_skills true. The core tools (search, query, get_page, put_page, think, find_experts) work regardless. Note:captureis a CLI-only command, not an MCP tool — the agent writes over MCP withput_page.
claude mcp remove gbrain