hippocampus-mcp
hippocampus-mcp is a personal memory MCP server that ingests conversation logs from multiple AI platforms (Claude Code, ChatGPT, claude.ai, Codex CLI) into a local PostgreSQL database and exposes them via MCP tools for searching, listing, and retrieving past conversations, plus an optional cross-project agent memory layer.
search_personal_memory— Semantic/hybrid search across personal conversation history using vector embeddings (requires BGE-M3 or similar embedding backend).get_conversation— Retrieve the full transcript of a specific conversation by ID.list_recent_conversations— List conversations ordered by recency, with optional filters for time window, platform (claude_code,chatgpt, etc.), and project name.list_project_conversations— List recent conversations scoped to a specific project or workspace via case-insensitive substring match.get_conversation_summary— Get compact metadata and a bounded excerpt (title, platform, dates, message count, topic) without loading the full transcript.search_ghost_memory— Search the cross-project agent memory vault (accumulated rules, feedback, lessons learned) using hybrid full-text + vector ranking, with optional project scoping. An empty query returns a ranked overview.
Additional capabilities:
Incremental, deduplicated ingestion — re-running ingest is safe and only adds new conversations.
Summarization via
hippocampus summarizebuilds rollup summaries for long conversations (requires Anthropic API key).All data is stored locally in a user-controlled PostgreSQL database, with no external data sharing unless explicitly opted into.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@hippocampus-mcp find our postgres deadlock discussion from last month"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
English ・ 日本語
hippocampus-mcp
Personal memory infrastructure for people who use AI agents every day.
hippocampus-mcp ingests your conversation logs from multiple platforms (Claude Code, ChatGPT, claude.ai, Codex, Grok, Kimi, Antigravity) into a PostgreSQL + pgvector database that you run, and exposes them as MCP search tools to any agent session. Your past reasoning, decisions, and debugging sessions stop evaporating when the window closes.
The differentiator is the ghost layer: a separate, opt-in vault where the agent's own accumulated rules and feedback ("last time this failed because...") are synced nightly and become searchable from every project — cross-project agent memory, not just human conversation recall.
On top of the searchable corpus sit three further opt-in layers, each with
its own doc: a distilled facts layer (search_facts), a first-person
diary the agent writes once a day (plus a read-only grounding auditor that
checks each entry's self-criticism against the transcripts), and an editable,
human-gated wiki for the subject knowledge you actually study. See
docs/ARCHITECTURE.md for how the pieces fit.
The corpus is reachable not only from terminal agents but, via an opt-in OAuth-gated remote MCP connector, from claude.ai on the web and mobile too — ask claude.ai on your phone "what did I decide about X?" and it searches your database. See docs/CONNECTOR.md.
The name: the hippocampus is the brain structure that consolidates short-term experience into long-term memory during sleep. This system imitates that loop — daytime sessions accumulate as JSONL, a nightly ingest embeds and persists them, and the next session can recall them.
INGEST STORE RETRIEVE (MCP)
Claude Code sessions ─┐
ChatGPT export ZIP ─┤ parse → scrub → embed personal.* ──┐ search_personal_memory
claude.ai export ZIP ─┼─────────────────────────▶ (your ├─ search_conversations
Codex CLI history ─┘ PostgreSQL) ├─ list_recent_conversations
┘ get_conversation ...
agent memory files ─── nightly dub (opt-in) ─▶ agent.* ──── search_ghost_memoryQuick start
Prerequisites: Python 3.11+, a psql client on PATH (Debian/Ubuntu:
apt-get install postgresql-client), and either Docker or an existing
PostgreSQL with the pgvector extension.
Everything runs on your machine by default — the database is a bundled
docker-compose postgres, and hippocampus init sets it up for you.
git clone <this-repo> hippocampus-mcp && cd hippocampus-mcp
# 1. Install the package
pip install .
# 2. First-run setup. Pick "local" for the database (the default), pick an
# embed backend, optionally provision the ghost layer. init generates
# the DB password, writes .env (mode 0600), starts the compose postgres,
# runs migrations, and prints the MCP registration snippet.
hippocampus init
# 3. For local semantic search without resident BGE RAM:
# choose "bge-ondemand" in init. The first semantic ingest/search starts
# the compose BGE-M3 server; it exits after the idle timeout.
# 4. Verify, then ingest your Claude Code sessions
hippocampus doctor
hippocampus ingest claude-codeNon-interactive minimal install (no embed model — semantic tools stay hidden, and ingest refuses to run, until a backend is configured; vectors are written together with the text, never backfilled silently):
hippocampus init --yes --embed noneIf host port 5432 is taken (a host postgres, or a Windows-side listener
under WSL2), pass --pg-port <free-port> — compose and the generated
PG_URL follow it via .env.
Running the database on a separate server instead? Choose existing
at the database prompt (or --db existing) and paste your PostgreSQL
URL — see INSTALL.md Path B, and PRIVACY.md for what a remote database
implies (your conversation text transits the network; keep it on a
private network or behind TLS). Local is the recommended default.
Register the MCP server
Add to ~/.claude/settings.json (or your client's MCP config). The
snippet contains no secrets — the server reads .env from its working
directory:
{
"mcpServers": {
"hippocampus": {
"command": "/path/to/your/venv/bin/hippocampus-mcp"
}
}
}If your MCP client does not launch servers from the project directory,
use the one-line cd && exec wrapper that hippocampus init prints at
the end of its run.
Then, from a fresh agent session:
search_personal_memory("that postgres deadlock we debugged")
list_recent_conversations(days=2)
get_conversation("claude_code:<conv-id>")
search_ghost_memory(current_project="my-repo") # ghost layer, if enabledRelated MCP server: tartarus-mcp
Ingest sources
Seven sources are built in (hippocampus ingest --list):
Source | Command | Input |
Claude Code |
| auto-discovers |
ChatGPT |
| official data-export ZIP |
claude.ai |
| official data-export ZIP |
Codex CLI |
|
|
Antigravity |
|
|
Kimi Code |
|
|
Grok CLI |
|
|
Every source runs the same pipeline: parse → credential scrub → embed → upsert → verify (the run fails loudly if any ingested message ended up without a vector). Conversations are deduplicated, so re-running an ingest is safe.
After ingest, hippocampus summarize builds per-conversation rollup
summaries and segment summaries for long conversations (substrate for
summary-level search). It requires an Anthropic API key
(ANTHROPIC_API_KEY) and a working embed backend — see
PRIVACY.md for exactly what text it sends where.
Semantic search backends
Semantic (vector) search is off until you explicitly choose a
backend — there is no silent model download. Three choices at
hippocampus init (changeable later in .env):
Choice | What it means | Cost |
| keyword/recency tools only; semantic tools are hidden | zero |
| local compose BGE-M3 starts on first semantic ingest/search, then exits after | ~6 GB RAM only while the container is running; first request waits for startup/download |
| BGE-M3 over HTTP — | ~6 GB RAM in the container while it is running |
| model loaded inside the server process ( | ~6 GB RAM in-process, ~6 GB one-time download |
Recommended single-machine setup:
hippocampus init --embed bge-ondemand
hippocampus doctor # reports cold/hot status without starting BGE
hippocampus ingest codex # first semantic call starts compose `bge`Peak memory is unchanged: BGE-M3 still needs roughly 6 GB while it is running. On-demand only reduces how long that memory stays resident.
Manual low-memory workflow for a single local machine: keep bge-http
configured, start the semantic backend only when you need it, then stop it
to release the BGE-M3 container memory:
docker compose --profile bge up -d # start semantic backend
hippocampus doctor
hippocampus ingest claude-code # or run semantic search/summarize
docker compose stop bge # release BGE-M3 memoryIf BGE_EMBED_URL remains set while the local bge container is stopped,
semantic ingest/search fails loudly until you start it again. That is
expected for manual low-memory use; run docker compose --profile bge up -d
before semantic work.
On the first bge start, the model downloads into the compose hf_cache
volume (mounted as /hf_cache in the container). If the first download is
interrupted and later starts keep failing during model load, stop bge and
retry. If the HuggingFace cache is corrupt, remove only the compose
hf_cache volume and let it re-download; do not remove pg_data, which is
the database volume.
Details and a decision table: INSTALL.md. Code-level
bge-ondemand behavior is documented in docs/BGE_ONDEMAND.md.
Ghost layer (cross-project agent memory)
Project-local agent memory files can be promoted — via an explicit
dual-signal opt-in (frontmatter scope: shared and a line in a
human-edited allowlist file) — into a shared vault that any project's
session can search through search_ghost_memory. Promotion is
default-deny; a content scanner is a third wall behind the two signals.
hippocampus init --ghost provisions the read-only database role it
needs. Full user guide: docs/GHOST_LAYER_USER.md.
claude.ai connector (use it from web & mobile)
The stdio MCP server only reaches terminal agents. To search your memory from
claude.ai's web app or phone app, run the optional connector: a second
entry point (hippocampus-mcp-connector-oauth) that serves the same tools over
streamable HTTP behind a single-owner OAuth authorization server, exposed
through a cloudflared tunnel.
It is deliberately narrower than the stdio surface — a fail-closed read-only allowlist (personal/conversation/library search only; ghost, facts, and full-thread retrieval are excluded), audience-bound tokens, a chain-read budget, and fail-open read auditing. Register it once in claude.ai's connector settings and it works from every device.
Setup, security posture, and troubleshooting: docs/CONNECTOR.md.
Privacy
Short version: your full conversation text and its vectors live in your PostgreSQL. Nothing leaves your machine unless you explicitly enable a feature that needs it (Anthropic-backed scoring/summaries, a remote embed endpoint). Credential scrubbing at ingest is best-effort, not a guarantee. Read PRIVACY.md before ingesting anything sensitive.
Support model
This is published as useful infrastructure, not a supported product.
It is the actual daily-driver memory system of its author, extracted into
an installable shape. Issues and PRs are welcome and handled best-effort;
there is no SLA, no roadmap commitments, and APIs may change between
minor versions. If it breaks, hippocampus doctor output (which is
designed to be safe to paste — no secrets ever appear in it) is the most
useful thing to include in a report.
Documentation
INSTALL.md — detailed setup: compose vs existing PG, embed backends, migrations, troubleshooting, automation
PRIVACY.md — what is stored, what leaves the box and when, scrub limits, prompt-injection posture
docs/GHOST_LAYER_USER.md — ghost layer user guide
docs/CONNECTOR.md — claude.ai remote MCP connector (use your memory from web & mobile)
docs/SECRETS_HARDENED.md — optional sops-encrypted secrets setup (default is a plain
.env, mode 0600)docs/CONFIG.md — full environment-variable reference
Available Tools
6 toolsget_conversationB
Get full conversation thread by conv_id. Searches personal memory first, then library.
Inputs: conv_id (required). Returns: result
get_conversation_summaryA
Get conversation metadata and a compact bounded excerpt without the full transcript.
Returns title, platform, dates, msg_count, topic/cluster, and up to max_messages messages sampled from the start and end of the conversation.
Args: conv_id: conversation ID (from search_personal_memory or list_recent_conversations) max_messages: max messages to include; split between first half and last half (default 12)
Inputs: conv_id (required), max_messages. Returns: result
get_diaryA
Read the agent's daily first-person diary from the diary layer.
The diary is a distinct layer (personal.diary): one LLM-written entry per day reflecting on that day's work — not part of the conversation corpus, so search_personal_memory does NOT surface it. Use this to read the diary itself.
Args: date: 'latest' for the most recent entries, or 'YYYY-MM-DD' for a specific day. n: when date='latest', how many recent entries to return (default 1, max 14).
Inputs: n, date. Returns: result
list_project_conversationsA
Return recent conversations scoped to a project or workspace.
Matches on conversation title (case-insensitive substring). Covers cases like "my-webapp", "JSAS2026", "personal/memory/mcp", etc.
Args: project: substring to match against conversation title days: look-back window in days (default 14) limit: max conversations to return (default 30)
Inputs: project (required), days, limit. Returns: result
list_recent_conversationsA
Return conversations ordered by recency (not semantic similarity).
Use this when the user asks for "recent conversations", "ここ2日の会話", etc. Each row header: [conv_id | platform | started→ended | title | topic | cluster | msgs | intensity] followed by a short snippet of the first message.
Args: days: look-back window in days (default 2) limit: max conversations to return (default 20) platform: filter by platform (e.g. "claude_code", "chatgpt") project: substring match on conversation title (e.g. "my-webapp", "JSAS2026")
Inputs: days, limit, project, platform. Returns: result
search_ghost_memoryA
Search cross-project agent ghost memories (= this agent's rule/feedback accumulation).
Empty query → list top-ranked memories (= "what's in my ghost vault" overview). Non-empty query → hybrid FTS + vector semantic ranking via agent.search_ghost_ranked (SECURITY DEFINER, migration 020).
⚠️ current_project is caller-attested, NOT server-verified. shared-restricted requires current_project in per-memory allowlist (= pentest/commercial boundary).
Ranking: rank_score = base_score * recency_factor + semantic_sim * 0.5 base_score = 0.2activation + 0.5incident_prevention + 0.3endorsement - 0.4correction - 0.2pred_error + 0.1scope_bonus recency_factor = exp(-days_since_last_activated / 30) semantic_sim = 1 - cosine_distance(query_vec, memory.dense) (0 if empty query)
Each returned row triggers agent.bump_activation, so memories that surface in search naturally rise in rank over time (= self-tuning loop).
Inputs: query, n_results, expand_links, current_project, +1 more. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct aspect of memory retrieval: full conversation, summary, diary, project-scoped conversations, recent conversations, and ghost memories. No overlap in purpose.
All tools follow a consistent 'verb_noun' pattern with underscores: get_conversation, get_conversation_summary, get_diary, list_project_conversations, list_recent_conversations, search_ghost_memory. Verbs are indicative of the operation.
With 6 tools, the server covers the core memory retrieval operations without being bloated. Each tool serves a clear need within the domain of personal memory access.
The tool set provides multiple ways to retrieve conversations, diary entries, and ghost memories. A minor gap is the lack of semantic search across conversations themselves, but the existing tools cover primary use cases.
Maintenance
Related MCP Connectors
Shared cross-LLM long-term memory over MCP: semantic recall, sessions, and media (pgvector).
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Persistent memory for AI agents across Claude, ChatGPT and any MCP client.
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceSelf-hosted semantic memory for AI agents. Save worklogs, decisions, and notes via MCP, then recall them across sessions by meaning rather than keyword. Backed by Postgres + pgvector with local embeddings (multilingual-e5-base).1MIT
- AlicenseNot gradedqualityBmaintenanceA local-first MCP memory server providing persistent, searchable memory for AI agents, powered by SQLite.1 npm1Apache 2.0
- AlicenseNot gradedqualityCmaintenanceFramework-agnostic MCP server for agent memory with Postgres + pgvector, enabling persistent memory, recall, and task management across sessions.MIT
- AlicenseNot gradedqualityCmaintenanceA self-hostable MCP server that provides permanent memory for AI agents using Postgres + pgvector for semantic search and Markdown file sync.2 npmMIT