claude-lens
claude-lens
一个 MCP 服务器,为 Claude Code 提供跨所有历史会话的可搜索记忆。
将每个历史 Claude Code 会话 JSONL 文件索引进一个带 FTS5 全文搜索的 SQLite 数据库。Claude Code 会获得工具,用于搜索过去的对话、查找工具调用、按项目或日期筛选,以及查找之前解决的问题。
工作原理
Claude Code 将会话以 JSONL 格式存储在 ~/.claude/projects/ 中。claude-lens 会在启动时解析这些文件,构建 FTS 搜索索引,并通过 MCP 暴露 9 个工具。Claude 的工具循环会决定何时搜索自己的历史记录 —— 无需手动调用。
这是主动回忆,不是被动 RAG。Claude 决定搜索什么、读取搜索结果,并可以通过追加查询深入挖掘。这与人类使用搜索引擎的模式相同 —— 多个针对性查询胜过单个盲目查询。
Related MCP server: conversation-search
工具
工具 | 作用 |
| 跨所有会话消息进行全文搜索 |
| 搜索过去的 Bash 命令、文件编辑、grep 模式 |
| 读取完整会话记录 |
| 快速元数据:项目、模型、使用的工具、使用的日期 |
| 列出某个项目的会话 |
| 查找某个日期范围内的会话 |
| 所有项目及其会话计数 |
| 总体索引统计 |
| 查找过去的工具错误及它们的解决方式 |
安装
git clone https://github.com/jasonpaulmichaels/claude-lens.git
cd claude-lens
bash scripts/install.sh# 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.jsinstall.sh 会为你完成这些操作。源码仓库与运行时安装分开 —— 编辑源码后,重新运行 install.sh 即可部署。
安装后请重启 Claude Code。首次启动会为所有会话建立索引(需要几分钟)。后续启动为增量式(<5 秒)。
使用方法
像平常一样使用 claude-lens 即可。如果过去会话中的上下文对当前有帮助,Claude 会自动搜索。你也可以直接问:
“我上周在做什么?”
“我是怎么修复 betterclaw 中的认证 bug 的?”
“找到我设置 cloudflare 隧道的那个会话”
“我运行了什么命令来重建内核模块?”
“显示我在 listforge 工作时遇到的错误”
要求
Node.js 20+
支持 MCP 的 claude-lens
数据
从
~/.claude/projects/中为会话建立索引数据库存储于
~/.claude-lens/claude-lens.db子代理会话会被跳过
工具输出截断至 5000 字符以控制数据库体积
通过文件 mtime 跟踪进行增量索引
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceEnables comprehensive search and analysis of Claude Code conversation history using full-text search, optional semantic vector search, and conversation management tools. Provides fast SQLite-based indexing with role-based filtering, project organization, and hybrid search capabilities combining keyword and semantic matching.
- FlicenseNot gradedqualityDmaintenanceFull-text search over Claude Code conversation history using SQLite FTS5, exposing indexed transcripts as MCP tools for searching, browsing, and reading turns.3
- AlicenseAqualityDmaintenanceEnables Claude Code to search, browse, and read its own past conversation history across all projects using BM25 keyword search.118MIT
- AlicenseNot gradedqualityDmaintenanceEnables searching and browsing past Claude Code conversations directly from within an active Claude session, with full-text search and cost tracking.MIT
Related MCP Connectors
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Cross-agent artifact workspace with provenance across Claude Code, Codex, Cursor, LangGraph.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/sanchez314c/claude-lens'
If you have feedback or need assistance with the MCP directory API, please join our Discord server