mem-brain-cli · mb

MemBrain CLI

The official mb CLI stores, searches, and manages your persistent memory graph from any terminal — ideal for scripts, CI, and coding agents that can run shell commands.
Install with npm i -g mem-brain-cli, run mb auth login once with your API key, then use mb from Claude Code, Cursor, Gemini CLI, OpenCode, or any other environment that can invoke a CLI.
  • npm global

    Install once: mem-brain-cli → mb everywhere

  • API key login

    mb auth login stores credentials locally

  • Memory graph

    Search, traverse, import, and export

  • Agent-ready I/O

    --json and --toon on every command

Install

Global package, authenticate once with your API key, then use mb from any terminal.

Install
npm i -g mem-brain-cli
Authenticate
mb auth login# optional: non-interactivemb auth login --key YOUR_API_KEY
Credentials are stored locally for the CLI (see mb config path). Use mb auth status to confirm you are signed in.

Interactive mode

Run mb with no arguments (or mb interactive) in a TTY for the REPL, banner, and built-in help.

mb · interactive preview

60-second path

Same flow as mb quickstart — copy and run in order.

From zero to first search
mb auth loginmb add "My first memory" --scope demomb search "first memory" --k 3mb stats

Works wherever a shell runs

No special host required — if it can execute mb, it can use MemBrain.

  • Claude Code

    Claude Code

    Shell out to mb from skills, hooks, or terminal steps.

  • Cursor

    Cursor

    Run mb in the integrated terminal or agent-run commands.

  • Gemini CLI

    Gemini CLI

    Pipe mb --json output into prompts and scripts.

  • opencode

    OpenCode & more

    Anything that can execute CLI can use MemBrain.

Machine-readable output: append --json or --toon to any mb command for pipelines, wrappers, and agent tools. Per-invocation override: --key for an API key without saving it.

Command reference

Expand a category for context, tips, and copy-paste examples. Run mb --help or mb help <command> for every flag.

Store your MemBrain API key locally so every mb subcommand can reach your workspace. Use non-interactive login in CI or headless agents.

Essentials

  • mb auth login — prompt or paste key; add --key for scripts.
  • mb auth status — shows key fingerprint, user id, memory counts.
  • mb auth logout — clears saved credentials from this device.
Examples
mb auth loginmb auth login --key YOUR_API_KEYmb auth statusmb auth logout

Tip: append --json or --toon to parse output in scripts and agents.

See also