cowork-history

cowork-history

Enables searching and browsing of Claude conversation history with hybrid search combining full-text, Spotlight, and optional vector embeddings.

Category
访问服务器

README

Cowork History MCP

<!-- mcp-name: io.github.egoughnour/cowork-history -->

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

  1. Make sure ~/.claude/ directory exists
  2. Check that you have conversation history (use Claude Code or Cowork first)
  3. Verify the MCP server is properly configured

Vector search not available

  1. Check Ollama is installed: ollama --version
  2. Check Ollama is running: curl http://localhost:11434/api/tags
  3. Check model is available: ollama list
  4. 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_stats to 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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选