Skip to main content
MCP server CX Codex

context-mem — Claude Code MCP server: what it does, how to install

A local memory engine for AI coding agents that compresses tool outputs and records project decisions into Markdown notes. It prevents context loss across sessions without exploding token usage.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add context-mem -- npx -y context-mem
Open on GitHub

What context-mem does

The server intercepts tool activity during an agent session and routes it through a two-tier storage system. A local SQLite database holds the primary record with FTS5 search and vector embeddings. It syncs continuously with readable Markdown notes in .context-mem/vault/. You can browse the resulting graph in Obsidian. Over 45 MCP tools allow the agent to query this historical knowledge.

Context stays lean through 14 content-specific summarizers. Stack traces and shell logs are processed with different rules instead of crude truncation. Recent observations retain full detail, whereas older low-priority records compress progressively. Pinned records stay untouched. In author benchmarks with 50 tool outputs, text volume shrank from 365 KB down to 3.2 KB.

Without Node.js and npx installed on the host machine, launching the server is impossible. The engine runs offline and never requires third-party API keys. Running the initialization command detects your editor environment and writes matching configuration files automatically.

What it helps with

  • preserve architecture decisions across separate agent sessions
  • shrink context size during extended terminal-heavy debugging runs
  • generate an offline Markdown wiki from tool execution logs
  • locate past bug fixes through hybrid vector and keyword search

Example prompts for the agent

  • Query context-mem for the architecture decision we made about the database schema last week.
  • Pin the current CORS configuration decision so it avoids memory compression.
  • Search the session history for the TypeScript build failure we solved yesterday.

How to install context-mem

Platform CLI

claude mcp add context-mem -- npx -y context-mem

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about context-mem

How do I install context-mem in Claude Code?

Run claude mcp add context-mem -- npx -y context-mem in your terminal.

What is the main purpose of context-mem?

It records agent interactions in a local SQLite database and translates tool outputs into structured Markdown documents. This gives the model persistent project memory without exceeding context limits.

Does context-mem require an API key or an external cloud service?

No, the server operates strictly on your local machine. All SQLite records and Markdown files stay inside your workspace, requiring only Node.js with npx to execute.

Similar MCP servers

All MCP servers for Agent setup: memory, context, orchestration →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor