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

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

brain_list

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.

brain_get_thought

A thought in full: note, aliases, 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.

ParameterTypeDescription
brainId *stringBrain identifier. Take it from brain_list — never guess it.
thoughtId *stringThought identifier.
includeSiblingsbooleanInclude siblings under the same parent. Off by default — there can be many.

brain_traverse

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.

ParameterTypeDescription
brainId *stringBrain identifier. Take it from brain_list — never guess it.
thoughtId *stringWhere to start.
depthintegerHops. Defaults to 2.
followarrayWhich link kinds to follow. All of them by default.
maxNodesintegerSafety valve. Defaults to 150.

brain_list_types_and_tags

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.

ParameterTypeDescription
brainId *stringBrain identifier. Take it from brain_list — never guess it.

brain_recent_changes

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.

ParameterTypeDescription
brainId *stringBrain identifier. Take it from brain_list — never guess it.
identifiersbooleantrue adds a list of the thoughts in the result with their identifiers, for reading or changing one next. Defaults to false.
limitintegerDefaults to 100.
sincestringISO timestamp to start from, UTC unless it carries an offset. Defaults to the last seven days.

brain_index

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.

ParameterTypeDescription
action *stringstatus — look only; rebuild — build from scratch; sync — catch up.
brainId *stringBrain identifier. Take it from brain_list — never guess it.

brain_create_thought

Creates a thought and sets its note, type, tags and aliases 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.

ParameterTypeDescription
brainId *stringBrain identifier. Take it from brain_list — never guess it.
name *stringThought title. Short and to the point.
aliasesarrayAlternate names that TheBrain's search matches too. Saving a brain's first alias makes that brain require TheBrain 15.0.621 or later on every device, so write aliases only when the user wants them in…
labelstringShort caption under the title.
notestringNote body in Markdown.
parentIdstringWhat to attach it to. Without this the thought is left orphaned. Not a type: a thought made under one would get that type and no parent, so a type goes in typeId. Not a tag either: that goes in tagIds…
relationstringHow the new thought relates to that one. Child by default. For a sibling of a thought, give that thought's parent as parentId. Refused without parentId.
tagIdsarrayTag identifiers from brain_list_types_and_tags.
typeIdstringType identifier from brain_list_types_and_tags.

brain_update_thought

Changes a thought's properties: title, caption, aliases, type, colours. Call it to rename or reclassify. It does not touch the note — use brain_set_note or brain_append_note for that.

ParameterTypeDescription
brainId *stringBrain identifier. Take it from brain_list — never guess it.
thoughtId *stringWhich thought to change.
addAliasesarrayAlternate names to add to the ones the thought has; TheBrain's search matches them too. Saving a brain's first alias makes that brain require TheBrain 15.0.621 or later on every device, so write alias…
backgroundColorstring | nullBackground colour; null clears it.
foregroundColorstring | nullText colour, for example #ff7145; null clears it.
labelstring | nullCaption; null clears it.
namestringNew title.
removeAliasesarrayAliases to drop, matched ignoring case.
typeIdstring | nullType identifier from brain_list_types_and_tags; null removes the type.

brain_set_note

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.

ParameterTypeDescription
brainId *stringBrain identifier. Take it from brain_list — never guess it.
markdown *stringThe complete new note body, in Markdown.
thoughtId *string

brain_append_note

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.

ParameterTypeDescription
brainId *stringBrain identifier. Take it from brain_list — never guess it.
markdown *stringWhat to append, in Markdown.
thoughtId *string

brain_tag

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_type_or_tag. A single call can both add and remove.

ParameterTypeDescription
brainId *stringBrain identifier. Take it from brain_list — never guess it.
thoughtId *string
addarrayTag identifiers to attach.
removearrayTag identifiers to remove.

brain_create_type_or_tag

Creates a thought type or a tag: the vocabulary thoughts are classified with, which brain_create_thought cannot make. Call it when brain_list_types_and_tags has none that fits. Under the name of a tag the brain has, in any letter case, no second tag is made and the result gives that one. A type is made even when another has the name.

ParameterTypeDescription
brainId *stringBrain identifier. Take it from brain_list — never guess it.
kind *stringA type is what typeId takes; a tag is what brain_tag and tagIds take.
name *stringIts name, as TheBrain will show it.

brain_attach_url

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.

ParameterTypeDescription
brainId *stringBrain identifier. Take it from brain_list — never guess it.
thoughtId *string
url *stringPage address.
namestringAttachment name; empty means use the page title.

brain_activate

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.

ParameterTypeDescription
brainId *stringBrain identifier. Take it from brain_list — never guess it.
thoughtId *string

brain_delete_thought

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.

ParameterTypeDescription
brainId *stringBrain identifier. Take it from brain_list — never guess it.
thoughtId *string
confirmbooleanSet to true only after a human has confirmed the deletion. Do not decide this on their behalf.

brain_ingest

Writes a whole structure of thoughts, links, notes, tags and aliases 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 thought…

ParameterTypeDescription
brainId *stringBrain identifier. Take it from brain_list — never guess it.
thoughts *arrayThe batch's thoughts. Order does not matter; dependencies resolve themselves.
deduplicatebooleanSkip creating a thought when its parent already has one of that name under the same relation. On by default, which makes re-running a batch safe. A thought of that name under another relation is neith…
linksarrayExtra links on top of the hierarchy. These are what turn a set of thoughts into a graph — use them freely and label them. Neither a type nor a tag can be the parent end of a child or parent link: se…