PTENES
MCP server · second brain

A brain. Several AI clients.

Exposes the astra-2cerebro kit's Markdown folder as MCP tools for Claude Code, Codex, Claude Desktop, n8n, and bots. Read-only by default; writing only if you enable it.

Illustration of a brain connected to several AI assistants
What it is

Your second brain, in any MCP client

The astra-2cerebro kit stores who you are, your priorities, decisions, projects, and a linked wiki in Markdown files. cerebro-mcp starts an MCP server pointed to that folder, and each client gets the tools cerebro_*. The brain remains just files; what changes is who can read them.

🧠 Thirteen tools, one folder

Context, priorities, route map, search, reading, wiki, projects, connections, and routines. Plus three writing tools (decision, source, execution) that only appear when you enable --escrita.

🔒 Only within the brain

Every path goes through a check that blocks ../, absolute paths from outside, symlinks pointing outside, .git, node_modules e .env. Nothing leaves the machine.

🔌 stdio or HTTP

Via stdio for Claude Code, Codex, and Claude Desktop. With --http, an endpoint at 127.0.0.1 for n8n, bots, and scripts. No index, no database: reads from disk on the fly.

How it works

From the client to the Markdown file

The client starts the server as a child process, asks which tools are available, and calls them when needed. The server reads the folder on the spot and returns Markdown text with the file path so the model can cite the source.

MCP client→ bin/cerebro-mcp.mjs→ resolverDir (--dir / CEREBRO_DIR / current folder)→ cerebro_* tools→ caminhoSeguro→ .md from the brain→ text with path
1

Find

--dir, then CEREBRO_DIR, then the current folder if it exists AGENTS.md or CLAUDE.md. Without a brain, a clear error and exit code 1.

2

Record

Ten read tools and the resources cerebro:// always; the three write tools only with --escrita or CEREBRO_ESCRITA=1.

3

Answer

Each call reads from disk, builds Markdown, and returns it. A predictable error becomes isError; the process never crashes because of a bad call.

ToolWhat it doesWriting
cerebro_contexto()about-me + about-the-work + priorities, with the pathsno
cerebro_prioridades()only contexto/prioridades.mdno
cerebro_rotas()the “Route map” section of AGENTS.md / CLAUDE.mdno
cerebro_buscar(consulta, limite?)search for terms across all .md files, with excerpt and relevanceno
cerebro_ler(caminho)contents of a file or folder listing, only within the brainno
cerebro_wiki_indice() · cerebro_wiki_pagina(slug)wiki index and page by slugno
cerebro_projetos() · cerebro_conexoes() · cerebro_rotinas()projects with status, connections table, routines, and executionsno
cerebro_registrar_decisao(...)dated entry in decisoes/registro.mdyes
cerebro_adicionar_fonte(nome, conteudo)fontes/AAAA-MM-DD-slug.md, without overwritingyes
cerebro_registrar_execucao(id, resultado, ...)new line in the routine execution logyes
Prerequisites

Three things before you start

No database, no external service. Just Node, a brain folder, and an MCP client.

Node.js 20+

The server is pure ESM. If you use Claude Code or Codex, you already have it.

# check the version
node --version

A brain from the astra-2cerebro kit

A folder with AGENTS.md/CLAUDE.md, contexto/, wiki/, decisoes/. If you don’t have one yet, install the kit.

# the kit creates the structure
git clone https://github.com/inematds/astra-2cerebro

An MCP client

Claude Code, Codex, Claude Desktop — or n8n/a bot in HTTP mode.

# example: Claude Code installed
claude mcp list
User guide · step by step

From cloning to asking "what are my priorities?" for the first time

All commands are real and in the repository. Replace /home/voce/meu-cerebro through your brain folder.

1

Clone and install

Downloads the server, installs the official SDK, and runs the 42 tests against the included fixture.

git clone https://github.com/inematds/cerebro-mcp.git
cd cerebro-mcp
npm install
npm test   # ℹ tests 42 · pass 42 · fail 0
2

Test against your brain (without any client)

The script starts the actual binary and communicates over JSON-RPC via stdio: initialize, tools/list, tools/call.

node scripts/teste-stdio.mjs /home/voce/meu-cerebro
# OK  initialize → cerebro-mcp server 1.0.0 (protocol 2025-06-18)
# OK  tools/list → 10 tools: cerebro_contexto, cerebro_prioridades, ...
# OK  tools/call cerebro_ler ../../etc/passwd → isError (Access denied)
3

Record in Claude Code

One line. To let the agent record decisions and sources, add --escrita at the end.

claude mcp add cerebro -e CEREBRO_DIR=/home/voce/meu-cerebro -- node /home/voce/cerebro-mcp/bin/cerebro-mcp.mjs
# or, versioned in the project: .mcp.json with {"mcpServers":{"cerebro":{"command":"node","args":[...],"env":{"CEREBRO_DIR":"..."}}}}
4

Or in Codex / Claude Desktop

Codex reads ~/.codex/config.toml; Claude Desktop reads claude_desktop_config.json. INSTALAR.md has both complete examples.

# ~/.codex/config.toml
[mcp_servers.cerebro]
command = "node"
args = ["/home/voce/cerebro-mcp/bin/cerebro-mcp.mjs"]
[mcp_servers.cerebro.env]
CEREBRO_DIR = "/home/voce/meu-cerebro"
5

Chat

The agent decides on its own when to call each tool. Start with what requires context.

# you: Quais são as minhas prioridades deste trimestre?
# agent → cerebro_prioridades() → responds citing contexto/prioridades.md
# you: Por que decidimos fazer o site em gerador estático?
# agent → cerebro_buscar("static site") → cerebro_ler("decisoes/registro.md")
6

HTTP mode for n8n, bots, and scripts

Runs on 127.0.0.1, without a session. Requires the header Accept: application/json, text/event-stream; tools/call works without initialize before.

CEREBRO_DIR=/home/voce/meu-cerebro node bin/cerebro-mcp.mjs --http 3333
curl -s http://127.0.0.1:3333/mcp -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"cerebro_prioridades","arguments":{}}}'
Examples

Two conversations the server makes possible

The same folder, two different clients. The agent calls the tools; you just ask.

You (in Codex): What did Company X ask for at the last meeting?

→ cerebro_wiki_pagina("empresa-x") → cerebro_ler("wiki/fontes/2026-09-01-reuniao-empresa-x.md")

Agent: Approved the phase 2 scope, with a deadline at the end of October, and agreed to decide who will validate the weekly reports (source: wiki/fontes/2026-09-01-reuniao-empresa-x.md).

Reading: the wiki answers with the cited source.

You (in Claude Code, server with --escrita): Records that we’ll accept phase 2, with a deadline in October, because phase 1 was approved.

→ cerebro_registrar_decisao(titulo, decisao, porque)

Agent: Recorded in decisoes/registro.md with today’s date: "## 2026-09-07: Accept phase 2 of Projeto Alfa". Would you like me to note the alternatives considered?

Writing: input in the kit's format, append-only.
Roadmap

What’s ready and what’s next

Version 1.0.0 covers the kit's entire lifecycle. The next phases are about convenience, not foundations.

v1.0 ✓
Full server13 tools, cerebro:// resources, stdio and HTTP, path blocking, 42 tests, stdio and HTTP smoke tests, documentation in PT-BR (README, INSTALAR, docs/).
next
Ready-to-use MCP promptsExpose prompts like "daily summary" and "review this month's decisions" that already chain together the right tools.
after
Optional index for large brainsSearch cache rebuilt when a file changes, keeping index-free behavior as the default.
idea
Simple authentication in HTTP modeA token in an environment variable to expose the server on a trusted network without a proxy.