Skip to content

Vvkmnn/claude-historian

Repository files navigation

claude-historian

claude-historian

A Model Context Protocol (MCP) server for searching your Claude Code (& Claude Desktop) conversation history. Find past solutions, track file changes, and learn from previous work.

TypeScript npm version License: MIT Node.js CodeRabbit Pull Request Reviews Claude

install

Requirements:

npm install -g claude-historian

From shell:

claude mcp add claude-historian -- npx claude-historian

From inside Claude (restart required):

Add this to our global mcp config: npx claude-historian

Install this mcp: https://github.com/Vvkmnn/claude-historian

From any manually configurable mcp.json: (Cursor, Windsurf, etc.)

{
  "mcpServers": {
    "claude-historian": {
      "command": "npx",
      "args": ["claude-historian"],
      "env": {}
    }
  }
}

That's it; there is no npm install required as there are no external dependencies or local databases, only search algorithms.

However, in the unlikely event that you pull the wrong package / npx registry is out of date, you can force resolution issues in certain environments with:

npm install -g claude-historian

features

MCP server that gives Claude access to your conversation history. Fast search with smart prioritization.

Runs locally (with cool shades [βŒβ– _β– ]):

[βŒβ– _β– ] search_conversations query=<query>
  > "How did we fix that Redis connection pooling nightmare?"
  > "Docker container keeps crashing on Kubernetes deployment"
  > "React infinite re-render loop - useEffect dependency hell"

[βŒβ–‘_β–‘] find_file_context filepath=<filepath>
  > "package.json changes that broke everything last month"
  > "When we accidentally committed .env to main branch"
  > "Authentication service refactor - before/after comparison"

[βŒΓ—_Γ—] get_error_solutions error_pattern=<error>
  > "MODULE_NOT_FOUND - the classic npm/yarn version mismatch"
  > "CORS preflight failing - but only on production Fridays?"
  > "Database deadlock during Black Friday traffic spike"

[βŒβ—†_β—†] find_similar_queries query=<query>
  > "Database queries slower than my morning coffee brewing"
  > "How to implement error boundaries without losing sanity"
  > "State management: Redux vs Zustand vs just useState"

[βŒβ—‹_β—‹] list_recent_sessions
  > "Tuesday debugging marathon: 9pm-3am flaky test hunt"
  > "Performance optimization sprint - reduced bundle 40%"
  > "The great TypeScript migration of 2024"

[⌐⎚_⎚] find_tool_patterns tool_name=<tool>
  > "Read β†’ Edit β†’ Bash combo for rapid prototyping"
  > "When I use Grep vs Task for different searches"
  > "Git operations during feature branch management"

methodology

How claude-historian works:

"docker auth" query
      |
      β”œβ”€> Parallel Processing (search.ts:949): 15 projects Γ— 10 files concurrently
      |   β€’ Promise.allSettled for 6x speed improvement
      |   β€’ Early termination when sufficient results found
      |   β€’ Enhanced file coverage with comprehensive patterns
      |
      β”œβ”€> Enhanced Classification (search.ts:294): implementation β†’ boost tool workflows
      |   β€’ Workflow detection for tool sequences (Edit β†’ Read β†’ Bash)
      |   β€’ Semantic boundary preservation (never truncate mid-function)
      |   β€’ Claude-optimized formatting with rich metadata
      |
      β”œβ”€> Smart Ranking (search.ts:213):
      |   β€’ "Edit workflow (7x successful)" (2h ago) *****
      |   β€’ "Docker auth with context paths" (yesterday) ****
      |   β€’ "Container debugging patterns" (last week) ***
      |
      └─> Return Claude Code optimized results

Core optimizations:

Search strategies:

File access:

  • Reads from: ~/.claude/conversations/
  • Zero persistent storage or indexing
  • Never leaves your machine

development

git clone https://github.com/vvkmnn/claude-historian && cd claude-historian
npm install && npm run build
npm test

Package requirements:

  • Node.js: >=20.0.0 (ES modules support)
  • npm: >=10.0.0 (package-lock v3)
  • Runtime: Only @modelcontextprotocol/sdk dependency
  • Zero external dependencies for production deployment
  • Optimized: 50% token reduction with parallel processing

Development workflow:

npm run build          # TypeScript compilation with executable permissions
npm run dev            # Watch mode with tsc --watch
npm run lint           # ESLint code quality checks
npm run format         # Prettier formatting
npm run type-check     # TypeScript validation without emit
npm run prepublishOnly # Pre-publish validation (build + lint + format)

Contributing:

  • Please fork the repository and create feature branches
  • Test with large conversation histories before submitting PRs
  • Follow TypeScript strict mode and MCP protocol standards

Learn from examples:

desktop

Claude Desktop support is currently blocked by LevelDB locks and Electron sandboxing. You will still search Claude Desktop from Claude Code, but only when the Claude app is closed.

A DXT package and build is available for future compatibility; further investigations are ongoing. Feel free to test with it.

license

MIT


Claude Fauchet

Claude Fauchet (1744-1793), French Historian