# Second Brain

> Second Brain is an open-source MCP server for knowledge and memory. Shared markdown memory for agents with wikilink recall, tasks and agent-to-agent messages. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, Self-hosted, Linux, macOS, Windows
- **Repository:** https://github.com/ara-5/mind-mri-agent-second-brain
- **MCP Registry name:** io.github.ara-5/second-brain
- **Categories:** [knowledge and memory](https://ai-powered.com/categories/knowledge-and-memory), [AI models and LLM tooling](https://ai-powered.com/categories/ai-and-llm)
- **Listing updated:** 2026-11-23

## About

Second Brain stores agent memories as plain markdown notes in an Obsidian-style vault, by default under ~/.second-brain/vault, so you can open and edit what your agents remember. Notes link to each other with wikilinks, and recall returns only the relevant notes plus those they link to, within a token budget, instead of whole files. The README's example shows two notes totalling about 77 tokens.

Search fuses keyword (TF-IDF) ranking, graph traversal, recency and an optional embedding similarity arm; with no embedding provider configured it behaves as keyword search. The project also includes a task queue with dependencies, an agent messenger using inbox notes, near-duplicate detection, a secrets redaction helper and optimistic concurrency through note versions. The author is clear these are lightweight coordination primitives, not an orchestrator.

It runs on Node 22.5 or later with no required npm dependencies, starting a local API on port 3747 that can be protected with BRAIN_KEY. Code execution in Docker is available but refuses to run without it.

## Features

- **Markdown vault:** Memories are plain files you can edit in Obsidian.
- **Graph-aware recall:** Returns matching notes plus linked ones within a token budget.
- **Hybrid ranking:** Keyword, graph and recency, with optional embeddings.
- **Task queue:** Dependency-aware tasks stored as vault notes.
- **Agent messaging:** Inbox and outbox notes between agents.
- **Concurrency check:** Versioned notes reject conflicting updates.

## Good for

- Give several coding agents one persistent project memory
- Record decisions linked to projects and recall them later
- Coordinate pending tasks between agents
- Keep agent knowledge in Obsidian for human review

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add second-brain --env BRAIN_KEY='<BRAIN_KEY>' -- npx -y mind-mri-second-brain
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```json
{
  "mcpServers": {
    "second-brain": {
      "command": "npx",
      "args": [
        "-y",
        "mind-mri-second-brain"
      ],
      "env": {
        "BRAIN_KEY": "<BRAIN_KEY>"
      }
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "second-brain": {
      "command": "npx",
      "args": [
        "-y",
        "mind-mri-second-brain"
      ],
      "env": {
        "BRAIN_KEY": "<BRAIN_KEY>"
      }
    }
  }
}
```

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

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

```json
{
  "mcpServers": {
    "second-brain": {
      "command": "npx",
      "args": [
        "-y",
        "mind-mri-second-brain"
      ],
      "env": {
        "BRAIN_KEY": "<BRAIN_KEY>"
      }
    }
  }
}
```

Use .cursor/mcp.json in a project to share it with the project.

### VS Code (~/.copilot/mcp-config.json)

```json
{
  "mcpServers": {
    "second-brain": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "mind-mri-second-brain"
      ],
      "env": {
        "BRAIN_KEY": "<BRAIN_KEY>"
      }
    }
  }
}
```

Or put the same entry in .mcp.json at your workspace root to share it.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add second-brain --env BRAIN_KEY='<BRAIN_KEY>' -- npx -y mind-mri-second-brain
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.second-brain]
command = "npx"
args = ["-y", "mind-mri-second-brain"]
env = { BRAIN_KEY = "<BRAIN_KEY>" }
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```json
{
  "mcpServers": {
    "second-brain": {
      "command": "npx",
      "args": [
        "-y",
        "mind-mri-second-brain"
      ],
      "env": {
        "BRAIN_KEY": "<BRAIN_KEY>"
      }
    }
  }
}
```

Or run: gemini mcp add -s user -e BRAIN_KEY='<BRAIN_KEY>' second-brain npx -- -y mind-mri-second-brain

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```json
{
  "mcpServers": {
    "second-brain": {
      "command": "npx",
      "args": [
        "-y",
        "mind-mri-second-brain"
      ],
      "env": {
        "BRAIN_KEY": "<BRAIN_KEY>"
      }
    }
  }
}
```

Use .agents/mcp_config.json to add it to one workspace only.

### Devin Desktop (~/.config/devin/mcp_config.json)

```json
{
  "mcpServers": {
    "second-brain": {
      "command": "npx",
      "args": [
        "-y",
        "mind-mri-second-brain"
      ],
      "env": {
        "BRAIN_KEY": "<BRAIN_KEY>"
      }
    }
  }
}
```

On Windows the file is %APPDATA%\\devin\\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

### Cline (cline_mcp_settings.json)

```json
{
  "mcpServers": {
    "second-brain": {
      "command": "npx",
      "args": [
        "-y",
        "mind-mri-second-brain"
      ],
      "env": {
        "BRAIN_KEY": "<BRAIN_KEY>"
      }
    }
  }
}
```

Open it from the MCP Servers icon → Configure → Configure MCP Servers.

### Zed (Zed settings.json)

```json
{
  "context_servers": {
    "second-brain": {
      "command": "npx",
      "args": [
        "-y",
        "mind-mri-second-brain"
      ],
      "env": {
        "BRAIN_KEY": "<BRAIN_KEY>"
      }
    }
  }
}
```

Open it with zed: open settings file. Merge context_servers into the settings you already have.

### JetBrains AI Assistant and Junie: AI Assistant (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```json
{
  "mcpServers": {
    "second-brain": {
      "command": "npx",
      "args": [
        "-y",
        "mind-mri-second-brain"
      ],
      "env": {
        "BRAIN_KEY": "<BRAIN_KEY>"
      }
    }
  }
}
```

The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```json
{
  "mcpServers": {
    "second-brain": {
      "command": "npx",
      "args": [
        "-y",
        "mind-mri-second-brain"
      ],
      "env": {
        "BRAIN_KEY": "<BRAIN_KEY>"
      }
    }
  }
}
```

Use .junie/mcp/mcp.json to share it with a project.

### Kiro (~/.kiro/settings/mcp.json)

```json
{
  "mcpServers": {
    "second-brain": {
      "command": "npx",
      "args": [
        "-y",
        "mind-mri-second-brain"
      ],
      "env": {
        "BRAIN_KEY": "<BRAIN_KEY>"
      }
    }
  }
}
```

Use .kiro/settings/mcp.json to add it to one workspace only.

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

```json
{
  "mcpServers": {
    "second-brain": {
      "command": "npx",
      "args": [
        "-y",
        "mind-mri-second-brain"
      ],
      "env": {
        "BRAIN_KEY": "<BRAIN_KEY>"
      }
    }
  }
}
```

## Tools

From the tool list in its README, going by the names, 1 of 3 tools changes data; 2 names don't say. From the server's own tool labels and tool names; not verified by us.

- `brain_remember`: Save a note to the vault.
- `brain_recall`: Retrieve relevant notes and linked notes within a token budget.
- `brain_node_update` (name suggests: changes): Update or append to an existing note.

## FAQ

### Where is data stored?

As markdown in ~/.second-brain/vault unless BRAIN_VAULT is set.

### Do I need API keys?

No; embedding providers are optional.

### What Node version?

22.5 or later.

### Can I protect the API?

Yes, set BRAIN_KEY to require a Bearer token.

### Is Second Brain free?

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

### How do I add Second Brain to Claude Code?

Run this command in your terminal: claude mcp add second-brain --env BRAIN_KEY='<BRAIN_KEY>' -- npx -y mind-mri-second-brain

### What are the best alternatives to Second Brain?

The closest alternatives to Second Brain are Codebase Memory, XERJ, headroom, omniget and next-ai-draw-io.

## Where this comes from

- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.

## 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.
- [headroom](https://ai-powered.com/mcp/headroom-3): headroom is an open-source MCP server for ai models and llm tooling.
- [omniget](https://ai-powered.com/mcp/omniget): omniget is an open-source MCP server for ai models and llm tooling.
- [next-ai-draw-io](https://ai-powered.com/mcp/next-ai-draw-io-2): next-ai-draw-io is an open-source MCP server for ai models and llm tooling.
- [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.
- [mcp-for-blender](https://ai-powered.com/mcp/mcp-for-blender): mcp-for-blender is an open-source MCP server for design and media.
- [unity-mcp](https://ai-powered.com/mcp/unity-mcp-2): unity-mcp is an open-source MCP server for ai models and llm tooling.

---
Source: https://ai-powered.com/mcp/second-brain
