会话搜索工具

该工具为Claude Code提供本地会话历史搜索功能,支持自然语言查询和会话列表查看,适用于开发者和团队协作场景。

  • by ibrews
  • JavaScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 ibrews/claude-session-search

使用说明

Claude Session Search

Search your Claude Code conversation history from inside Claude.

"What did we discuss about auth last week?" "Find the session where we set up the database" "Search my history for voicebox"

Claude Code doesn't have built-in search across past sessions. This MCP server adds it — just ask Claude in natural language and it searches your local conversation history automatically.

Setup (30 seconds)

1. Install

cd claude-session-search/mcp-server && npm install

2. Add to Claude Desktop config

macOS — ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "session-search": {
      "command": "node",
      "args": ["/path/to/claude-session-search/mcp-server/index.mjs"]
    }
  }
}

Windows — %APPDATA%\Claude\claude_desktop_config.json:

{
  "mcpServers": {
    "session-search": {
      "command": "node",
      "args": ["C:\\path\\to\\claude-session-search\\mcp-server\\index.mjs"]
    }
  }
}

Linux — ~/.config/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "session-search": {
      "command": "node",
      "args": ["/path/to/claude-session-search/mcp-server/index.mjs"]
    }
  }
}

3. Restart Claude Desktop

That's it. Start asking about past sessions.

What You Can Do

Search conversations

Ask Claude anything about your past sessions:

  • "Search my sessions for database migration"
  • "Which session did we discuss the API redesign?"
  • "Find conversations about testing from last week"

Claude calls search_sessions behind the scenes and returns ranked results with context snippets.

List recent sessions

  • "Show my recent sessions"
  • "What sessions do I have for the website project?"
  • "List my last 5 conversations"

Tools

Tool What it does
search_sessions Full-text search across all sessions. Returns matches ranked by relevance with context snippets.
list_sessions List sessions sorted by date with titles, projects, and previews.

Things to Try

  1. Install and restart Claude Desktop, then ask: "What did we discuss about auth last week?" — the MCP tool searches all your JSONL session files and returns matching snippets ranked by relevance.
  2. Ask "Find the session where we set up the database" — returns the session title, project, and a context excerpt so you can identify the right conversation without opening any files.
  3. Ask "List my last 10 sessions" — list_sessions returns sessions sorted by date with titles, project names, and previews in a scannable table.
  4. Search for a term you know appears in a specific project: "Find sessions mentioning voicebox in the fleet project" — results scope to matching sessions with context lines showing where the term appears.
  5. Verify privacy: open mcp-server/index.mjs and confirm — the server is read-only, indexes only ~/.claude/projects/, and never makes outbound network calls.

How It Works

Claude Code stores every conversation as a JSONL file in ~/.claude/projects/. This MCP server reads those files and exposes search over them as tools that Claude can call during your conversations.

~/.claude/projects/
  my-project/
    <session-id>.jsonl    ← full conversation transcript
  another-project/
    <session-id>.jsonl

Everything stays local. No data leaves your machine. The server is read-only — it never modifies your session files.

Requirements

  • Node.js 18+
  • Claude Desktop (macOS, Windows, or Linux)
  • Existing Claude Code sessions in ~/.claude/projects/

Privacy

This tool only reads files already on your local disk (~/.claude/projects/). It does not:

  • Send data to any external service
  • Modify or delete any files
  • Require authentication or API keys
  • Phone home or collect telemetry

Also: Session Recovery

Lost sessions after a crash or BSOD? Check out claude-session-recovery — a companion tool that restores sessions that disappear from Claude Desktop after corruption events.

License

MIT

Support

If you like seeing this kind of thing get built and shared, donations are always welcome — they buy hardware, render time, and the freedom to keep giving most of this away.

Credits

Built by Alex Coulombe Presents (ibrews).