# Brainllm

> Brainllm is an open-source MCP server for knowledge and memory. Persistent, graph-structured memory for Claude and MCP clients, kept in TriliumNext. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** self-hosted, CLI, API
- **Website:** https://miiso.dev/brainllm
- **Repository:** https://github.com/miisodev/brainllm
- **MCP Registry name:** io.github.miisodev/brainllm
- **Categories:** knowledge and memory
- **Listing updated:** 2026-11-14

## About

BrainLLM stores an assistant's memory as notes in a TriliumNext instance you host, then reads them back at the start of each session. Its guiding rule is that the model supplies content while the server owns form: placement, labels, deduplication, lifecycle, dates and structure are enforced by the server, not requested in a prompt. Sessions open by loading preferences, protocols and recent changes, and a close gate refuses to finish until the session record is written.

Notes are linked by sixteen relation verbs with backlinks, paths and a rendered Mermaid view. Content writes take a revision first, edits can be previewed, and consistency checks flag a fact stated two different ways. The default core mode exposes 45 brain-aware tools, and full mode adds 33 raw ETAPI tools.

It is MIT licensed, written in Bun and TypeScript, and installs from npm. It runs over stdio locally or as an authenticated HTTP service with OAuth, optional authenticator codes and replay protection when hosted for claude.ai. You provide and run the TriliumNext instance, and it needs an ETAPI token or password.

## Features

- **Server-owned structure:** Placement, labels, dedup and dates are deterministic server policy.
- **Typed relation graph:** Sixteen relation verbs link notes, with backlinks, paths and a Mermaid view.
- **Safe writes:** Revisions are taken before content writes, with previews and consistency checks.
- **Session lifecycle:** Sessions open from saved context and a close gate requires the record to be written.
- **Core and full modes:** Core exposes 45 tools; full adds 33 raw ETAPI tools.
- **Hosted OAuth:** HTTP mode sits behind OAuth with optional authenticator codes.

## Good for

- Keep an assistant's context between coding sessions
- Maintain sourced domain notes the model can cite and correct
- Browse and edit an AI's memory in your own note app
- Run a long-term research collaborator with a diary and logs
- Connect claude.ai to a self-hosted memory

## Install

### Claude Code (Terminal)

```sh
claude mcp add brainllm --env TRILIUM_BASE_URL='<TRILIUM_BASE_URL>' --env TRILIUM_ETAPI_TOKEN='<TRILIUM_ETAPI_TOKEN>' --env TRILIUM_PASSWORD='<TRILIUM_PASSWORD>' --env BRAINLLM_OWNER_PASSWORD='<BRAINLLM_OWNER_PASSWORD>' --env BRAINLLM_OAUTH_SECRET='<BRAINLLM_OAUTH_SECRET>' -- npx -y brainllm
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "brainllm": {
      "command": "npx",
      "args": [
        "-y",
        "brainllm"
      ],
      "env": {
        "TRILIUM_BASE_URL": "<TRILIUM_BASE_URL>",
        "TRILIUM_ETAPI_TOKEN": "<TRILIUM_ETAPI_TOKEN>",
        "TRILIUM_PASSWORD": "<TRILIUM_PASSWORD>",
        "BRAINLLM_OWNER_PASSWORD": "<BRAINLLM_OWNER_PASSWORD>",
        "BRAINLLM_OAUTH_SECRET": "<BRAINLLM_OAUTH_SECRET>"
      }
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "brainllm": {
      "command": "npx",
      "args": [
        "-y",
        "brainllm"
      ],
      "env": {
        "TRILIUM_BASE_URL": "<TRILIUM_BASE_URL>",
        "TRILIUM_ETAPI_TOKEN": "<TRILIUM_ETAPI_TOKEN>",
        "TRILIUM_PASSWORD": "<TRILIUM_PASSWORD>",
        "BRAINLLM_OWNER_PASSWORD": "<BRAINLLM_OWNER_PASSWORD>",
        "BRAINLLM_OAUTH_SECRET": "<BRAINLLM_OAUTH_SECRET>"
      }
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "brainllm": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "brainllm"
      ],
      "env": {
        "TRILIUM_BASE_URL": "<TRILIUM_BASE_URL>",
        "TRILIUM_ETAPI_TOKEN": "<TRILIUM_ETAPI_TOKEN>",
        "TRILIUM_PASSWORD": "<TRILIUM_PASSWORD>",
        "BRAINLLM_OWNER_PASSWORD": "<BRAINLLM_OWNER_PASSWORD>",
        "BRAINLLM_OAUTH_SECRET": "<BRAINLLM_OAUTH_SECRET>"
      }
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "brainllm": {
      "command": "npx",
      "args": [
        "-y",
        "brainllm"
      ],
      "env": {
        "TRILIUM_BASE_URL": "<TRILIUM_BASE_URL>",
        "TRILIUM_ETAPI_TOKEN": "<TRILIUM_ETAPI_TOKEN>",
        "TRILIUM_PASSWORD": "<TRILIUM_PASSWORD>",
        "BRAINLLM_OWNER_PASSWORD": "<BRAINLLM_OWNER_PASSWORD>",
        "BRAINLLM_OAUTH_SECRET": "<BRAINLLM_OAUTH_SECRET>"
      }
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "brainllm": {
      "command": "npx",
      "args": [
        "-y",
        "brainllm"
      ],
      "env": {
        "TRILIUM_BASE_URL": "<TRILIUM_BASE_URL>",
        "TRILIUM_ETAPI_TOKEN": "<TRILIUM_ETAPI_TOKEN>",
        "TRILIUM_PASSWORD": "<TRILIUM_PASSWORD>",
        "BRAINLLM_OWNER_PASSWORD": "<BRAINLLM_OWNER_PASSWORD>",
        "BRAINLLM_OAUTH_SECRET": "<BRAINLLM_OAUTH_SECRET>"
      }
    }
  }
}
```

## FAQ

### Where is the memory stored?

In your own TriliumNext instance, which you provide and run.

### What licence is it under?

MIT.

### What does it need to start?

A TriliumNext base URL plus an ETAPI token or a Trilium password.

### How many tools are there?

45 in core mode, with 33 more raw ETAPI tools in full mode.

### Is Brainllm free?

Yes. Brainllm is open source, so you can use and self-host it for free.

### How do I add Brainllm to Claude Code?

Run this command in your terminal: claude mcp add brainllm --env TRILIUM_BASE_URL='<TRILIUM_BASE_URL>' --env TRILIUM_ETAPI_TOKEN='<TRILIUM_ETAPI_TOKEN>' --env TRILIUM_PASSWORD='<TRILIUM_PASSWORD>' --env BRAINLLM_OWNER_PASSWORD='<BRAINLLM_OWNER_PASSWORD>' --env BRAINLLM_OAUTH_SECRET='<BRAINLLM_OAUTH_SECRET>' -- npx -y brainllm

### What are the best alternatives to Brainllm?

The closest alternatives to Brainllm are Codebase Memory, XERJ, Claude Code Ultimate Guide, Nautilus Compass Memory and note1.

## Alternatives

- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Nautilus Compass Memory](https://ai-powered.com/mcp/nautilus-compass-memory): Nautilus Compass Memory is an open-source MCP server for knowledge and memory.
- [note1](https://ai-powered.com/mcp/note1): note1 is an MCP server for productivity.
- [MedXpert 图书馆连接器（通用版）](https://ai-powered.com/mcp/medxpert): MedXpert 图书馆连接器（通用版） is an open-source MCP server for knowledge and memory.
- [Context Nest](https://ai-powered.com/mcp/context-nest): Context Nest is a freemium MCP server for knowledge and memory.
- [Tulsa Ecosystem Map](https://ai-powered.com/mcp/tulsa-ecosystem-map): Tulsa Ecosystem Map is a free MCP server for knowledge and memory.

---
Source: https://ai-powered.com/mcp/brainllm
