Skip to main content
Glama
claude-web-history-mcp

claude-web-history-mcp

by EngDawood
README.md
# claude-web-history-mcp

Read-only MCP server that lets Claude Code search and read your **claude.ai**
conversations, across **several accounts** (e.g. one per Chrome profile).

Derived from [DestinyJazz/claude-web-history-mcp](https://github.com/DestinyJazz/claude-web-history-mcp)
(MIT, see `LICENSE`). Added: multiple accounts, cross-account title search, paged reads.

## Read this first

- It uses claude.ai's **undocumented** web endpoints. They can break any time.
- Anthropic's consumer terms prohibit automated access. This tool is read-only and uses no
  inference quota, but that is not an exemption; the risk is on your accounts. The official
  export (Settings) is the zero-risk alternative.
- A `sessionKey` equals your login. **Never paste it into a chat.** It is only typed into the
  hidden prompt of `setup` (or the UI's password field), and only ever sent to `claude.ai`.
- Cloudflare in front of claude.ai may reject script requests (HTTP 403). Run `npm run setup -- check`
  first to find out.
- Search covers conversation **titles** only (no full-text yet).

## Install

```bash
git clone <this repo> && cd claude-web-history-mcp
npm install
```

## Add accounts

Do this once per account. In the Chrome profile logged in to it: DevTools (F12) → Application →
Cookies → `https://claude.ai` → copy the value of `sessionKey`.

```bash
npm run setup -- add work
npm run setup -- add personal
npm run setup -- list
npm run setup -- check
```

Keys are stored in the OS keychain on macOS/Windows. On Linux the native keyring did not persist
across processes in testing, so keys go to `~/.claude-web-history/accounts.json` (mode 600).
Override with `CLAUDE_WEB_STORE=keychain|file`, and the folder with `CLAUDE_WEB_HISTORY_DIR`.

Keys expire (e.g. after you log out of that account). Re-run `npm run setup -- add <name>`.

## Register with Claude Code

```bash
npm run setup -- register    # prints the exact `claude mcp add ...` command
```

## Web UI (local)

```bash
npm run ui          # or: node src/ui/server.js --port 4777
```

Prints a local URL like `http://127.0.0.1:4777/<random-token>/`. Open it in any browser on the same
machine. Search titles across all accounts at once, filter by account (a dot shows whether each key
still works), open a chat to read it in full, copy it as markdown or download it.

**Manage accounts** (button, top left): add an account, replace an expired key (re-add the same name),
or remove one. The key is typed into a password field and sent once to the local server, which stores
it and checks it against claude.ai. It is never sent back to the page. The account is saved even if
the check fails, and the result tells you which. The `env` account (from `CLAUDE_SESSION_KEY`) is read-only.

It binds to `127.0.0.1` only, the URL contains a per-launch random token, and requests with a
non-loopback `Host` header are rejected. Adding or removing an account also requires a same-origin
`Origin` header and a JSON body of at most 8 KB.

## Tools

| Tool | What it does |
|---|---|
| `list_web_accounts` | Configured account names |
| `list_web_conversations` | Recent chats, one account or merged from all |
| `search_web_conversations` | Title search across all accounts |
| `read_web_conversation` | Full transcript as markdown; finds the owning account itself; `offset` pages long ones |
| `save_web_conversation` | Write a transcript to a file |
| `debug_connection` | Per-account key check, optional raw path |

One expired account never hides results from the others; the failure is listed alongside.

## Layout

```
src/core/history.js      list · search · read · health · raw   (the one module adapters call)
src/core/claude-web.js   HTTP client for claude.ai's endpoints, markdown rendering
src/core/credentials.js  account names + key storage
src/mcp/server.js        MCP adapter (stdio)
src/ui/server.js, index.html   web adapter + page
src/cli/setup.js         terminal adapter (add / list / check / remove / register)
```

## Test

```bash
npm test    # offline, fake claude.ai, no real keys
```

TDQS

A4/5.0

Scored across 6 tools

Disambiguation4/5

The core verbs (list, search, read, save) map cleanly onto distinct operations, and list_web_accounts vs list_web_conversations are differentiated by object. The only mild overlap is read_web_conversation vs save_web_conversation, since save also fetches the transcript; the description clarifies the difference (disk write/persistence), so misselection risk is low.

Naming Consistency5/5

All tools use a predictable snake_case verb_noun pattern (list_/search_/read_/save_ + web_conversation(s), list_web_accounts). The only deviation is debug_connection lacking the 'web_' infix, which is appropriate since it is diagnostics rather than conversation access.

Tool Count5/5

Six tools is well-scoped for a read/export service over claude.ai conversations. Each tool corresponds to a distinct step (discover accounts, list, search, read, persist, troubleshoot) with no filler.

Completeness4/5

Lifecycle for reading and exporting conversations is covered, including persistence and diagnostics. Minor gaps: search only covers titles (no message-text search), and account management (adding/removing accounts) requires npm setup or the web UI rather than a tool, leaving agents a small dead end.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues