brain-mcp
# brain-mcp
MIT MCP adapter for the [Ladvoy brain](https://github.com/ladvoy/brain). The brain returns **structured context blocks**; the client LLM writes the natural answer.
```
Hermes / Cursor --stdio--> brain-mcp --HTTP--> brain /v1
```
## Tools
| Tool | Brain call |
|---|---|
| `get_context` | `POST /v1/projects/{id}/context` |
| `get_portrait` | `GET /v1/projects/{id}/cards/{slug}` |
| `propose_memory` | `POST …/cards/{slug}/facts` (pending without source) |
| `search_audit` | `GET …/audit` |
## Setup
```bash
npm install
npm run build
```
Environment:
| Var | Required | Meaning |
|---|---|---|
| `BRAIN_BASE_URL` | no (default `http://127.0.0.1:8080`) | Brain origin |
| `BRAIN_PROJECT_ID` | yes | Project slug |
| `BRAIN_CONTEXT_TOKEN` | yes | Query-plane token |
| `BRAIN_ADMIN_TOKEN` | for portrait / propose / audit | Privileged token |
| `BRAIN_PRINCIPAL` | yes | Principal slug for this MCP process |
## Hermes / Cursor
Copy [`examples/mcp.rebecca.json`](examples/mcp.rebecca.json) or [`examples/mcp.rose.json`](examples/mcp.rose.json) into your MCP config (replace tokens and `cwd`). **One process per principal** in v0 — run two server entries for two-role dogfood.
## Dogfood (isolation)
With brain running and Carter imported into the project:
```bash
export BRAIN_BASE_URL=http://127.0.0.1:18080
export BRAIN_PROJECT_ID=carter
export BRAIN_CONTEXT_TOKEN=…
export BRAIN_PRINCIPAL=rebecca # required by config loader; overridden per role in the script
npm run dogfood
```
Asserts: rebecca gets child interpretation (no `urologist`); rose gets the original health fact.
## License
MIT — see [LICENSE](LICENSE).
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose: context retrieval, portrait retrieval, memory proposal, and audit search. The descriptions explicitly steer agents away from overlapping uses, such as preferring get_context over get_portrait for free-form questions.
All four tools follow a consistent snake_case verb_noun pattern: get_context, get_portrait, propose_memory, search_audit. The naming is predictable and easy to scan.
Four tools is well-scoped for a focused family-memory server covering read, proposal, and audit operations. Each tool has a distinct role and none feels redundant.
The surface covers reading context, reading portraits, proposing pending memory facts, and searching audit records. However, there is no tool to confirm, reject, update, delete, or list pending memory proposals, which leaves the proposal lifecycle incomplete.