claude-lens

claude-lens

Enables Claude Code to search and retrieve information from its past session transcripts, including tool calls, errors, and project-specific history, via an SQLite FTS5 full-text search index.

Category
Visit Server

README

claude-lens

MCP server that gives Claude Code searchable memory across all past sessions.

Indexes every Claude Code session JSONL file into a SQLite database with FTS5 full-text search. Claude gets tools to search conversations, find past tool calls, filter by project or date, and look up errors it's solved before.

How it works

Claude Code stores sessions as JSONL files in ~/.claude/projects/. claude-lens parses these on startup, builds an FTS5 search index, and exposes 9 tools via MCP. Claude's agent loop decides when to search its own history — no manual invocation needed.

This is active recall, not passive RAG. Claude decides what to search for, reads results, and can drill deeper with follow-up queries. Same pattern as a human using a search engine — multiple targeted queries beat one blind retrieval.

Tools

Tool What it does
search_sessions Full-text search across all session messages
search_tool_calls Search past Bash commands, file edits, grep patterns
get_session Read a full session transcript
get_session_summary Quick metadata: project, model, tools used, files touched
filter_by_project List sessions for a specific project
filter_by_date Find sessions within a date range
list_projects All projects with session counts
get_stats Overall index statistics
search_errors Find past tool errors and how they were resolved

Install

git clone https://github.com/jasonpaulmichaels/claude-lens.git
cd claude-lens
bash scripts/install.sh

Or manually:

# Sync repo to runtime install location
rsync -a --exclude=node_modules --exclude=.git --exclude=test \
  ./ ~/.claude/mods/claude-lens/
cd ~/.claude/mods/claude-lens && npm install --omit=dev

# Register MCP server (user scope so it's available everywhere)
claude mcp add -s user claude-lens -- node ~/.claude/mods/claude-lens/src/index.js

install.sh does this for you. Source repo stays separate from runtime install — edit source, re-run install.sh to deploy.

Restart Claude Code after installing. First startup indexes all sessions (takes a few minutes). Subsequent startups are incremental (<5 seconds).

Usage

Just use Claude Code normally. When context from past sessions would help, Claude will search automatically. You can also ask directly:

  • "What was I working on last week?"
  • "How did I fix the auth bug in betterclaw?"
  • "Find the session where I set up the cloudflare tunnel"
  • "What command did I run to rebuild the kernel module?"
  • "Show me errors I hit while working on listforge"

Requirements

  • Node.js 20+
  • Claude Code with MCP support

Data

  • Sessions indexed from: ~/.claude/projects/
  • Database stored at: ~/.claude-lens/claude-lens.db
  • Subagent sessions are skipped
  • Tool outputs truncated to 500 chars to keep DB manageable
  • Incremental indexing via file mtime tracking

License

MIT

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