Brainllm
Persistent, graph-structured memory for Claude and MCP clients, kept in TriliumNext
- Pricing
- Open source
- Platforms
- self-hosted, CLI, API
- Runs
- Locally
- Version
- 13.3.2
- Listing updated
- 3 days ago
About Brainllm
Brainllm is an open-source MCP server for knowledge and memory. It runs locally on your machine and is started by your AI client.
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.
Install
Run in a 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 brainllmAdd to claude_desktop_config.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>"
}
}
}
}Add to ~/.cursor/mcp.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>"
}
}
}
}Add to .vscode/mcp.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>"
}
}
}
}Add to ~/.codeium/windsurf/mcp_config.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>"
}
}
}
}Add to your client's MCP settings (most use this shape)
{
"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>"
}
}
}
}Configuration
TRILIUM_BASE_URLBase URL of the TriliumNext instance, e.g. http://localhost:8080RequiredTRILIUM_ETAPI_TOKENETAPI token. Required unless TRILIUM_PASSWORD is set. Create one in Trilium under Options → ETAPI.TRILIUM_PASSWORDAlternative to TRILIUM_ETAPI_TOKEN — BrainLLM mints a token on first start and caches it beside brainllm.json.BRAINLLM_MODEcore (default) exposes the 45 brain-aware tools; full additionally exposes the 33 raw ETAPI tools.BRAINLLM_TZIANA timezone used to stamp dated notes, e.g. Africa/Johannesburg. Defaults to the host timezone.BRAINLLM_OWNER_PASSWORDEnables the OAuth 2.1 / CIMD endpoints required by claude.ai and other hosted Claude surfaces. This is the password entered on the consent screen when authorizing a client.BRAINLLM_OAUTH_SECRETOptional 32+ character deployment secret for signing OAuth tokens; rotate it to invalidate old tokens.BRAINLLM_PUBLIC_URLOverride for the public origin when a proxy rewrites Host. Must exactly match the URL entered in the client.BRAINLLM_ALLOW_UNAUTHENTICATED_HTTPExplicit trusted-network-only escape hatch for HTTP mode. Never enable on a public interface.BRAINLLM_TRUST_PROXYTrust forwarded host/protocol headers for OAuth discovery only when a trusted reverse proxy sets them.
What it does
- 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
Pricing
Open source
Free under the MIT licence; you host TriliumNext
Prices change. Check miiso.dev before you buy.
Brainllm 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 to Brainllm

Codebase Memory
MCP serverLocal MCP server that builds a code knowledge graph for AI coding agents
Runs locally- Open source
- 48.7K GitHub stars
- Knowledge and memory

XERJ
MCP serverLocal search engine for AI agents with cited answers over your code and docs
Runs locally- Open source
- 19.2K GitHub stars
- Knowledge and memory

Claude Code Ultimate Guide
MCP serverMCP server for searching the Claude Code Ultimate Guide from any MCP client
Runs locally- Open source
- 6.5K GitHub stars
- AI models and LLM tooling

Nautilus Compass Memory
MCP serverLocal-first long-term memory layer for AI agents, served over MCP
Not checked yet- 5 tools
- Remote
- Open source
- 1.3K GitHub stars
- Knowledge and memory

note1
MCP serverMCP server giving AI assistants search and summaries across your note1 meetings
- 4 tools
- Remote
- Free trial
- 1 GitHub star
- Productivity
MedXpert 图书馆连接器(通用版)
MCP serverLocal MCP server that searches and answers questions over your own Markdown wiki
Runs locally- 4 tools
- Open source
- Knowledge and memory