Logo di Claude History MCP

Claude History MCP

Community
jhammant

MCP server for searching and surfacing Claude Code conversation history

Autorejhammant
RepositoryClaudeHistoryMCP
LinguaTypeScript
Fork
11
Stelle
66
Strumenti disponibili
0
Tipo di trasportostdio
Categorie
LicenzaMIT
Link
  • Collega gli strumenti ai flussi di lavoro IA

    Claude History MCP mette a disposizione funzionalità MCP utilizzabili da client e agenti IA compatibili.

  • 0 strumenti disponibili

    Esplora le azioni richiamabili qui sotto, con nomi e descrizioni quando forniti dal server.

  • Configurazione pronta da copiare

    Usa gli esempi di installazione per configurare questo server nel tuo client MCP preferito.

  • Indicatori di interesse open source

    66 stelle e 11 fork nel repository collegato.

Claude History MCP

An MCP server that makes your Claude Code conversation history searchable and proactively useful. Indexes all past sessions with hybrid BM25 + TF-IDF search, extracts knowledge (decisions, solutions, error fixes), and auto-injects project context at session start.

What it does

Claude Code stores full conversation transcripts as JSONL files in ~/.claude/projects/. This MCP server indexes them and provides 6 tools:

ToolPurpose
search_historyFull-text search across all conversations with filter syntax
find_solutionsFind how you fixed errors/problems before
get_session_summaryStructured summary of any session
list_projectsList all projects with session counts and dates
find_patternsDiscover recurring topics, workflows, and issues
get_project_contextFull project context (recent sessions, decisions, knowledge)
cloud_sync_pushPush knowledge and sessions to cloud server
cloud_sync_pullPull knowledge and sessions from cloud server
cloud_sync_statusCheck cloud sync configuration and connection

Key features

  • Hybrid search: BM25 (keyword precision) + TF-IDF (semantic recall) fused with Reciprocal Rank Fusion
  • Filter syntax: project:name, before:7d, after:2024-01-15, tool:Bash
  • Knowledge extraction: Automatically extracts decisions, solutions, and error→fix patterns from conversations
  • Proactive context: Session-start hook injects relevant project history into new sessions
  • Incremental indexing: File watcher detects new/changed sessions and re-indexes automatically
  • Fast: Index build ~9s for 170 sessions, searches <200ms

How it works

text
┌──────────────────────────────────────────────────────┐
│                  ClaudeHistoryMCP                     │
├──────────────┬───────────────┬───────────────────────┤
│  MCP Server  │  /claude-history  │  SessionStart Hook │
│  (6 tools)   │  Skill            │  (auto-context)    │
├──────────────┴───────────────┴───────────────────────┤
│              Hybrid Search Engine                     │
│          BM25 (keywords) + TF-IDF (semantic)         │
├──────────────────────────────────────────────────────┤
│  Indexing Pipeline  │  Knowledge Layer  │  Summaries  │
├──────────────────────────────────────────────────────┤
│  JSONL Parsers  │  File Watcher  │  Document Store    │
└──────────────────────────────────────────────────────┘
         ↕                    ↕
~/.claude/history.jsonl    ~/.claude/projects/*/*.jsonl

Search engine

  1. Tokenizer: lowercase → strip markdown → split → remove stop words → Porter stem → bigrams
  2. BM25: Inverted index for keyword precision (Okapi BM25, k1=1.2, b=0.75)
  3. TF-IDF: Sparse vectors + cosine similarity for semantic recall
  4. Fusion: Reciprocal Rank Fusion (RRF) combining both rankings
  5. Boosting: recency (7d=1.2x, 30d=1.1x) + project-match (1.3x if cwd matches)

Knowledge extraction

When sessions end (file stops changing for 5+ minutes), the system automatically extracts:

  • Decisions: "decided to", "going with", "chose" patterns
  • Solutions: "fixed", "solved", "the issue was" patterns
  • Error fixes: error → resolution sequences

Data storage

Runtime data stored at ~/.claude-history-mcp/:

text
~/.claude-history-mcp/
  index.msgpack               # Serialized search index
  knowledge.json              # Extracted knowledge entries
  summaries/{sessionId}.json  # Cached session summaries
  meta.json                   # Last-indexed timestamps

Installation

bash
git clone https://github.com/jhammant/ClaudeHistoryMCP.git
cd ClaudeHistoryMCP
npm install
npm run build

1. Build the search index

bash
npm run build-index

This parses all your Claude Code conversation history and builds the search index. Takes ~10 seconds for ~170 sessions.

2. Register the MCP server

bash
claude mcp add claude-history -- node "/path/to/ClaudeHistoryMCP/dist/index.js"

3. Install the session-start hook and skill (optional)

bash
npm run install-hook

This registers a SessionStart hook in ~/.claude/settings.json that auto-injects project context, and installs the /claude-history skill.

4. Add to your CLAUDE.md (recommended)

Add the following to your global ~/.claude/CLAUDE.md to ensure Claude proactively uses history tools:

markdown
## Claude History MCP

When the `claude-history` MCP is available, use it proactively:

- **Session start**: Use `get_project_context` to check for prior decisions, patterns, and recent session summaries for the current project
- **Debugging**: Use `find_solutions` to search history for past fixes before starting from scratch
- **Context questions**: When the user asks "have we done X before", "what did we decide", or similar — use `search_history` to find relevant past conversations
- **Patterns**: Use `find_patterns` to identify recurring workflows or issues when relevant

Without this, Claude has access to the tools but may not always think to reach for them.

5. Configure cloud sync (optional)

To sync knowledge across devices or share with a team, set up ClaudeHistory Cloud:

bash
export CLAUDE_HISTORY_API_URL=https://your-server.com
export CLAUDE_HISTORY_API_KEY=your-api-key
export CLAUDE_HISTORY_TEAM_ID=optional-team-uuid  # for team sync

Then use the cloud_sync_push and cloud_sync_pull tools to sync.

Usage

Via MCP tools (automatic)

Once registered, Claude Code can use the tools directly:

text
User: "Have I dealt with this ECONNREFUSED error before?"
Claude: [calls find_solutions with "ECONNREFUSED"]
→ Shows past solutions from your history

Via the /claude-history skill

bash
/claude-history docker network error          # General search
/claude-history --solutions ECONNREFUSED      # Find past error fixes
/claude-history --summary                     # Summarize last session
/claude-history --patterns                    # Discover recurring patterns
/claude-history --context                     # Get full project context
/claude-history --projects                    # List all projects

Filter syntax

Queries support inline filters:

text
search_history("docker error project:ghostty after:7d")
search_history("authentication tool:Bash before:2024-06-01")
search_history("deployment project:myapp after:30d")
  • project:name — filter to a project (partial match)
  • before:date / after:date — date filter (ISO or relative: 7d, 1w, 1m, 1y)
  • tool:name — filter to sessions using a specific tool

Session-start hook

When you start a new Claude Code session, the hook automatically outputs:

text
[ClaudeHistory] Previous context for myproject:
- Last session (2 days ago): Fixed Docker networking — switched to host networking
- Key decision: Use systemd timer instead of cron for scheduling
- Solution found: CORS issue resolved by adding proxy config

Project structure

text
src/
  index.ts                    # MCP server entry (stdio transport)
  server.ts                   # Tool registration via McpServer + zod
  config.ts                   # Paths, constants, defaults
  parsers/
    history-parser.ts         # Parse ~/.claude/history.jsonl
    session-parser.ts         # Stream-parse session JSONL files
    content-extractor.ts      # Extract text from message content arrays
  indexing/
    index-manager.ts          # Orchestrate indexing, persistence, incremental updates
    bm25.ts                   # BM25 inverted index (Okapi BM25)
    tfidf.ts                  # TF-IDF vectors + cosine similarity
    tokenizer.ts              # Tokenize, stem, stop words, bigrams
    document-store.ts         # Store indexed document chunks + metadata
  search/
    search-engine.ts          # Hybrid search: BM25 + TF-IDF + RRF fusion
    query-processor.ts        # Parse query syntax (project:, before:, after:)
    result-ranker.ts          # Score fusion, recency/project boost, dedup
  knowledge/
    knowledge-store.ts        # Persist extracted knowledge entries
    session-summarizer.ts     # Generate session summaries (heuristic, no LLM)
    knowledge-extractor.ts    # Extract decisions, solutions, error fixes
  sync/
    cloud-client.ts           # HTTP client for ClaudeHistory Cloud API
    sync-state.ts             # Track last sync timestamps
  watcher/
    file-watcher.ts           # Debounced fs.watch on conversation files
    incremental-indexer.ts    # Diff mtimes, re-index only changed files
  tools/                      # One file per MCP tool handler
  hooks/
    session-start-hook.ts     # Auto-inject project context on session start
  utils/
    stemmer.ts                # Inline Porter stemmer (no deps)
    path-encoder.ts           # Encode/decode Claude's project path format
    cache.ts                  # LRU cache
  cli/
    build-index.ts            # Build the full search index
    install.ts                # Install hook + skill
commands/
  claude-history.md           # /claude-history skill definition
tests/                        # Unit + integration tests (82 tests)

Dependencies

Minimal — only 2 runtime dependencies:

  • @modelcontextprotocol/sdk — MCP protocol
  • msgpackr — efficient index serialization
  • zod — schema validation (peer dep of MCP SDK)

Porter stemmer and stop words are implemented inline.

Development

bash
npm run dev          # Run with tsx (no build needed)
npm run build        # Compile TypeScript
npm test             # Run tests
npm run test:watch   # Watch mode
npm run build-index  # Rebuild the search index

License

MIT

Installazione

TypingMind
{
  "mcpServers": {
    "claudehistorymcp": {
      "command": "node",
      "args": [
        "dist/index.js"
      ]
    }
  }
}

Usa MCP Claude History MCP con più modelli IA

TypingMind collega gli strumenti MCP a livello di area di lavoro: una volta connesso Claude History MCP, puoi usarlo con diversi modelli IA in TypingMind, senza configurarlo separatamente per ogni modello. Questa integrazione MCP viene eseguita localmente sul tuo dispositivo tramite il connettore MCP di TypingMind.

Guida alla configurazione del connettore locale

Usa questo metodo quando il server MCP deve accedere a file locali, app o risorse private sul tuo computer.

1

Apri le impostazioni MCP

In TypingMind, vai su Impostazioni, Impostazioni avanzate, poi su Model Context Protocol e scegli Configura MCP.

  1. Apri TypingMind nel tuo browser.
  2. Fai clic sull'icona Impostazioni.
  3. Vai a Impostazioni avanzate.
  4. Apri la sezione Model Context Protocol.
  5. Fai clic su Configura MCP e scegli Questo dispositivo.
Schermata di configurazione del connettore MCP di TypingMind con Questo dispositivo selezionato
2

Esegui il comando del connettore

Scegli Questo dispositivo, copia il comando da TypingMind ed eseguilo nel terminale. Lascia il processo in esecuzione mentre usi MCP.

  1. Copia il comando di configurazione mostrato da TypingMind.
  2. Apri Terminale su macOS o Windows Terminal su Windows.
  3. Incolla ed esegui il comando.
  4. Conferma l'installazione del pacchetto se il terminale ti chiede di procedere.
  5. Tieni aperta la finestra del terminale con il processo in esecuzione mentre usi gli strumenti MCP.
3

Aggiungi Claude History MCP come server

Quando lo stato del connettore è Pronto, fai clic su Modifica server e incolla la configurazione del server MCP.

  1. Attendi che lo stato del connettore sia Pronto.
  2. Fai clic su Modifica server.
  3. Incolla la configurazione del server MCP di Claude History MCP.
  4. Salva l'elenco dei server.
  5. Aggiorna per verificare che il connettore sia ancora pronto.
Impostazioni MCP di TypingMind con un server attivo e il pulsante Modifica server
{
  "mcpServers": {
    "claudehistorymcp": {
      "command": "npx",
      "args": [
        "-y",
        "claude-history-mcp"
      ]
    }
  }
}
4

Usa la connessione con diversi modelli

Salva l'elenco dei server, apri Plugin, abilita gli strumenti MCP di Claude History MCP, poi seleziona un modello IA supportato in TypingMind e usa gli strumenti in chat o assegnali a un agente IA.

  1. Apri la pagina Plugin in TypingMind.
  2. Abilita gli strumenti MCP di Claude History MCP.
  3. Avvia una chat e scegli il modello IA che vuoi usare.
  4. Usa gli strumenti MCP in chat o assegnali a un agente IA.
  5. Passa a un altro modello IA quando serve, senza riconnettere MCP.
Chat di TypingMind che usa gli strumenti MCP abilitati con un modello IA selezionato
Puoi usare Claude History MCP per aiutarmi con questa attività?
Claude History MCP
Certo. Ho letto.
Ecco cosa ho trovato con Claude History MCP.

Domande frequenti

A cosa serve il server MCP Claude History MCP?

Claude History MCP è un server MCP che consente ai client IA compatibili di accedere a strumenti e informazioni di contesto esterni. In TypingMind puoi aggiungere questo server MCP una sola volta e rendere disponibili i suoi strumenti nella tua area di lavoro IA.

Posso usare Claude History MCP MCP con più modelli IA in TypingMind?

Sì. TypingMind collega gli strumenti MCP a livello di area di lavoro, quindi puoi usare Claude History MCP con diversi modelli IA come Claude, ChatGPT, Gemini o altri modelli che hai configurato in TypingMind, senza dover configurare il server MCP separatamente per ogni modello.

Perché usare il connettore MCP Claude History MCP con TypingMind?

TypingMind è una delle migliori interfacce per chattare con gli LLM perché riunisce più modelli IA, prompt, plugin, agenti IA, chiavi API e strumenti MCP in un'unica area di lavoro. Collegando Claude History MCP, puoi usare i suoi strumenti MCP con i tuoi modelli preferiti e mantenere organizzato il tuo flusso di lavoro in chat su TypingMind.

Come collego Claude History MCP MCP a TypingMind?

Claude History MCP funziona tramite il connettore MCP locale di TypingMind. È la soluzione ideale quando il server MCP deve accedere a file locali, app desktop, strumenti da riga di comando o risorse private sul tuo computer.

Quali strumenti offre Claude History MCP MCP in TypingMind?

Claude History MCP mette a disposizione funzionalità MCP che puoi attivare dalla pagina Plugin di TypingMind e usare in chat o assegnare agli agenti IA.

Devo condividere le mie chiavi API con TypingMind per usare Claude History MCP MCP?

No. TypingMind privilegia il funzionamento in locale e ti permette di mantenere il controllo su fornitori di modelli, chiavi API, prompt e configurazione MCP. Se Claude History MCP richiede l'autenticazione, aggiungi le intestazioni, le impostazioni OAuth o la configurazione locale necessarie per quel server MCP quando crei la connessione.

Server MCP correlati

Vedi tutti

Crea subito la tua area di lavoro IA

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇