Skip to main content
Glama

Personal Brain

A personal memory MCP server where every answer cites its source.

My AI assistants (Claude, ChatGPT and others) don't share a trusted memory, and when they answer from my notes they rarely say where the answer came from. Personal Brain is a small, self-hosted service that gives any MCP client read access to my personal records. Every result carries the record id, its source file, a content hash and a review status, so the assistant can cite it and I can verify it.

The first domain is health records: consultations, exams, prescriptions, medication use and follow-ups. It's a domain where a wrong or invented answer is worse than no answer.

ci

Status: early development (phase 1 of 4). This repository contains code and fictional data only. Real records live in a private Git repository on my own server and never touch GitHub (ADR 009).

What makes it different

  • Sourced answers. Every search result returns source and sha256. The tool description instructs the client to cite them.

  • Pending is not a fact. Anything an AI extracts (say, from a photo of a prescription) is stored as pending until I confirm it. Pending records are flagged on every result (ADR 005).

  • Prescribed is not taken. A prescription and the actual medication use are separate records (ADR 004).

  • No invented dates. A record dated 2026-03 keeps month precision; nothing fills in a day.

  • Read-only first, private by default. Two read tools only, a read-only database connection, and no record content or query terms in logs (ADR 006, ADR 007).

Related MCP server: google-health-chatgpt-selfhost

Architecture

flowchart LR
    subgraph clients[MCP clients]
        CD[Claude Desktop / Code]
        CM[Claude mobile]
        GPT[ChatGPT]
    end

    subgraph server[My server]
        MCP[personal-brain<br/>MCP server]
        IDX[(SQLite FTS5<br/>index)]
        REPO[(Git repository<br/>records as Markdown + YAML)]
        BK[Encrypted off-site<br/>backup]
    end

    CD -- "tunnel (phase 2)" --> MCP
    CM -- "OAuth (phase 3)" --> MCP
    GPT -- "OAuth (phase 3)" --> MCP
    MCP -- "read-only queries" --> IDX
    REPO -- "build (atomic swap)" --> IDX
    REPO -- "restic" --> BK

The Git repository is the source of truth. The index is derived: it can be deleted and rebuilt from the records at any time. Details in ARCHITECTURE.md.

Quick start

Requires Python 3.12+ and uv.

uv sync
uv run personal-brain build --records examples/records --db data/index.db
uv run personal-brain search --db data/index.db "moisturizer"
uv run pytest

Connect it to Claude Desktop (stdio) by adding to claude_desktop_config.json:

{
  "mcpServers": {
    "personal-brain": {
      "command": "uv",
      "args": ["--directory", "/path/to/personal-brain", "run", "personal-brain", "serve", "--db", "data/index.db"]
    }
  }
}

Run as a container (server deployment)

docker build -t personal-brain .
docker run -d --name personal-brain -p 127.0.0.1:8000:8000 \
  -v "$PWD/examples/records:/data/records:ro" personal-brain
# MCP endpoint: http://127.0.0.1:8000/mcp  ·  health: http://127.0.0.1:8000/health

Records are mounted read-only and the index is rebuilt at start (ADR 010).

Check that queries never reach the logs

uv run personal-brain check-logs --url http://127.0.0.1:8000/mcp --logs-command "docker logs personal-brain"

It sends random canary terms through search and read_entry, then fails if any of them appears in the logs. CI runs it against the built image on every push (ADR 007).

Tools

Tool

Purpose

Returns

search(query, limit=5)

Full-text search over all records

id, event_type, date, review_status, title, snippet, source, sha256

read_entry(id)

Read one full record

All fields plus body

Roadmap

Phase

Scope

Exit criterion

1

Record format, index, read tools, tests, CI; data repository and off-site backup on the server, restore proven

Restore from off-site backup in an isolated environment passes before any real data is migrated

2

Read access from Claude Desktop through a tunnel; evaluation with a fixed question set

A real question is answered citing the right record; evaluation results published (fictional set)

3

OAuth (GitHub login, single user) and mobile clients

A question asked on the phone, with no computer on, returns a sourced answer; no token, no access

4

Capture: add records from chat as pending, confirm from chat, upload the original photo through a one-time link

A photographed prescription becomes a pending record with its evidence; it is never shown as fact before confirmation

Decisions

All architectural decisions are recorded as ADRs in docs/adr.

Credits

Inspired by YudiG12/second-brain-mcp (MIT). This project takes a different direction: sourced answers over sensitive records, self-hosted, with human confirmation before anything becomes a fact.

License

MIT

Available Tools

2 tools
read_entryA
Read-onlyIdempotent

Read one full record by its id. Records with review_status 'pending' were not confirmed by the owner yet: never present them as facts. Always cite the 'source' of each record you use.

Inputs: id (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools target clearly different access patterns: keyword-based browsing via 'search' versus id-based retrieval of a single full record via 'read_entry'. There is no plausible overlap or risk of misselection.

    Naming Consistency4/5

    Both names are lowercase and verb-initial, but 'search' is a bare verb while 'read_entry' follows a verb_noun pattern. The deviation is minor and the intent of each name is still immediately readable.

    Tool Count3/5

    Two tools is on the thin side for a knowledge-base server, though it is defensible for a strictly read-only retrieval surface. It sits right at the borderline where a single additional operation (e.g. listing or filtering by source) would round out the surface.

    Completeness3/5

    Retrieval is covered (discover via search, then fetch full content by id), which is a coherent read path. However, there is no way to create, update, or flag records, so any workflow requiring the agent to contribute to the brain is a dead end.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables LLMs to interact with clinical patient records using tools for document ingestion, structured conversion, patient profiling, record listing, search, and secure Q&A over patient documentation.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Lets a single user read a bounded set of their own Google Health data from ChatGPT conversations through a private MCP connection, exposing four read-only tools for rollups, reconciled records, and irregular-rhythm notification history.
      1
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables MCP-compatible clients to securely read personal blood glucose, blood ketones, device heart rate, weight, image-based body-fat percentage, and BMI data through catalog, device, query, record, and statistics tools.
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      Enables MCP clients to search and retrieve approved, role-filtered internal knowledge with PII redaction, citations, content-integrity checks, and tamper-evident audit logging.
      3
      1
      MIT