Content
# Chat Search MCP
A MCP Server that enables **cross-session search of historical chat records** for Claude Code.
New conversations can now find all previously discussed content - no need to repeat context explanations.
## What Problem Does It Solve
Every new conversation in Claude Code starts from scratch. How many companies do you have? What requirements were discussed previously? What technical decisions were made? All rely on manual records in MEMORY.md.
Chat Search automatically indexes all project chat records (local JSONL files), providing full-text search capabilities, all within a single conversation.
## Features
| Tool | Functionality |
|------|------|
| `search_chats` | Full-text search of chat records (English and Chinese) |
| `get_chat_context` | Retrieve context for a specific message (5 messages before and after) |
| `list_projects` | List all projects and chat statistics |
| `get_stats` | Indexing progress statistics |
| `rebuild_index` | Rebuild/update index |
## Installation
### 1. Install Dependencies
```bash
pip install fastmcp
```
### 2. Clone Repository
```bash
git clone https://github.com/RogXSkill/chat-search-mcp.git ~/.claude/chat-search-mcp
```
### 3. Register with Claude Code
Create `.mcp.json` in the project root directory:
```json
{
"mcpServers": {
"chat-search": {
"type": "stdio",
"command": "python",
"args": ["C:\\Users\\YourUsername\\.claude\\chat-search-mcp\\server.py"],
"env": {}
}
}
}
```
### 4. Initial Indexing
After restarting Claude Code, invoke `rebuild_index` in the first message:
> Help me rebuild the chat record index
## Usage Examples
```
You: How many companies did I discuss previously?
Claude → Search chat records → Found 3 companies: Rui Zhen Information, Jian Shuo Technology, Ning Yuan Intelligent Instrument
You: Tell me more about the ultrasonic inspection platform
Claude → Search context → Completely restore the discussion from that day
```
## Principles
- Read chat record files `~/.claude/projects/*.jsonl`
- SQLite full-text indexing, pure local, zero dependencies
- Exposed as a standard MCP tool through FastMCP
- Directly callable search in Claude Code conversations
## Tech Stack
- Python 3.11+
- FastMCP
- SQLite
## License
MIT
## Authors
- **Wang Aicheng** — Product idea & project initiation
- **Skill (Claude)** — Code implementation
🤖 This project was assisted by Claude Code