Search and browse Claude conversation history with hybrid search (FTS + Spotlight + vector embeddings)
Project description
Cowork History MCP
An MCP (Model Context Protocol) server for searching and browsing your Claude conversation history stored in ~/.claude/. Works with both Claude Code and Cowork conversations.
Features
- Hybrid Search - Combines multiple search methods for best results:
- SQLite FTS5 - Fast full-text search with BM25 ranking
- macOS Spotlight - Leverages system content indexing via
mdfind - Vector Embeddings - Semantic similarity search (optional, requires Ollama)
- Smart Path Reconstruction - Recovers actual filesystem paths via probing (not heuristic guessing)
- Persistent Index - SQLite database with incremental updates for fast queries
- Ollama Setup Tools - Automated installation and configuration for embeddings
Installation
Option 1: Claude Desktop (One-Click Install)
Download cowork-history.mcpb from the latest release and double-click to install.
Option 2: Via uvx (Recommended for CLI)
uvx cowork-history
Option 3: Via pip
pip install cowork-history
Option 4: Manual Configuration
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"cowork-history": {
"command": "uvx",
"args": ["cowork-history"],
"env": {
"OLLAMA_URL": "http://localhost:11434",
"EMBEDDING_MODEL": "nomic-embed-text"
}
}
}
}
Quick Start
Once installed, Claude can search your conversation history:
"What did we discuss about authentication last week?"
"Find the conversation where we debugged the payment webhook"
"Show me my conversations in the my-project folder"
Available Tools
Search & Browse
| Tool | Description |
|---|---|
cowork_history_search |
Search conversations using hybrid search (FTS + Spotlight + vector) |
cowork_history_list |
List recent conversations, optionally filtered by project |
cowork_history_get |
Get full content of a specific conversation by session ID |
cowork_history_projects |
List all projects with conversation history |
cowork_history_stats |
Get statistics and search capability status |
cowork_history_reindex |
Rebuild index and optionally generate embeddings |
Ollama Setup (for Vector Search)
| Tool | Description |
|---|---|
history_system_check |
Check system requirements for Ollama |
history_setup_ollama |
Install Ollama via Homebrew (macOS) |
history_setup_ollama_direct |
Install Ollama via direct download (no Homebrew) |
history_ollama_status |
Check Ollama status and embedding model availability |
Search Modes
The cowork_history_search tool supports multiple search modes:
| Mode | Description |
|---|---|
auto (default) |
Uses all available methods, best results |
fts |
Full-text search only (fastest) |
spotlight |
macOS Spotlight only |
vector |
Semantic similarity only (requires Ollama) |
hybrid |
Explicit combination with ranking |
Search Examples
"authentication bug" → finds conversations with both words
"how to deploy" → semantic search finds related discussions
"\"exact phrase\"" → exact phrase matching
project:"my-app" "database" → filter by project
Enabling Vector Search
Vector search provides semantic similarity matching (finding related concepts even without exact keywords). It requires Ollama with an embedding model.
Quick Setup
Ask Claude to set it up for you:
"Set up Ollama for vector search"
Or manually:
# Install Ollama (macOS)
brew install ollama
# Start Ollama service
brew services start ollama
# Pull the embedding model
ollama pull nomic-embed-text
Then generate embeddings:
"Rebuild the history index with embeddings"
How It Works
Indexing
The server maintains a SQLite database at ~/.claude/.history-index/conversations.db with:
- FTS5 virtual table for fast full-text search
- Conversation metadata (session ID, project, timestamps, topic)
- Full content for comprehensive search
- Path cache for reconstructed paths
- Embeddings table for vector search (optional)
The index updates automatically when you search (if >5 minutes old) or you can force a rebuild with cowork_history_reindex.
Environment Variables
| Variable | Default | Description |
|---|---|---|
OLLAMA_URL |
http://localhost:11434 |
Ollama server URL |
EMBEDDING_MODEL |
nomic-embed-text |
Ollama embedding model |
Troubleshooting
No conversations found
- Make sure
~/.claude/directory exists - Check that you have conversation history (use Claude Code or Cowork first)
- Verify the MCP server is properly configured
Vector search not available
- Check Ollama is installed:
ollama --version - Check Ollama is running:
curl http://localhost:11434/api/tags - Check model is available:
ollama list - Pull embedding model:
ollama pull nomic-embed-text
Search not finding expected results
- Try natural language queries (semantic search is more flexible)
- Use
mode: "fts"for exact phrase matching - Check
cowork_history_statsto see which search backends are active
Development
Running locally
# Clone the repository
git clone https://github.com/egoughnour/cowork-history
cd cowork-history
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest tests/
# Run the server directly
python -m src.cowork_history_server
Testing with MCP Inspector
npx @modelcontextprotocol/inspector uvx cowork-history
License
MIT License - see LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cowork_history-4.0.3.tar.gz.
File metadata
- Download URL: cowork_history-4.0.3.tar.gz
- Upload date:
- Size: 29.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
551d346e209fe88f905a7a27b70d2d66e8fb5d8d382721bb94f32bf24d6150e2
|
|
| MD5 |
362469a52e62d718cc1c5a6d36c76cd9
|
|
| BLAKE2b-256 |
173fa8e92582438677e1499ac716bd0b6c5a3320fae5d459ba7d1e19b9d52ce8
|
Provenance
The following attestation bundles were made for cowork_history-4.0.3.tar.gz:
Publisher:
release.yml on egoughnour/cowork-history
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cowork_history-4.0.3.tar.gz -
Subject digest:
551d346e209fe88f905a7a27b70d2d66e8fb5d8d382721bb94f32bf24d6150e2 - Sigstore transparency entry: 871578376
- Sigstore integration time:
-
Permalink:
egoughnour/cowork-history@270013bcd4c0a83ecf059951a513876402b9d2c6 -
Branch / Tag:
refs/tags/v4.0.3 - Owner: https://github.com/egoughnour
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@270013bcd4c0a83ecf059951a513876402b9d2c6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cowork_history-4.0.3-py3-none-any.whl.
File metadata
- Download URL: cowork_history-4.0.3-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30ecae7248713a1d0b74bb6a0900f21e2c19652a2dc5a52404454ca46487fbf7
|
|
| MD5 |
81e13c3789cebb4db93daadb4ff878cf
|
|
| BLAKE2b-256 |
0927d5ef19855add6ec0cf927be57ad8d5997d623d4317a0ce82c05dc6b9503e
|
Provenance
The following attestation bundles were made for cowork_history-4.0.3-py3-none-any.whl:
Publisher:
release.yml on egoughnour/cowork-history
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cowork_history-4.0.3-py3-none-any.whl -
Subject digest:
30ecae7248713a1d0b74bb6a0900f21e2c19652a2dc5a52404454ca46487fbf7 - Sigstore transparency entry: 871578377
- Sigstore integration time:
-
Permalink:
egoughnour/cowork-history@270013bcd4c0a83ecf059951a513876402b9d2c6 -
Branch / Tag:
refs/tags/v4.0.3 - Owner: https://github.com/egoughnour
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@270013bcd4c0a83ecf059951a513876402b9d2c6 -
Trigger Event:
push
-
Statement type: