Skip to main content
Glama
ilovecat1005

mcp-server-chat-history

by ilovecat1005

mcp-server-chat-history

把你的 ChatGPT / Claude 匯出檔變成 MCP server。設定好之後,Claude 可以直接用工具呼叫搜尋、翻閱你過去和 AI 的全部對話——「我去年問過怎麼寫 regex」這種問題,讓 AI 自己去翻。

本機執行,只讀取你指定的檔案,没有網路請求。

提供的工具

工具

說明

search_history

全文搜尋所有對話,回傳命中片段(可只搜你送出的訊息)

list_conversations

列出對話標題、時間、訊息數

read_conversation

依標題讀出完整對話內容

支援 ChatGPT 與 Claude 官方匯出的 conversations.json,自動偵測格式。

Related MCP server: cowork-history

安裝與設定

先從官方匯出對話:

  • ChatGPT:設定 → Data controls → Export data

  • Claude:設定 → Privacy → Export data

解壓縮後記下 conversations.json 的路徑,然後擇一設定:

Claude Code

claude mcp add chat-history -- uvx --from "git+https://github.com/ilovecat1005/mcp-server-chat-history" mcp-server-chat-history --file /path/to/conversations.json

Claude Desktop(claude_desktop_config.json)

{
  "mcpServers": {
    "chat-history": {
      "command": "uvx",
      "args": [
        "--from", "git+https://github.com/ilovecat1005/mcp-server-chat-history",
        "mcp-server-chat-history",
        "--file", "/path/to/conversations.json"
      ]
    }
  }
}

需要先裝好 uv。不想用 uv 的話,pipx install "mcp-server-chat-history @ git+https://github.com/ilovecat1005/mcp-server-chat-history" 之後把 command 換成 mcp-server-chat-history 也可以。

已知限制

  • 匯出檔是快照:新對話不會自動出現,重新匯出後重啟 server 即可

  • 大型匯出檔(幾萬則訊息)啟動解析約需數秒

  • 只支援官方匯出格式

開發

python3 -m unittest discover -s tests -v

原始碼結構:history.py 是純邏輯(解析、搜尋),server.py 只是把三個函式接上 MCP 協定。

授權

MIT

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables Claude Code to search and retrieve past chat history from Claude.ai exports and Claude Code sessions, allowing the AI to reference previous conversations and decisions.
    MIT
  • A
    license
    B
    quality
    C
    maintenance
    Enables searching and browsing of Claude conversation history with hybrid search combining full-text, Spotlight, and optional vector embeddings.
    10
    1
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables Claude to search through its own past sessions using full-text search and resume them. Works offline with zero runtime dependencies.
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Provides Claude with read-only access to your WhatsApp chat history entirely on your local machine, enabling natural language search, summarization, and retrieval of messages without sending data to the cloud.
    6 npm
    MIT