Skip to content
MCP server

Second Brain

Shared markdown memory for agents with wikilink recall, tasks and agent-to-agent messages

Runs locally

Second Brain is an open-source MCP server for knowledge and memory. It runs locally on your machine and is started by your AI client.

Pricing
Open source
Platforms
CLI, Self-hosted, Linux
Runs
Locally
What it can do
Can change data (1 tool)
Version
1.7.1

Similar MCP servers

Install

Add with the CLI

Run in a terminal

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.

Or share it with your project

Add to .mcp.json

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

Claude Code setup guide

Add to claude_desktop_config.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.

Claude Desktop setup guide

Add to ~/.cursor/mcp.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.

Cursor setup guide

Add to ~/.copilot/mcp-config.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.

VS Code setup guide

Add with the CLI

Run in a terminal

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

Or add to config.toml

Add to ~/.codex/config.toml

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

Codex setup guide

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "second-brain": {
      "command": "npx",
      "args": [
        "-y",
        "mind-mri-second-brain"
      ],
      "env": {
        "BRAIN_KEY": "<BRAIN_KEY>"
      }
    }
  }
}
  • Gemini CLI and Antigravity

    Gemini CLI

    Add to ~/.gemini/settings.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

    Antigravity

    Add to ~/.gemini/config/mcp_config.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.

    Gemini CLI and Antigravity setup guide

  • Devin Desktop (formerly Windsurf)

    Add to ~/.config/devin/mcp_config.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.

    Devin Desktop setup guide

  • Cline

    Add to cline_mcp_settings.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.

    Cline setup guide

  • Zed

    Add to Zed settings.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.

    Zed setup guide

  • JetBrains AI Assistant and Junie

    AI Assistant

    Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add

    {
      "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.

    Junie

    Add to ~/.junie/mcp/mcp.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.

    JetBrains AI Assistant and Junie setup guide

  • Kiro

    Add to ~/.kiro/settings/mcp.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.

    Kiro setup guide

Using several servers? Build one config file with the MCP config generator.

Configuration

  • BRAIN_VAULTFolder holding the markdown vault. Defaults to ~/.second-brain/vault when installed from npm.
  • BRAIN_PORTPort of the local API server the MCP server starts and talks to (default 3747).
  • BRAIN_KEYOptional API key; when set the local API requires it as a Bearer token.

About Second Brain

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.

Tools this server provides (3)

Taken from the project documentation; the running server may differ.

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_updateName suggests: changes
Update or append to an existing note.

What it does

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

Pricing

Open source

Second Brain 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.

How AIPoweredBot checks servers