Skip to content

Quickstart, Self-Hosted

From fresh clone to source-backed answers

Myco Brain is a self-hosted memory layer for AI agents, open source under Apache-2.0, exposing 11 brain_* tools to any MCP client. Self-hosting is the default; one docker compose up boots the whole stack.

Before you start

  • Docker and Docker Compose v2
  • An MCP client: Claude Desktop, Cursor, Windsurf, Continue, or Zed
  • No API keys required for the first run
  1. Step 1

    Boot the stack

    Clone the repo and bring everything up with Docker Compose. Three services start: Postgres 16 + pgvector, the MCP server, and the extraction worker, with a seeded default workspace, so it works with zero configuration.

    git clone https://github.com/thegoodguysla/myco-brain.git
    cd myco-brain
    docker compose up -d

    Verify with docker compose ps.

  2. Step 2

    See it work in 30 seconds

    Ingest the bundled demo corpus, a small set of interconnected documents for a fictional agency and its client. Full-text (BM25) search and ingestion are keyless, so no API key is needed.

    npx -y -p @mycobrain/mcp-server mycobrain-ingest ./examples/demo-corpus

    After connecting your client in step 3, ask: “When does Northwind’s rebrand launch, and who owns the account?”

    Follow up with: “Show me the source for that.”

  3. Step 3

    Connect Claude Desktop

    Add Myco Brain to ~/Library/Application Support/Claude/claude_desktop_config.json, then restart Claude Desktop. Using Cursor, Windsurf, Continue, or Zed instead? Point your client’s MCP settings at the same command and env vars.

    {
      "mcpServers": {
        "myco-brain": {
          "command": "npx",
          "args": ["-y", "@mycobrain/mcp-server"],
          "env": {
            "DATABASE_URL": "postgresql://brain:brain@localhost:5432/brain",
            "BRAIN_WORKSPACE_ID": "00000000-0000-0000-0000-000000000001",
            "BRAIN_API_KEY": "brain_00000000-0000-0000-0000-000000000001_00000000-0000-0000-0000-0000000000a1_localdev"
          }
        }
      }
    }

    These exact values work for everyone, on purpose. localhost is your own machine (the Docker stack from step 1), and the workspace ID and API key are local-dev defaults seeded into every fresh install. Your database, on your computer; nothing is shared between installs.

    Happy-path test: save a memory in one session (“remember that the board meeting is every Wednesday at 9 AM Pacific”), open a fresh session, and ask for it back.

  4. Step 4

    Bulk ingest your own knowledge

    Point the ingest CLI at a local folder or a whole GitHub repo. It skips binaries and noise directories like node_modules and .git automatically.

    export DATABASE_URL=postgresql://brain:brain@localhost:5432/brain
    export BRAIN_WORKSPACE_ID=00000000-0000-0000-0000-000000000001
    export BRAIN_API_KEY=brain_00000000-0000-0000-0000-000000000001_00000000-0000-0000-0000-0000000000a1_localdev
    
    npx -y -p @mycobrain/mcp-server mycobrain-ingest ./docs
    npx -y -p @mycobrain/mcp-server mycobrain-ingest github:owner/repo

    Set GITHUB_TOKEN to ingest private repos.

Optional, Level up

Semantic search, fully local

Set BRAIN_EMBED_PROVIDER=ollama (with BRAIN_OLLAMA_BASE_URL and the nomic-embed-text model pulled) for keyless vector search via local embeddings, auto-selected when Ollama is configured and no OpenAI key is present. Prefer hosted? BRAIN_OPENAI_API_KEY still works. Full-text search stays keyless either way.

Knowledge graph, fully local

Set BRAIN_OLLAMA_BASE_URL (e.g. http://host.docker.internal:11434) to extract entities and relationships with a local Ollama model, no API key, nothing leaves your machine. Extraction is direction-aware as of v1.1.0.

Knowledge graph, most accurate

Set BRAIN_ANTHROPIC_API_KEY to use Anthropic for extraction, it produces the most accurate graph.

Where everything lives

Quickstart, Self-Hosted Myco Brain