https://github.com/Vvkmnn/claude-historian
🤖 An MCP server for Claude Code conversation history
https://github.com/Vvkmnn/claude-historian
anthro claude claude-ai claude-code claude-mcp mcp mcp-sdk mcp-server mcp-tools types
Last synced: 3 months ago
JSON representation
🤖 An MCP server for Claude Code conversation history
- Host: GitHub
- URL: https://github.com/Vvkmnn/claude-historian
- Owner: Vvkmnn
- License: mit
- Created: 2025-07-14T05:19:45.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2025-07-14T08:53:27.000Z (4 months ago)
- Last Synced: 2025-07-14T11:35:20.284Z (4 months ago)
- Topics: anthro, claude, claude-ai, claude-code, claude-mcp, mcp, mcp-sdk, mcp-server, mcp-tools, types
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/claude-historian
- Size: 14.6 MB
- Stars: 9
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-claude-code - **claude-historian**
README
# claude-historian

A Model Context Protocol (MCP) server for searching your Claude Code conversation history. Find past solutions, track file changes, and learn from previous work.
[](https://www.typescriptlang.org/)
[](https://www.npmjs.com/package/claude-historian)
[](https://opensource.org/licenses/MIT)
[](https://nodejs.org/)

## install
Requirements:
- [Claude Code](https://claude.ai/code)
**From shell:**
```bash
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.)
```json
{
"mcpServers": {
"claude-historian": {
"command": "npx",
"args": ["claude-historian"],
"env": {}
}
}
}
```
That's it. No `npm install` needed; there are no external dependencies or local databases, only search algorithms.
## features
[MCP server](https://modelcontextprotocol.io/) that gives Claude access to your conversation history. Fast search with smart prioritization.
Runs locally (with cool shades `[⌐■_■]`):
```
[⌐■_■] search_conversations 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=
> "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=
> "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=
> "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=
> "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 ([source](https://github.com/Vvkmnn/claude-historian/tree/main/src)):
```
"docker auth" query
|
├─> Classify: implementation query -> boost tool examples
|
├─> Stream & Filter:
| • Summary messages -> priority queue *****
| • Tool usage context -> high value ****
| • Error solutions -> targeted ***
|
├─> Smart Ranking:
| • "Fixed Docker auth with Read tool" (2h ago) *****
| • "OAuth implementation approach" (yesterday) ****
| • "Container auth debug" (last week) ***
|
└─> Return Claude Code optimized results
```
**Pure streaming architecture using:**
- **[JSON streaming parser](https://en.wikipedia.org/wiki/Streaming_JSON)**: Reads Claude Code conversation files on-demand without full deserialization
- **[LRU caching]()**: In-memory cache with intelligent eviction for frequently accessed conversations
- **[TF-IDF inspired scoring](https://en.wikipedia.org/wiki/Tf%E2%80%93idf)**: Term frequency scoring with document frequency weighting for relevance
- **[Query classification](https://en.wikipedia.org/wiki/Text_classification)**: Naive Bayes-style classification (error/implementation/analysis/general) with adaptive limits
- **[Edit distance](https://en.wikipedia.org/wiki/Edit_distance)**: Fuzzy matching for technical terms and typo tolerance
- **[Exponential time decay](https://en.wikipedia.org/wiki/Exponential_decay)**: Recent messages weighted higher with configurable half-life
**File access:**
- Reads from: `~/.claude/conversations/`
- Zero persistent storage or indexing
- Never leaves your machine
## development
```bash
git clone https://github.com/vvkmnn/claude-historian && cd claude-historian
npm install && npm run build
npm test
```
Contributing:
- Please fork the repository and create feature branches
- Test with large conversation histories before submitting PRs
- Follow TypeScript strict mode and [MCP protocol](https://spec.modelcontextprotocol.io/) standards
Learn from examples:
- [Official MCP servers](https://github.com/modelcontextprotocol/servers) for reference implementations
- [TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk) for best practices
## license
[MIT](LICENSE)
---

_Claude Fauchet (1744-1793), French Historian_