thebrain

v0.3.0
io.github.yBookoff/thebrain Checked 4 days ago Published 1 month ago

MCP server for TheBrain 15: search by meaning, graph traversal and batch writes over the local API

Values you need

VariableWhat it is
THEBRAIN_API_KEYrequired secret Local API key from TheBrain: Settings > User > Local API Key
THEBRAIN_BASE_URLoptional Address of the local API. Default http://localhost:11522, then http://localhost:8001 for older TheBrain builds
THEBRAIN_DATA_DIRoptional Where semantic indexes are stored. Default ~/.thebrain-mcp
THEBRAIN_ALLOW_DESTRUCTIVEoptional Set to 1 to allow deleting thoughts. Deletion still requires human confirmation. Default 0
THEBRAIN_EMBEDDING_MODELoptional Embedding model for semantic search. Default Xenova/multilingual-e5-small
THEBRAIN_EMBEDDING_DTYPEoptional Weight precision: fp32, fp16, q8 or q4. Default q8
THEBRAIN_TIMEOUT_MSoptional API request timeout in milliseconds. Default 30000

npm (npx) discovery passed

Requires Node.js 18+

Run in a terminal
claude mcp add thebrain -e 'THEBRAIN_API_KEY=<THEBRAIN_API_KEY>' -- npx -y --package=thebrain-mcp-server@0.3.0 thebrain-mcp
Add to claude_desktop_config.json
{
  "mcpServers": {
    "thebrain": {
      "args": [
        "-y",
        "--package=thebrain-mcp-server@0.3.0",
        "thebrain-mcp"
      ],
      "command": "npx",
      "env": {
        "THEBRAIN_API_KEY": "<THEBRAIN_API_KEY>"
      }
    }
  }
}
Add to ~/.cursor/mcp.json
{
  "mcpServers": {
    "thebrain": {
      "args": [
        "-y",
        "--package=thebrain-mcp-server@0.3.0",
        "thebrain-mcp"
      ],
      "command": "npx",
      "env": {
        "THEBRAIN_API_KEY": "<THEBRAIN_API_KEY>"
      }
    }
  }
}
Add to .vscode/mcp.json
{
  "inputs": [
    {
      "description": "THEBRAIN_API_KEY",
      "id": "thebrain-api-key",
      "password": true,
      "type": "promptString"
    }
  ],
  "servers": {
    "thebrain": {
      "args": [
        "-y",
        "--package=thebrain-mcp-server@0.3.0",
        "thebrain-mcp"
      ],
      "command": "npx",
      "env": {
        "THEBRAIN_API_KEY": "${input:thebrain-api-key}"
      },
      "type": "stdio"
    }
  }
}
Add to ~/.codex/config.toml
[mcp_servers.thebrain]
command = "npx"
args = ["-y", "--package=thebrain-mcp-server@0.3.0", "thebrain-mcp"]
env = { "THEBRAIN_API_KEY" = "<THEBRAIN_API_KEY>" }

For AI agents

  1. Ask the user for: THEBRAIN_API_KEY. Never invent or guess these values; secrets go into the client config, not into chat logs.
  2. Pick the user's MCP client and apply the matching config from the first install method (it is the one verified by the smoke test when available).
  3. Restart or reload the client so it starts the server.
  4. Verify: the server should expose these tools: brain_list, brain_get_thought, brain_search, brain_traverse, brain_list_types_and_tags, brain_recent_changes, brain_index, brain_create_thought, ….
  5. If it fails, check that the required runtime is installed (Node.js 18+) and that the values above are set.

Machine-readable: install.md · manifest.json