Connect

Connect Claude, Codex, Cursor and more.

Give your AI tools the same approved knowledge your team reads, and let them save what they learn. Setup takes about two minutes.

Create a key

In nestedbrain, open Agent access → Create key. Choose the spaces the tool can read and, if you want, where it can save.

Add the server

Point your tool at the nestedbrain URL with the key as a bearer token. Pick your tool below.

Add instructions

Paste a short snippet into CLAUDE.md or AGENTS.md so the tool checks nestedbrain first.

Ask something

Try “How do we deploy a new service?” and watch it answer from your approved pages.

Claude Code Codex Cursor · VS Code · others HTTPS + API keyAuthorization: Bearer ak_live_… nestedbrain /kbplus-dx/mcpchecks scope · approved pages onlysaves memories for review

Any tool that supports remote MCP servers connects the same way.

Before you start

You need:

  • A nestedbrain account that can create agent keys.
  • The address of your nestedbrain server. Everywhere below, replace YOUR-HOST with it. The MCP endpoint is always https://YOUR-HOST/kbplus-dx/mcp.
  • An AI tool that supports remote MCP servers (all the tools below do).

1. Create an API key

  1. Sign in to nestedbrain and open Agent access.
  2. Choose Create key and give it a clear name, such as “Priya’s laptop · Claude Code”.
  3. Pick the space the key should read. It can read that space and everything inside it.
  4. Turn on write only if you want the tool to save memories and propose edits.
  5. Copy the key. It starts with ak_live_ and is shown once.
The Agent access screen in nestedbrain with a key and connection snippets
The Agent access screen: your keys, the connection snippets and a “try it as an agent” box. Sample data.
Treat the key like a password.Anyone with it can read what it is scoped to. Do not paste it into chats, tickets or commits. Put it in an environment variable and revoke it from Agent access if it leaks.

The key is the identity. Its spaces decide what the tool can read and where its memories go, so tools using keys for the same space share what they learn, and everyone else does not see it.

2. Add nestedbrain to your tool

Choose your tool. Replace YOUR-HOST and the example key with your own.

Claude Code

One command adds nestedbrain as a remote (HTTP) MCP server:

bash
claude mcp add --transport http nestedbrain https://YOUR-HOST/kbplus-dx/mcp \
  --header "Authorization: Bearer ak_live_XXXXXXXX"

By default this is saved for the current project only. Add --scope user to use it everywhere, and keep the key in an environment variable instead of typing it:

bash
# make it available in every project on this machine
claude mcp add --transport http --scope user nestedbrain https://YOUR-HOST/kbplus-dx/mcp \
  --header "Authorization: Bearer $NESTEDBRAIN_API_KEY"

Share it with your team

Commit a .mcp.json to the repo. Each person sets NESTEDBRAIN_API_KEY in their own shell, so no key is ever committed:

json (.mcp.json)
{
  "mcpServers": {
    "nestedbrain": {
      "type": "http",
      "url": "https://YOUR-HOST/kbplus-dx/mcp",
      "headers": {
        "Authorization": "Bearer ${NESTEDBRAIN_API_KEY}"
      }
    }
  }
}

Check it worked with claude mcp list, or type /mcp inside Claude Code. nestedbrain should show as connected with its tools listed.

Claude Desktop

Claude Desktop’s config file starts local servers, so use the mcp-remote bridge to reach a remote one. It needs Node.js installed.

  1. Open Settings → Developer → Edit Config to open claude_desktop_config.json.
  2. Add the server below, then fully quit and reopen Claude Desktop.
json (claude_desktop_config.json)
{
  "mcpServers": {
    "nestedbrain": {
      "command": "npx",
      "args": [
        "-y", "mcp-remote",
        "https://YOUR-HOST/kbplus-dx/mcp",
        "--header", "Authorization:${NESTEDBRAIN_AUTH}"
      ],
      "env": { "NESTEDBRAIN_AUTH": "Bearer ak_live_XXXXXXXX" }
    }
  }
}
Why the env variable?Putting the whole header in env avoids problems with the space in Bearer … on some systems.

OpenAI Codex (CLI and IDE extension)

Codex reads MCP servers from ~/.codex/config.toml, shared by the CLI and the IDE extension. First put your key in an environment variable:

bash
export NESTEDBRAIN_API_KEY="ak_live_XXXXXXXX"   # add to ~/.zshrc or ~/.bashrc

Then add the server to the config file:

toml (~/.codex/config.toml)
[mcp_servers.nestedbrain]
url = "https://YOUR-HOST/kbplus-dx/mcp"
bearer_token_env_var = "NESTEDBRAIN_API_KEY"

Recent Codex versions can also write that entry for you:

bash
codex mcp add nestedbrain --url https://YOUR-HOST/kbplus-dx/mcp --bearer-token-env-var NESTEDBRAIN_API_KEY
codex mcp list
Older versionsIf Codex does not offer HTTP servers, update it. Some earlier releases needed an experimental flag for remote MCP servers, so check codex --version and the Codex docs for your version.

Restart Codex, then ask it: “List the tools you have from nestedbrain.”

Cursor

Create ~/.cursor/mcp.json for all projects, or .cursor/mcp.json inside one project:

json (~/.cursor/mcp.json or .cursor/mcp.json)
{
  "mcpServers": {
    "nestedbrain": {
      "url": "https://YOUR-HOST/kbplus-dx/mcp",
      "headers": {
        "Authorization": "Bearer ${env:NESTEDBRAIN_API_KEY}"
      }
    }
  }
}

Open Settings → MCP to confirm nestedbrain is listed and enabled. To make Cursor use it automatically, add the rules snippet from the instructions section below to .cursor/rules.

VS Code (GitHub Copilot agent mode)

Add .vscode/mcp.json to your workspace. VS Code asks for the key the first time and stores it securely, so it never sits in the file:

json (.vscode/mcp.json)
{
  "inputs": [
    { "type": "promptString", "id": "nestedbrain-key", "description": "nestedbrain API key", "password": true }
  ],
  "servers": {
    "nestedbrain": {
      "type": "http",
      "url": "https://YOUR-HOST/kbplus-dx/mcp",
      "headers": { "Authorization": "Bearer ${input:nestedbrain-key}" }
    }
  }
}

Open the Chat view, switch to Agent mode and use the tools button to see nestedbrain’s tools.

Windsurf

Open Settings → Cascade → MCP servers → View raw config, or edit the file directly:

json (~/.codeium/windsurf/mcp_config.json)
{
  "mcpServers": {
    "nestedbrain": {
      "serverUrl": "https://YOUR-HOST/kbplus-dx/mcp",
      "headers": { "Authorization": "Bearer ${env:NESTEDBRAIN_API_KEY}" }
    }
  }
}

Refresh the MCP list in Cascade after saving.

Gemini CLI

Add the server to ~/.gemini/settings.json (or .gemini/settings.json in a project):

json (~/.gemini/settings.json)
{
  "mcpServers": {
    "nestedbrain": {
      "httpUrl": "https://YOUR-HOST/kbplus-dx/mcp",
      "headers": { "Authorization": "Bearer ak_live_XXXXXXXX" }
    }
  }
}

Run /mcp inside Gemini CLI to confirm it is connected.

Any MCP client

nestedbrain speaks standard MCP over streamable HTTP, so any client that supports remote servers with custom headers will work. You need three things:

  • URL: https://YOUR-HOST/kbplus-dx/mcp
  • Transport: streamable HTTP (sometimes labelled “HTTP” or “remote”)
  • Header: Authorization: Bearer ak_live_…

Clients that only run local (stdio) servers can use the mcp-remote bridge shown on the Claude Desktop tab.

Test from a terminal

This is also the quickest way to check a key before configuring a tool:

bash
export NESTEDBRAIN_API_KEY="ak_live_XXXXXXXX"

# 1. list the tools this key can use
curl -s https://YOUR-HOST/kbplus-dx/mcp \
  -H "Authorization: Bearer $NESTEDBRAIN_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

# 2. ask a question
curl -s https://YOUR-HOST/kbplus-dx/mcp \
  -H "Authorization: Bearer $NESTEDBRAIN_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"kb_ask","arguments":{"question":"How do we deploy a new service?"}}}'

The server is stateless, so there is no session to open first. A healthy response to tools/list is a JSON list of tools.

Config formats change.These examples follow each tool’s documented remote-server format at the time of writing. If a tool rejects a field, check its own MCP documentation for the current names. The three values you need never change: URL, HTTP transport and the Authorization: Bearer header.

3. Tell your tool to use it

MCP tells a tool what nestedbrain can do. A few lines of instructions tell it when. Paste this into your project’s CLAUDE.md, AGENTS.md or Cursor rules:

markdown (CLAUDE.md / AGENTS.md / .cursor/rules)
## Knowledge base (nestedbrain)
nestedbrain is this organisation's shared knowledge base and your long-term memory.
- Before researching or asking me how something works here, call `kb_ask` with the question.
- Read more only when needed: `kb_read_section` for one heading, `kb_read` for a whole page.
- When you learn something durable that a teammate would also need (a decision, a gotcha,
  how a system really behaves, a convention), save it with `kb_remember`.
  One idea per memory, a clear title, plain Markdown.
- Never save credentials, tokens or personal data.
- If a page is wrong or out of date, use `kb_propose_edit`. A person reviews it first.

nestedbrain also sends similar guidance to the tool when it connects, so this step makes the behaviour more reliable rather than replacing anything.

4. Verify it works

  1. Ask your tool: “What nestedbrain tools do you have?” You should see kb_ask, kb_search, kb_read_section and kb_read, plus the write tools if your key has write access.
  2. Ask a real question: “Use nestedbrain to find how we deploy a new service.”
  3. If you enabled write, say: “Remember in nestedbrain that our staging database is reset every Sunday.” Then open nestedbrain and find the new memory page.

Tools reference

Read tools are always available. Write tools only appear when the key has a write scope.

ToolWhat it doesNeeds
kb_askAsk a question. Returns the best matching short briefs, with routes to deeper pages, inside a token budget. Start here.read
kb_searchFull-text search over approved pages. Returns titles and snippets, not whole pages.read
kb_read_sectionRead one heading of a page. The cheapest way to get detail.read
kb_readRead one approved page in full.read
kb_rememberSave a durable learning as a memory page. Refused if it contains credentials.write
kb_propose_editPropose new content for an existing page. A person approves it before others read it.write
kb_my_memoriesList what this key has saved and whether each is live or awaiting review.write

Tools are designed to be cheap. kb_ask returns short summaries first, and kb_read_section fetches only the heading you need, so your tool spends tokens on answers instead of whole pages.

Scopes

Scopes are set when you create the key.

ScopeGrants
nestedbrain:readRequired. Lets the key read approved pages it is allowed to see.
nestedbrain:space:<NODE>Read the node and everything below it. Add one per space the tool should see.
nestedbrain:write:<NODE>Save memories into the node and below, and propose edits. The first write scope is the default target.

What a connected tool can and cannot do

  • Reads approved pages only. Drafts, pages in review, archived pages and restricted pages are never served.
  • Saves memories. With a write scope, kb_remember creates a memory page. Private memories are visible to that key only, team memories to keys covering the same space, and organisation-wide memories wait for a reviewer.
  • Proposes, never overwrites. kb_propose_edit saves a new version that a person approves before anyone else reads it.
  • Never stores secrets. Text that looks like a credential is refused.

Example prompts

Once connected, you can just talk to your tool. Some prompts that work well:

  • “Check nestedbrain for how we deploy a new service, then follow it.”
  • “Search nestedbrain for our database connection rules before you write this query.”
  • “Read the ‘Rolling back’ section of the release checklist in nestedbrain.”
  • “Remember in nestedbrain that the staging database resets every Sunday.”
  • “That nestedbrain page on VPN setup looks out of date. Propose an edit with the new steps.”
  • “What do we already know in nestedbrain about rate limiting?”

What happens behind the scenes

  1. Your tool sends a question to nestedbrain using the key.
  2. nestedbrain checks the key’s scopes and looks only inside the spaces it may read.
  3. It returns short summaries first, with routes to the page or heading that has more detail.
  4. Your tool reads only the section it needs, which keeps answers fast and cheap.
  5. If your tool saves something, nestedbrain checks it for credentials, stores it as a memory page and records which key wrote it.

Roll it out to a team

  • One key per person and tool. Name keys clearly, such as “Priya · Codex · laptop”.
  • Share the setup, not the key. Commit .mcp.json (Claude Code) or .cursor/mcp.json with the key coming from an environment variable.
  • Share the instructions. Put the CLAUDE.md / AGENTS.md snippet in the repo so every tool behaves the same way.
  • Point each key at the right space. Keys for the same space share what they remember.
  • Start read-only. Turn on write access once the team trusts the setup. Saved memories are marked with the key that wrote them.
  • Review what gets saved. Organisation-wide memories and proposed edits wait for a reviewer in nestedbrain.

Rotate or revoke a key

  1. Open Agent access in nestedbrain and create a new key with the same scopes.
  2. Update the environment variable or config on the machine.
  3. Revoke the old key. It stops working immediately.

Keep it safe

  • Use one key per person and tool, so you can see who did what and revoke one without affecting others.
  • Give each key the smallest set of spaces it needs. Add write access only where it helps.
  • Keep keys in environment variables or your tool’s secret store, never in a committed file.
  • Reads and writes are recorded against the key that made them.

Troubleshooting

SymptomLikely cause and fix
401 or 403The key is wrong, revoked or expired, or it lacks nestedbrain:read. Create a new key and update your config. Use an agent API key, not your login token.
Only four tools appearThe key has no write scope. Create a key with nestedbrain:write:<NODE> if you want the tool to save memories.
kb_ask returns nothingThe page may not be approved yet, or sits outside the key’s spaces. Try kb_search with different words, and check the key’s scopes.
Save refused with 422The text looks like a credential (access key, private key, token, password = …). Remove it and save again.
Save refused with 413The memory is longer than your organisation’s limit. Split it into smaller memories.
Tool shows “failed to connect”Check the URL ends in /kbplus-dx/mcp, that your network allows the host, and run the curl test above.
Claude Desktop does not list nestedbrainFully quit the app, confirm Node.js is installed (node -v), and check the JSON is valid.

Still stuck? Ask your nestedbrain administrator to check the key’s scopes in Agent access.

Ready to connect?

Create a key in nestedbrain and be answering from your own knowledge in minutes.