memtree

memtree

Collects session JSONL from Codex and Claude Code into local SQLite memory, exposed through MCP with tools for memory context, search, get, put, forget, sleep, and status.

Category
Visit Server

README

memtree

Codex and Claude Code session JSONL is collected outside the model context, consolidated into local SQLite memory, and exposed through MCP.

This is an intentionally small first implementation:

  • Codex and Claude Code Hook queueing
  • crash-recovery transcript scanning
  • byte-offset incremental JSONL collection
  • secret redaction and user/final-assistant filtering
  • deterministic per-session Sleep memory
  • SQLite FTS search
  • MCP read, search, explicit write, forget, Sleep, and status tools
  • stdio and Streamable HTTP transports

The current Sleep implementation creates a bounded session digest. It does not yet perform LLM-based profile/entity/decision extraction.

Setup

cd ~/repos/memtree
uv sync
uv run memtree init
uv tool install --editable .

The editable tool install makes memtree available to lifecycle hooks.

Configure hooks

Merge the relevant example into the user-level configuration:

  • Codex: integrations/codex/hooks.json.example into ~/.codex/hooks.json
  • Claude Code: integrations/claude-code/settings.json.example into ~/.claude/settings.json

Review and trust the Codex hook through /hooks. Hooks only enqueue session_id, transcript_path, and cwd; they do not invoke MCP or a model.

Collect and Sleep

Run manually or from cron/systemd:

memtree collect --scan all
memtree sleep
memtree status
memtree memory list --cwd "$PWD"

Suggested daily command:

memtree collect --scan all && memtree sleep

Configure MCP

Codex stdio configuration:

[mcp_servers.memtree]
command = "memtree"
args = ["serve", "--transport", "stdio"]
enabled = true

Claude Code:

claude mcp add --scope user memtree -- \
  memtree serve --transport stdio

Available tools:

  • memory_context
  • memory_search
  • memory_get
  • memory_put
  • memory_forget
  • memory_sleep
  • memory_status

Write and forget tools are annotated with their side effects. Automatic transcript ingestion is deliberately not exposed as an MCP tool.

Pass cwd to memory_context or memory_search to include the matching project memory. Use include_all_projects=true only for an intentional cross-project review.

Docker

Docker runs the Streamable HTTP MCP server with a private persistent volume:

docker compose up --build -d

The HTTP endpoint is http://127.0.0.1:8765/mcp. Collection normally runs on the host because the transcript directories are private host state.

Development

uv run ruff format --check .
uv run ruff check .
uv run pyright
uv run pytest

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured