Memory Lean logo

Memory Lean

Token-efficient MCP memory using a local knowledge graph, ranked search, archived facts, and a browser-based editor.

Install Memory Lean

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "memory-lean": {
      "command": "npx",
      "args": [
        "-y",
        "memory-lean"
      ],
      "env": {
        "MEMORY_FILE_PATH": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

Claude Code command
claude mcp add --env MEMORY_FILE_PATH=YOUR_VALUE_HERE --transport stdio memory-lean -- npx -y memory-lean

Run in your terminal. Add --scope project to share it with your team through .mcp.json.

We couldn’t confirm it starts correctly

We hit an unexpected error while testing this listing automatically.

npx -y memory-lean

Rate limit exceeded, please try again later - you have reached the maximum number of concurrent E2B sandboxes (20). If you need more, please visit 'https://e2b.dev/docs/billing'

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

memory-lean MCP server stores long-term agent memory in a local knowledge graph shared across sessions and MCP clients. It searches by entity name, type, observations, and relation types, returning ranked matches with compact snippets instead of dumping the graph. Entities, relations, observations, and archived facts can be managed through MCP tools, while an optional web UI provides graph exploration and editing. Reach for memory-lean when agents need persistent project context without repeatedly consuming large context windows.

Use cases

  • Store project decisions across coding sessions
  • Search remembered facts before starting a task
  • Track dependencies, versions, rules, and pending work
  • Review and edit agent memory in a browser
  • Restore older facts from the archive

Key features

  • Ranked lexical entity search with compact snippets
  • Knowledge graph of entities, relations, and observations
  • Archived facts with selective restoration
  • Local JSONL storage with backups and write locking
  • Optional browser-based graph editor
  • Drop-in compatibility with the reference memory server

Tools12

What Memory Lean lets your agent do. Expand a tool for its parameters.

Self-reported~443 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

13/13 checks healthy over the last 52d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 12h ago via OSV.dev · memory-lean (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars4Stargazers on the source repository.
npm downloads1kPackage downloads in the last 30 days.
Last commit13d agoMost recent push to the default branch.
Install checkInconclusiveWe hit an unexpected error running the automated check.
Tools exposed12Callable tools this server registers over MCP.

How Memory Lean works

What memory-lean does

memory-lean provides persistent memory for AI coding agents through the Model Context Protocol. It models information as entities, relations, and observations, allowing an agent to record projects, dependencies, shipped versions, pending work, and learned rules. The graph is stored in a local JSONL file and can be shared by multiple agents and sessions.

The server is designed as a drop-in alternative to the reference memory server. It uses the same memory file and familiar tool names while making read responses more compact. Search results contain ranked entity names, match counts, and a small number of matching snippets rather than returning every entity in full.

How it works

The graph is created on the first write. By default, memory-lean uses ~/.claude/memory-graph/memory.jsonl; MEMORY_FILE_PATH can relocate it. Facts are kept short and limited per entity. Additional facts move into an archive, which keeps routine graph reads smaller while retaining older information for inspection and restoration.

Search matches words in entity names, types, observations, and relation types connected to an entity. Opening an entity returns its compact details, relations, and archive count. The graph index groups names by type and reports observation counts without including observation text. Writes use a lock for parallel sessions, and daily backups are maintained locally. The server does not use network access.

A separate web UI can display the graph, group entities by type, highlight relations, search content, and edit the same data. Changes made by agents appear in the UI shortly after they occur.

Setup and configuration

Node.js 18 or newer is required. Install globally with:

Terminal
npm install -g memory-lean

Or run it without a global installation:

config.json
{
  "mcpServers": {
    "memory": { "command": "npx", "args": ["-y", "memory-lean"] }
  }
}

For agent guidance, generate protocol instructions with npx -y memory-lean --protocol and place the output in the rules file used by the agent. The web interface starts with npx -y memory-lean --ui; --ui --demo opens a sample graph.

Claude Code can install the supplied plugin, which also adds setup instructions and a /memory-ui command. An existing session must be restarted or reconnected after updating the server.

Tools and capabilities

  • search_nodes finds ranked entities and matching snippets using token-saving results.
  • open_nodes returns selected entities, their relations, and archive counts; related rules and pending work can be prioritized.
  • read_graph provides a type-based entity index and observation counts.
  • create_entities and create_relations add graph structure while skipping duplicates.
  • add_observations records facts subject to length and per-entity limits.
  • replace_observation, delete_observations, delete_relations, and delete_entities modify stored data.
  • rename_entity preserves an entity's facts, relations, and archive while changing its name.
  • archived_observations lists archived facts and can restore selected entries.

The last three capabilities—replacement, renaming, and archived-fact management—are additions beyond the reference server's tool set.

Limitations and notes

Search is intentionally lexical: every search word must match an entity name, type, observation, or touching relation type. A large graph may show only counts for its biggest types in the index. Deleting an entity removes its relations and keeps its archived facts marked as deleted, preventing those facts from being inherited by a later entity with the same name.

The default storage path is local and shared across agents using it. Moving the file requires setting MEMORY_FILE_PATH consistently for each client. A narrow search produces less benefit from response reduction than a broad search because there is less output to trim.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Memory Lean

memory-lean is an MCP server that connects AI coding agents to a local knowledge graph stored in a JSONL file. Its main tools search and open entities, inspect graph indexes, create entities and relations, add or replace observations, delete graph data, rename entities, and restore archived facts.

Install it with Node.js 18 or newer using `npm install -g memory-lean`, or run it through `npx -y memory-lean` in an MCP configuration. Claude Code can also install the memory-lean plugin from its marketplace.

By default, memory-lean stores the graph at `~/.claude/memory-graph/memory.jsonl`. Set `MEMORY_FILE_PATH` to use another location, and configure that path consistently for agents that should share the same memory.

Yes. Cursor is listed among the supported setup targets, using a `.cursor/mcp.json` configuration and agent instructions supplied through `AGENTS.md` or a rule.

Run `npx -y memory-lean --ui` to open the browser interface, or add `--demo` to inspect a sample graph without using an existing memory file.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewMemory Lean AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/memory-lean?style=directory)](https://allmcps.com/mcp/memory-lean)
HTML Embed
<a href="https://allmcps.com/mcp/memory-lean"><img src="https://allmcps.com/api/badge/memory-lean?style=directory" alt="Memory Lean on AllMCPs" /></a>