claude-web-history-mcp

claude-web-history-mcp

Enables Claude Code to browse and import conversations from a user's claude.ai account, making mobile chat history available in the editor. Includes tools to list, read, and save web conversations locally.

Category
访问服务器

README

claude-web-history-mcp

I have ideas on my phone. I write code in VS Code. Those two things don't talk to each other, so every time I sat down to actually build something, the conversation where I worked it out was stuck on the other side of a wall.

This is an MCP server that tears down that wall — it lets Claude Code browse and pull in conversations from your claude.ai account, so a chat you had on your phone this morning is available in your editor this afternoon.

You choose which conversation to import. Nothing syncs automatically, nothing is written back to claude.ai, and no credential ever lands in a config file.

Before you use this: terms of service

Anthropic's Consumer Terms of Service prohibit what this tool does. Section 3 prohibits accessing the service "through automated or non-human means, whether through a bot, script, or otherwise," with the only carve-out being an official API key or Anthropic's explicit permission. That clause has been in place since February 2024 and has been enforced — in early 2026, accounts using third-party harnesses were terminated under it.

I'm not going to tell you this is fine. Read the terms yourself: https://www.anthropic.com/legal/consumer-terms. Decide for yourself.

What I can offer is the distinction I found relevant when deciding to use it myself. The enforcement action in 2026 targeted tools that routed inference traffic through consumer subscriptions — using a flat-rate plan to avoid API costs. This tool consumes no inference quota. It makes a few read-only requests for conversations you already created, data Anthropic also hands you via the official export feature under Settings.

That is a difference in kind, not a legal exemption. The clause doesn't have a "but it's read-only" exception. I judge the practical risk to be low. That is a judgment, not a promise, and I have no standing to make promises about how Anthropic enforces its terms. If you get your account suspended, that's your account, not mine.

If any of that gives you pause, stop here. The official export under Settings gets you the same data, slower and manually, with zero risk. It's a real option and for many people it's the right one.

Other things you should know

  • Your session key is equivalent to your claude.ai login. Anyone who obtains it can act as you. This code stores it in your OS keychain and only ever sends it to claude.ai — but you should verify that claim rather than take my word for it.
  • Don't paste your session key into any tool you haven't read the source of. Including this one. It's ~850 lines across four files, deliberately, so that reading it is realistic. Please do. Start with claude-web.js.
  • Be careful with forks. This code is short and simple enough that adding three lines to exfiltrate your key would be easy and easy to miss. Read the diff of whatever you actually run.
  • This uses undocumented endpoints and will break when Anthropic changes the web app. Treat it as disposable.
  • Anthropic has an open feature request for an official version (anthropics/claude-code #15542). That's the real fix. If it ships, delete this. Adding your use case to that thread is more useful than starring this repo.

Requirements

  • Node.js 18+
  • Claude Code (CLI, VS Code, JetBrains, or desktop — they share one config)
  • Works on macOS, Windows, and Linux

Install

Read the source first. Seriously — see the section above.

git clone https://github.com/DestinyJazz/claude-web-history-mcp.git
cd claude-web-history-mcp
npm install
npm run auth

npm run auth walks you through finding your session key, stores it in your OS keychain (macOS Keychain / Windows Credential Manager / Linux Secret Service), verifies it against claude.ai, and prints the exact command to register the server. Input is hidden while you type.

Then run the command it gives you — roughly:

claude mcp add claude-web-history --transport stdio -s user -- node /abs/path/to/index.js

There's deliberately no --env flag: the key lives in the keychain, not in ~/.claude.json.

Open the Claude Code panel, type /mcp, confirm it connected. Done.

You don't need to keep anything running

This is a stdio server. Claude Code spawns it on demand and it exits when the call finishes. Nothing to start, nothing to leave open, survives reboots.

Using it

Just talk to Claude Code:

List my recent claude.ai conversations about the auth redesign

Read conversation abc-123 and use it as context for what we're building here

Save conversation abc-123 to docs/context/auth-design.md

That last one is worth a habit: parking an important conversation as a file in the repo means it survives even if this server stops working.

Tools

Tool What it does
list_web_conversations Lists your claude.ai chats. Supports limit, offset, and a contains title filter.
read_web_conversation Pulls one conversation into the session as markdown. Truncates at max_chars (default 60k).
save_web_conversation Writes a conversation to a file in your repo.
debug_connection Verifies the session and shows the resolved org id. Pass raw_path to inspect a raw endpoint when something breaks.

Credentials

Command Effect
npm run auth Store or replace the session key.
npm run check Verify the stored key still works.
npm run auth -- --remove Delete the key from the keychain.

Resolution order: CLAUDE_SESSION_KEY env var (escape hatch, CI, headless Linux) → OS keychain (the default).

Session keys expire every few weeks, or immediately if you log out in the browser. When they do, tools return a message telling you to run npm run auth.

Safeguards in the code, so you can verify them:

  • The key is stored via @napi-rs/keyring — never written to a config file.
  • A hardcoded host allowlist means the server refuses to send the cookie anywhere but claude.ai. See ALLOWED_HOSTS in claude-web.js.
  • All output and error text passes through redact() before leaving the server, so a key can't leak into the model's context or a transcript.
  • Setup input is read with terminal echo off.
  • No logging to disk. Ever.

Other env vars

Var Purpose
CLAUDE_ORG_ID Skip org lookup by pinning your org uuid.
CLAUDE_WEB_BASE Override the base URL. Must still resolve to claude.ai.
CLAUDE_WEB_UA Override the User-Agent string.

When it breaks

Run debug_connection, or npm run check from a terminal.

  • "Session expired or missing" → run npm run auth with a fresh key.
  • HTTP 404 → the endpoint moved. Open claude.ai with DevTools → Network, click through your chat list, and compare against the EP block at the top of claude-web.js. That's the only place paths are defined — one edit fixes it.
  • List works but message text is empty → the message payload shape changed. See the content[] handling in getConversation().
  • Keychain unavailable (headless Linux, no Secret Service) → set CLAUDE_SESSION_KEY as an env var instead.

Layout

index.js        MCP server — tool definitions
claude-web.js   claude.ai client — all endpoints live at the top
credentials.js  keychain storage, key normalization, redaction
setup.js        interactive `npm run auth`

Dependency direction is one-way: index.js and setup.js both depend on claude-web.js, which depends only on credentials.js. Reading those last two is enough to confirm where the key can and can't go.

License

MIT. Not affiliated with, endorsed by, or supported by Anthropic.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选