MCP Claude Code Conversation History
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Claude Code Conversation History search for 'API rate limiting' in past conversations"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Claude Code Conversation History
A Model Context Protocol (MCP) server that gives Claude Code access to its own conversation history. Search, browse, and read past conversations across all projects using BM25 keyword search.
Overview
Every Claude Code session starts fresh — you can't ask "what did we discuss about auth last week?" or "show me that refactoring conversation". Your conversation history sits in JSONL files on disk, invisible to Claude.
MCP Claude Code Conversation History indexes those files and exposes them through a single MCP tool, so Claude can search and read its own past conversations.
Key Features:
BM25 Search - Keyword search with relevance ranking via MiniSearch
Cross-Project - Search across all Claude Code projects at once
Background Indexing - Server starts immediately, indexes in the background
Zero Config - Reads directly from
~/.claude/projects/, no setup needed
Related MCP server: Claude Code History MCP
Installation
Via npm (Recommended)
npm install -g mcp-claude-code-conversation-historyFrom Source
git clone https://github.com/Stefan-Nitu/mcp-claude-code-conversation-history.git
cd mcp-claude-code-conversation-history
bun install
bun run buildRequires Bun v1.3.8+ (development) and Node.js v20+ (runtime)
Add a CLAUDE.md hint
MCP tools are deferred (loaded on-demand), so Claude may not use them automatically. Add this to your project's CLAUDE.md to ensure it does:
## Conversation History
You have access to past conversation history via MCP. Always use it when the user asks about previous work, past sessions, or anything from a prior conversation.Quick Start
With Claude Code
Add to ~/.claude.json:
{
"mcpServers": {
"mcp-claude-code-conversation-history": {
"command": "npx",
"args": ["-y", "mcp-claude-code-conversation-history"]
}
}
}Or if installed globally:
{
"mcpServers": {
"mcp-claude-code-conversation-history": {
"command": "mcp-claude-code-conversation-history"
}
}
}Restart Claude Code to pick up the new server.
With Claude Desktop
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"mcp-claude-code-conversation-history": {
"command": "npx",
"args": ["-y", "mcp-claude-code-conversation-history"]
}
}
}With MCP Inspector
Test the server interactively:
npx @modelcontextprotocol/inspector npx -y mcp-claude-code-conversation-historyAvailable Actions
The server exposes 1 tool (claude_code_conversation_history) with 4 actions:
Action | Description | Required Params | Optional Params |
stats | Overview of all conversations and projects | — | — |
list | Browse conversations by project/date | — |
|
search | BM25 keyword search across all history |
|
|
read | Read full conversation by session ID |
|
|
Parameters Reference
Parameter | Type | Description |
|
| Required. One of: |
|
| Search keywords (required for |
|
| Session ID from search/list results (required for |
|
| Filter by project name (partial match) |
|
| Only show conversations after this ISO date |
|
| Only show conversations before this ISO date |
|
| Maximum number of results |
|
| Skip first N messages (for |
Example Usage
Get an overview
{ "action": "stats" }Returns total conversations, messages, and per-project breakdown.
Browse recent conversations in a project
{ "action": "list", "project": "my-app", "limit": 5 }Search for a topic
{ "action": "search", "query": "authentication migration", "limit": 5 }Returns ranked results with matching message snippets.
Read a full conversation
{ "action": "read", "session_id": "abc-123-def", "limit": 20 }Use session_id from search or list results. Supports pagination with offset/limit.
Response Format
All actions return structured JSON:
{
"action": "search",
"query": "auth",
"results": [
{
"sessionId": "abc-123",
"project": "-Users-me-Projects-my-app",
"cwd": "/Users/me/Projects/my-app",
"score": 42.5,
"matches": [
{
"type": "user",
"content": "fix the authentication bug...",
"timestamp": "2026-03-20T10:00:00.000Z"
}
]
}
]
}How It Works
On startup, reads Claude Code's JSONL conversation files from
~/.claude/projects/Parses user and assistant messages, filtering noise (thinking blocks, tool calls, system messages, meta content)
Deduplicates streamed assistant messages
Indexes all messages with MiniSearch (BM25 ranking)
Server starts immediately — indexing happens in the background
If called before indexing completes, returns progress status
Development
Project Structure
mcp-claude-code-conversation-history/
├── src/
│ ├── index.ts # MCP server entry point
│ ├── types.ts # Shared type definitions
│ ├── core/
│ │ ├── conversation-parser.ts # JSONL parsing and content extraction
│ │ ├── conversation-store.ts # Conversation discovery and loading
│ │ └── search-index.ts # BM25 search via MiniSearch
│ ├── tools/
│ │ ├── definitions.ts # Zod schema for tool parameters
│ │ └── handler.ts # Action routing and response formatting
│ └── utils/
│ └── logger.ts # Pino logger (stderr only)
├── tests/
│ ├── conversation-parser.test.ts
│ ├── conversation-store.test.ts
│ ├── search-index.test.ts
│ └── tools.test.ts
└── docs/ # Architecture & testing docsTesting
# Run all tests
bun test
# Run in watch mode
bun test --watch
# Type checking
bun run typecheck
# Linting
bun run lint
# Full check (typecheck + lint)
bun run checkRequirements
Node.js >= 20.0.0
Claude Code conversation files in
~/.claude/projects/
Troubleshooting
Server Not Starting
If the tool doesn't appear in Claude Code:
Check
~/.claude.jsonhas the correct MCP server configurationRestart Claude Code after adding the configuration
Check stderr logs for error messages
No Conversations Found
If stats shows 0 conversations:
Verify
~/.claude/projects/exists and contains JSONL filesCheck that you have Claude Code conversation history
The server only indexes top-level JSONL files (subagent files are skipped)
Search Not Finding Expected Results
BM25 search works best with specific nouns and terms:
Use specific keywords, not generic phrases
Try different terms that might appear in the conversation
Use the
projectfilter to narrow resultsCheck
listaction to confirm the conversation exists
Contributing
Fork the repository
Create a feature branch
Write tests first (TDD approach)
Implement the feature
Ensure all tests pass (
bun test)Run linting (
bun run lint)Submit a pull request
License
MIT
Related Projects
Model Context Protocol - MCP specification and documentation
MCP TypeScript SDK - SDK used by this server
MCP Refactor TypeScript - MCP server for TypeScript refactoring
Available Tools
1 toolclaude_code_conversation_historyA
Search across ALL past Claude Code conversations, not just the current one.
vs git log/memory: This searches actual conversation content across every project and session. Git log only shows commits, memory only stores what was explicitly saved.
Use when: User asks about past work, previous sessions, "what did we do", "remember when", or anything from a different Claude Code conversation. Always use this first, not git log.
Actions:
stats: Overview of all conversations and projects
list: Browse by project/date (optional: project, after, before, limit)
search: BM25 keyword search (requires: query, optional: project, limit)
read: Read conversation (requires: session_id). Browse mode: paginate with offset/limit, messages truncated to 500 chars with contentLength. Focus mode: use limit=1 for full content. Grep mode: pass query to find matching messages with ±2 surrounding context.
Inputs: action (required), after, limit, query, +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
Only one tool exists, so there is no possibility of confusing it with another tool. The tool's single purpose is clearly defined as searching across all Claude Code conversations.
With only one tool, there is no inconsistent naming convention. The name 'claude_code_conversation_history' is descriptive and follows a clear pattern, making it easy for an agent to understand its purpose.
The tool count of one is slightly below the typical range, but this single tool is well-designed with multiple internal actions (stats, list, search, read) that cover the full scope of conversation history access, so it does not feel thin or under-provisioned.
The tool provides comprehensive coverage for its domain: stats for overview, list for browsing, search for finding specific content, and read for detailed retrieval. This covers the essential lifecycle of conversation history access without obvious gaps.
Maintenance
Related MCP Connectors
Your versioned prompt library: search, read, save and version prompts from Claude Code.
Persistent memory for Claude Code and Cursor. Stop re-explaining your project every session.
Shared work memory for Claude Code, Codex, Cursor and chat, scoped to each repository.
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables searching and retrieving Claude Code conversation history via hybrid semantic and keyword search, allowing the agent to access its own past interactions.203 PyPI5MIT
- AlicenseNot gradedqualityDmaintenanceSearch and reference your Claude Code conversation history directly from Claude, with full-text search, conversation viewing, and project browsing.23 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables searching and browsing past Claude Code conversations directly from within an active Claude session, with full-text search and cost tracking.MIT
- AlicenseNot gradedqualityAmaintenanceEnables Claude Code to search and retrieve past chat history from Claude.ai exports and Claude Code sessions, allowing the AI to reference previous conversations and decisions.MIT