thebrain-mcp
You can use this MCP server to semantically read, search, and write connected thought structures in a TheBrain 15 brain.
List brains, see which is open, and check semantic index readiness.
Read a thought in full: note, parents, children, jumps, tags, type, and attachments.
Search by meaning with multiple query variants; falls back to prefix search if no local vector index.
Traverse the graph up to 4 hops with filters for child, parent, or jump links.
List existing types and tags to reuse the brain's conventions.
View recent changes over a time range for digests or context.
Manage the local semantic index: status, rebuild, or sync.
Create thoughts with name, note, type, tags, label, parent, and relation.
Update thought properties: title, caption, type, background/text colours.
Replace or append notes safely.
Link two thoughts with a labelled relationship and relation type.
Attach or remove tags on a thought.
Attach URLs to thoughts without duplicates.
Open a thought in the user's TheBrain app.
Delete thoughts only with human confirmation and destructive mode enabled.
Ingest a whole batch of thoughts, links, notes, and tags in one validated call, using tempIds, deduplication, and automatic dependency resolution.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@thebrain-mcp search my brain for thoughts about RAG"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
thebrain-mcp
An MCP server for TheBrain 15, built on its local API.
It gives an agent semantic operations over your brain: search by meaning, read a neighbourhood of the graph, and write a decomposed piece of material into the brain as a whole connected structure. It is not a mirror of the API — 19 tools instead of 48 endpoints.
The point is not "save this text". The point is that when you hand an agent an article, it reads it, breaks it into meanings, works out where each one belongs in the graph you already have, what to link it to, and what each note should say.
Published on npm as
thebrain-mcp-server— npm considers the shorter name too close to an unrelated existing package. The installed command is stillthebrain-mcp.
Requirements
TheBrain 15 running, with the local API enabled
Node.js 22 or newer
An API key: Settings → User → Local API Key
Related MCP server: thebrain-mcp-server
Install
Claude Code
claude mcp add thebrain -e THEBRAIN_API_KEY=your-key -- npx -y thebrain-mcp-serverClients with a config file
{
"mcpServers": {
"thebrain": {
"command": "npx",
"args": ["-y", "thebrain-mcp-server"],
"env": { "THEBRAIN_API_KEY": "your-key" }
}
}
}Semantic search
TheBrain's own search matches prefixes: OT finds OTGP, while a synonym or a
typo finds nothing. To search by meaning, the server builds a local vector index.
The embeddings package is not part of the install: it weighs around 380 MB, plus 113 MB for the model itself on first run. Install it separately, and only if you want it:
npm install -g @huggingface/transformersThen, from your client: brain_index with action: "rebuild". Indexing a
10,000-thought brain takes about a minute; later runs only recompute what changed.
The server works without the package. brain_search falls back to a fan-out
of prefix queries over the synonyms the agent supplies, and says plainly that
recall is lower.
Everything is local: neither your brain's contents nor your queries are sent anywhere.
Settings
Variable | Default | Purpose |
| — | Required |
|
| Local API address |
|
| Where indexes are stored |
|
| Allow deleting thoughts and links |
|
| Embedding model |
|
| Weight precision |
|
| API request timeout |
Changing the model or the precision makes an existing index unusable — the server will say so and ask for a rebuild.
THEBRAIN_BASE_URL rarely needs setting. A TheBrain update moved the local API
from port 8001 to 11522, so the server tries the new port and falls back to the
old one. Set the variable only if TheBrain listens somewhere else; the endpoint
exactly as Settings shows it (http://localhost:11522/api/) is fine.
Tools
Reading
Tool | What it does |
| Brains, which one is open, whether the index is ready |
| A thought, its aliases, its graph and its note in one call |
| Search by meaning |
| Walk the graph several hops out |
| The brain's vocabulary |
| What changed, in plain language |
| Index status, build and refresh |
Writing
Tool | What it does |
| A thought together with its note, type, tags and aliases |
| Name, label, type, colours; add and remove aliases |
| Replace or extend a note |
| Connect two thoughts, with a label; with |
| Remove a link, with human confirmation |
| Attach and detach tags |
| A new type or tag; a tag of a name the brain has is given back, not made twice |
| Attach a link, without duplicates |
| Open a thought on the user's screen |
| Delete, with human confirmation |
| Write a whole structure in one call |
brain_ingest
The main tool for filling a brain. The agent breaks material into thoughts, wires them together through temporary identifiers, and the whole thing lands in one call:
{
"brainId": "…",
"thoughts": [
{ "tempId": "art", "name": "Article on RAG", "parent": "<uuid of an existing thought>" },
{ "tempId": "embed", "name": "Embeddings", "parent": "art", "note": "…" },
{ "tempId": "store", "name": "Vector store", "parent": "art" }
],
"links": [
{ "from": "embed", "to": "store", "name": "is written into" }
]
}The order of thoughts in the input does not matter — dependencies resolve themselves. Running the same plan twice duplicates nothing, and a thought that was already there keeps the note it has: a plan's note is written only where there is none, and the result says which notes were kept. Bad plans (a cycle, a reference to nowhere) are rejected before the first write.
Skills
The server provides the mechanism — deterministic operations. The methodology (how finely to split meanings, when to attach to something that already exists, what belongs in a note) lives separately, in Claude Code skills. They are plain markdown files, so you can adjust them to your own way of working without rebuilding the server.
Skill | When it fires |
| "put this article in my brain", "break this down and record it" |
| "what do I know about X", "have we discussed this already?" |
| "clean up my brain", "find duplicates" |
| "what did I add this week", "what have I been working on" |
Install them as symlinks, so edits in the repository take effect immediately:
mkdir -p ~/.claude/skills
for d in skills/*/; do
ln -sfn "$PWD/$d" ~/.claude/skills/"$(basename "$d")"
doneOr copy them, if you do not want the link to the repository. For a single
project, use .claude/skills in its root instead of ~/.claude/skills.
Skills are picked up when a session starts — an already running session needs a
restart (claude --continue keeps the conversation).
Deletion
Of a thought (brain_delete_thought) and of a link (brain_unlink). Off by
default. Even with THEBRAIN_ALLOW_DESTRUCTIVE=1 it requires human
consent: through a confirmation form if the client supports one, otherwise
through a second call with an explicit flag. The agent cannot make this decision
for you.
Development
npm install
npm test # unit tests, no live TheBrain needed
npm run buildContract tests against a live API:
THEBRAIN_API_KEY=… npm test # read-only
THEBRAIN_API_KEY=… THEBRAIN_TEST_BRAIN_ID=<uuid> npm test # + writesThe write tests require a separate, throwaway brain and refuse to touch any brain with more than 500 thoughts. The read-only tests that need a brain read that one too, and skip without it: no test reads another brain.
Documentation
ARCHITECTURE.md— how the server is built and why: layer boundaries, the mechanism/policy split, error philosophy, the semantic layer, and the reasons behind each decision.docs/api-map.md— the local API's behaviour, including the undocumented parts, verified against a live instance, with the measurements.docs/stack-evaluation.md— why TypeScript, with numbers.CONTRIBUTING.md— how to work on this.
Support
thebrain-mcp is built and maintained in spare time. If it earns a place in your workflow, you can sponsor it on GitHub — once or monthly.
License
MIT
Available Tools
17 toolsbrain_activateA
Opens a thought in the user's TheBrain app on screen. Call it to show the person a result — for instance a structure you have just created, so they can see it in the graph.
Inputs: brainId (required), thoughtId (required).
brain_append_noteA
Appends text to the end of a note without erasing anything. The main way to accumulate material on a thought. If no note exists yet, one is created.
Inputs: brainId (required), markdown (required), thoughtId (required).
brain_attach_urlB
Attaches a link to a thought. Checks first whether the same URL is already attached and avoids duplicates. Leave name empty to take the title from the page.
Inputs: url (required), brainId (required), thoughtId (required), name.
brain_create_thoughtA
Creates a thought and sets its note, type and tags in the same call. Call it when adding something new. Always supply parentId — a thought with no links gets lost in the graph. Search first: a suitable thought may already exist, in which case extending it is the better move.
Inputs: name (required), brainId (required), note, label, +4 more.
brain_delete_thoughtA
Permanently deletes a thought along with its note and links. There is no undo. Requires human confirmation. Do not call it to tidy up on your own initiative — only when the user explicitly asked for a deletion.
Inputs: brainId (required), thoughtId (required), confirm.
brain_get_thoughtA
A thought in full: note, parents, children, jumps, tags, type and attachments in one call. The main way to understand a thought's context. Call it when you need to know what a thought is about and how it connects, before changing or extending it.
Inputs: brainId (required), thoughtId (required), includeSiblings.
brain_indexA
Manages the semantic index: status, build, refresh. Call with action=status when brain_search complains the index is missing; with action=rebuild to build it for the first time or after changing the model; with action=sync to pull in changes (fast, new material only). The first build on a large brain takes minutes.
Inputs: action (required), brainId (required).
brain_ingestA
Writes a whole structure of thoughts, links, notes and tags in a single call. Call it once you have decomposed some material (an article, a document, a discussion) into several connected thoughts — creating them one by one at that volume is slow and breaks halfway. Thoughts reference each other by tempId, arbitrary labels you invent yourself; the server substitutes real identifiers. A parent may be either a tempId from this batch or the UUID of an existing thought, which is how a new branch grafts onto what the brain already holds. Search with brain_search first: some of the thoughts may already exist, and linking to them beats creating duplicates.
Inputs: brainId (required), thoughts (required), links, deduplicate.
brain_linkA
Links two thoughts. Call it when you spot a meaningful relationship between existing thoughts — links are what make a brain a graph rather than a list. Label the link via name: "motivates", "solved by", "contradicts".
Inputs: toId (required), fromId (required), brainId (required), name, +1 more.
brain_listA
Lists the user's brains and which one is currently open in the app. Call this first in any session: every other tool needs a brainId and guessing one is not allowed. Also shows whether the semantic index is ready.
Inputs: no named parameters.
brain_list_types_and_tagsA
The brain's vocabulary: which thought types and tags exist. Call it before creating thoughts so you use this brain's established conventions instead of inventing new ones.
Inputs: brainId (required).
brain_recent_changesA
What changed in the brain over a period, in plain language. Call it for digests ("what did I add this week") and to understand what work was in progress before continuing it.
Inputs: brainId (required), limit, since.
brain_searchA
Finds thoughts by meaning. Call it when looking for something by description rather than exact title — for instance to check whether a thought on this topic already exists. Always pass variants: several phrasings of the same concept (synonyms, translation, a broader and a narrower term). They raise recall noticeably, and if the semantic index is not built they are all that works.
Inputs: query (required), brainId (required), limit, variants, +1 more.
brain_set_noteA
Replaces a thought's note entirely. The previous text is lost — to add rather than replace, call brain_append_note. Read an existing note with brain_get_thought before overwriting it.
Inputs: brainId (required), markdown (required), thoughtId (required).
brain_tagA
Attaches and removes a thought's tags. Tags are separate thoughts of a special kind; take their identifiers from brain_list_types_and_tags, and create a new tag via brain_create_thought. A single call can both add and remove.
Inputs: brainId (required), thoughtId (required), add, remove.
brain_traverseA
Walks the graph several hops out from a thought. Call it when you need to see the whole neighbourhood: which region of the brain adjoins a topic, where new material should slot in, what already sits nearby. Viewing a thought shows one hop only.
Inputs: brainId (required), thoughtId (required), depth, follow, +1 more.
brain_update_thoughtA
Changes a thought's properties: title, caption, type, colours. Call it to rename or reclassify. It does not touch the note — use brain_set_note or brain_append_note for that.
Inputs: brainId (required), thoughtId (required), name, label, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 17 tools
Each tool maps to a distinct resource+action, and the overlapping-looking pairs are explicitly delineated in descriptions: set_note (replace) vs append_note (append), get_thought (one hop) vs traverse (several hops), create_thought (single) vs ingest (bulk). An agent can reliably pick the right tool.
Every tool uses a uniform brain_ prefix with snake_case verb_noun naming (brain_search, brain_create_thought, brain_delete_thought, brain_attach_url). The convention is applied consistently across all 17 tools with no stylistic drift.
17 tools is slightly on the heavy side but each earns its place within a graph domain (search, read, traverse, mutate thoughts/notes/links/tags, index management). No redundant tools bloat the surface.
Strong lifecycle coverage: create/get/update/delete thoughts, note set/append, link, tag add/remove, URL attach, search, traverse, ingest and index management. Minor gaps exist (e.g. no explicit link-removal or parent-reparenting operation), but core workflows are fully supported.
Maintenance
Related MCP Connectors
MCP server for querying BrainKB, a knowledge base for neuroscience knowledge graphs.
Personal knowledge base MCP server with semantic search, auto-categorization, metadata extraction
Personal knowledge graph as an AI memory layer over MCP - read, save, and link your memories.
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceA personal knowledge base MCP server with semantic search, storing thoughts in PostgreSQL with pgvector embeddings and providing 8 tools for capture, search, browse, stats, relations, traces, and hydration.1Apache 2.0
- FlicenseNot gradedqualityDmaintenanceWraps TheBrain knowledge graph as an MCP server, enabling AI assistants to search, create, and manage thoughts, links, and notes via natural language.5-
- AlicenseNot gradedqualityCmaintenanceA universal MCP server providing persistent, structured memory through a knowledge graph with graph storage, semantic vector search, and multi-hop traversal for AI agents and IDEs.60 PyPI1MIT
- AlicenseNot gradedqualityDmaintenanceMCP server that provides semantic memory with search, related-content traversal, and write-back capabilities, all powered by local embeddings of your notes, documents, and chat histories.2MIT