Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ module.exports = {
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-explicit-any': 'warn',
},
ignorePatterns: ['dist', 'node_modules', '*.config.js', '*.config.ts'],
ignorePatterns: ['dist', 'node_modules', '*.config.js', '*.config.ts', 'mcp-server'],
};
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ I see the same.
- **CLAUDE.md への直書き** *(v0.2.0+)*:プロジェクトの `CLAUDE.md` を一度ピックすれば、以降のキャプチャは File System Access API 経由で自動 append。コピペ不要
- **マルチプロジェクト振り分け** *(v0.3.0+)*:URL パターン(glob)で複数の CLAUDE.md を使い分け。例:`github.com/anthropic/*` → anthropic 用、`zenn.dev/*` → 個人メモ、無マッチは default ルート
- **claude.ai 会話のキャプチャ** *(v0.4.0+)*:claude.ai でブレストした会話をワンクリックで CLAUDE.md に流し込み。share リンクの 403 問題、手コピペの労力を解消。内部 API を叩いて thinking blocks・tool_use・branch 構造まで保持
- **アーティファクト抽出 & 範囲選択** *(v0.5.0+)*:claude.ai キャプチャで「**アーティファクトだけ**」(Claude が書いたコード/ドキュメントを整形済みコードブロックで抽出、会話は捨てる)や「**直近 N 件のみ**」を選択可能。長い設計会話から必要な部分だけを取り込めます。アーティファクトは同一 ID の更新を最新版に集約。claude.ai のチャットを開いているときは**ポップアップから直接トグル**できます
- **同一会話は上書き更新(siloを作らない)** *(v0.5.0+)*:MCP ストアモードで同じ claude.ai 会話を再キャプチャすると、**新しいスナップショットを増やさず既存ファイルを上書き**します。会話タイトルが変わっても安定 ID で追跡するので、ストアは常に single source of truth に保たれます(古いアーティファクトファイルも掃除)
- **MCP 経由でオンデマンド参照** *(v0.5.0+)*:キャプチャを `CLAUDE.md` に追記する代わりに、専用ディレクトリへ 1 件 1 ファイルで保存し、付属の [MCP サーバ](./mcp-server) が Claude Code に**必要なときだけ**渡します。Anthropic 公式の「`CLAUDE.md` は小さく保て(肥大化すると指示が無視される)」ガイドと整合し、コンテキストを汚しません。`list_contexts` / `search_contexts` / `get_context` で検索・取得できます。→ [セットアップ](./mcp-server/README.md)
- **キャプチャバッファ**:複数ページをまとめて溜めて、後から一括エクスポート
- **キーボードショートカット**:
- `Ctrl+Shift+L`(macOS: `Cmd+Shift+L`):ページ全体
Expand Down Expand Up @@ -257,6 +260,9 @@ In short: a clipper purpose-built for AI agent context files. If you want a gene
- **Direct CLAUDE.md write** *(v0.2.0+)* — Link a `CLAUDE.md` once via the File System Access API; subsequent captures append directly, no copy/paste
- **Multi-project routing** *(v0.3.0+)* — Link multiple `CLAUDE.md` files with URL glob patterns. Captures from `github.com/anthropic/*` go to one file, `zenn.dev/*` to another, unmatched URLs to a default route
- **claude.ai conversation capture** *(v0.4.0+)* — Capture your claude.ai brainstorm conversation in one click. Bypasses the 403-on-share-link issue and the manual copy-paste loop. Hits claude.ai's internal API to preserve thinking blocks, tool_use entries, and branch structure that DOM scraping would miss
- **Artifact extraction & range selection** *(v0.5.0+)* — For claude.ai captures, choose **artifacts only** (extract just the code/documents Claude wrote as clean fenced code blocks, dropping the conversation) or **keep the last N messages** (trim a long planning thread to what matters). Artifacts are deduped by id so an updated artifact is captured at its final version, not every intermediate edit. When you're on a claude.ai chat, these are **toggleable right from the popup**
- **Same conversation updates in place (no silos)** *(v0.5.0+)* — In MCP-store mode, re-capturing the same claude.ai conversation **overwrites the existing file instead of piling up new snapshots**. It's tracked by a stable id, so even if the conversation's title changes the store stays a single source of truth (stale artifact files are cleaned up too)
- **On-demand access via MCP** *(v0.5.0+)* — Instead of appending to `CLAUDE.md`, save each capture as a standalone file in a directory, and let the bundled [MCP server](./mcp-server) hand them to Claude Code **only when it asks**. This aligns with Anthropic's own guidance to keep `CLAUDE.md` small (bloated context files make Claude ignore your instructions) — your research stays available without polluting context. Searchable via `list_contexts` / `search_contexts` / `get_context`. → [Setup](./mcp-server/README.md)
- **Buffer mode** — Stack multiple captures and export all at once
- **Keyboard shortcuts**:
- `Ctrl+Shift+L` (Cmd+Shift+L on macOS) — capture page
Expand Down
35 changes: 35 additions & 0 deletions docs/issue-13843-comment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Draft comment for anthropics/claude-code#13843

> "Share conversation context from Claude.ai to Claude Code"
> https://github.com/anthropics/claude-code/issues/13843

---

For anyone who wants this **today** without waiting on a first-party fix, I built an open-source pair of tools that bridges it — and deliberately avoids the native-messaging-host setup that trips up most attempts at this.

**How it works:**
1. A Chrome extension captures your claude.ai conversation — preserving thinking blocks, `tool_use` steps, and branch structure (it reads claude.ai's conversation API rather than scraping the rendered DOM, so artifacts and code survive).
2. It saves each conversation as a Markdown file in a directory you pick (via the File System Access API — **no native messaging host**, which is where similar tools usually break).
3. A small MCP server exposes those files to Claude Code on demand: `list_contexts`, `search_contexts`, `get_context`.

**Why on-demand instead of dumping into `CLAUDE.md`:** Anthropic's own [memory guidance](https://code.claude.com/docs/en/memory) is to keep `CLAUDE.md` small — bloated context files make Claude ignore instructions. So the agent pulls in a captured conversation only when it needs it, instead of permanently inflating context. (No silos either — it's a single directory you can inspect, search, or delete from.)

Setup is `npx` + one line:

```bash
claude mcp add ccc-contexts -- npx -y claude-code-context-capturer-mcp ./.ccc-contexts
```

Repo: https://github.com/OceansCreative/claude-code-context-capturer
It also captures general web pages (GitHub issues, docs, Stack Overflow, etc.) the same way, if that's useful for research → code workflows.

Feedback very welcome — especially on whether on-demand MCP access fits how you actually move from planning in claude.ai to building in Claude Code.

---

## Posting notes (for me, not part of the comment)

- **Don't post until** the MCP server is actually published to npm (the `npx` line must work for a stranger) OR reword to point at the manual install. Posting a broken install command is exactly what sank the competitor.
- Tone: helpful, not spammy. Lead with "here's a thing that works today," not "check out my project."
- The thread has a vocal "no export/import, I want live read access / single source of truth" camp (powerobject, +10). The "single directory you can inspect/search/delete, agent reads on demand" framing is aimed at them — keep it.
- Consider also replying to geovaniprodata, who hit "native messaging host not found" with the competitor — explicitly note this design has no native host.
179 changes: 179 additions & 0 deletions mcp-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
# Claude Code Context Capturer — MCP server

Expose the web pages and **claude.ai conversations** you capture with the
[Claude Code Context Capturer](https://github.com/OceansCreative/claude-code-context-capturer)
browser extension to **Claude Code — on demand**, over MCP.

## Why on-demand instead of CLAUDE.md?

Anthropic's own guidance is to keep `CLAUDE.md` small (target < 200 lines) —
[bloated context files make Claude ignore your instructions](https://code.claude.com/docs/en/memory).
Dumping every captured article and chat into `CLAUDE.md` works against that.

This MCP server takes the opposite approach: your captures live as individual
Markdown files in a directory, and Claude Code pulls in **only the ones it needs,
only when it needs them** — via `list_contexts`, `search_contexts`, and
`get_context`. Nothing is loaded into context until the agent asks. No silos,
no bloat.

## How it fits together

```
┌─────────────┐ capture (FSA write) ┌──────────────────┐ read ┌─────────────┐
│ browser │ ───────────────────────▶ │ contexts dir/ │ ◀──────── │ this MCP │
│ extension │ <slug>.md per capture │ *.md files │ │ server │
└─────────────┘ └──────────────────┘ └──────┬──────┘
│ stdio (MCP)
┌──────▼──────┐
│ Claude Code │
└─────────────┘
```

**No native-messaging host.** The extension writes plain files via the File
System Access API; this server just reads that directory. That's the single
biggest reliability difference from similar bridges — there's nothing fragile to
register.

## Install

Requires Node.js ≥ 18. No global install needed — `npx` fetches it on demand.

```bash
# From inside your project, register the server pointed at your captures dir:
claude mcp add ccc-contexts \
-- npx -y claude-code-context-capturer-mcp ./.ccc-contexts
```

Or add it to your MCP config manually:

```json
{
"mcpServers": {
"ccc-contexts": {
"command": "npx",
"args": ["-y", "claude-code-context-capturer-mcp", "./.ccc-contexts"]
}
}
}
```

The captures directory is resolved in this order:

1. the first CLI argument (`./.ccc-contexts` above)
2. the `CCC_CONTEXTS_DIR` environment variable
3. `<cwd>/.ccc-contexts`

`~` is expanded to your home directory.

## Connect the extension

1. Open the extension's options page.
2. Under **MCP contexts directory**, click **Link directory** and pick the same
directory you pointed the server at (e.g. `.ccc-contexts` in your project).
3. Set **Default action** to **“Save to MCP contexts directory.”**

Now every page or claude.ai conversation you capture lands as a `.md` file the
server can serve to Claude Code.

## Tools

| Tool | Description |
|------|-------------|
| `list_contexts` | List captures (metadata only). Filter by `parser`, `tags` (AND/OR via `tagMatch`), `since`/`until` date range; `limit`. |
| `search_contexts` | Ranked keyword search across title, URL, tags, and body, with snippets. Accepts the same `parser`/`tags`/`since`/`until` filters to scope the search first. |
| `stats_contexts` | Aggregate overview: total count + size, breakdown by source, top tags, captured-at date range. |
| `get_context` | Fetch one capture by `slug` (fuzzy matching). `format:"code"` returns just the raw code (fences + frontmatter stripped) — ideal for single artifacts. |
| `delete_context` | Remove a capture by `slug` once it's been incorporated. |

### Artifacts as individual files

When you capture a claude.ai conversation in **mcp-store** mode, each code or
document **artifact** Claude wrote is also saved as its own file (`parser:
claude-ai-artifact`, tagged `artifact` + `lang:<x>`). So you can:

```
list_contexts({ tags: ["artifact"], parser: "claude-ai-artifact" })
get_context({ slug: "...--auth-middleware", format: "code" }) // → raw code, ready to write to a file
```

That's the "one code = one file" path: ask Claude Code to pull a specific
artifact and it gets exactly that file's contents, with no conversation or
Markdown wrapping.

### Filtering

`list_contexts` and `search_contexts` share these optional filters:

- `parser` — exact source, e.g. `"claude-ai"`, `"github"`, `"generic"`.
- `tags` — case-insensitive substring match. `["lang:ts"]` matches the
`lang:ts` tag; `["lang:"]` matches any language tag. Multiple tags are ANDed
by default; pass `tagMatch: "any"` to OR them.
- `since` / `until` — ISO date (`"2026-05-01"`) or datetime. A bare `until` date
covers the whole day. An unparseable bound is ignored with a warning rather
than failing the call.

Example: *"search my claude.ai TypeScript artifacts from this month for the auth
helper"* →
`search_contexts({ query: "auth helper", parser: "claude-ai", tags: ["lang:ts"], since: "2026-06-01" })`.

### Example

In Claude Code:

> *“Search my captured contexts for the OAuth migration plan and use it.”*

Claude calls `search_contexts({ query: "oauth migration" })`, finds the
`claude-ai` conversation you captured, then `get_context` to read the full plan —
without you pasting anything.

## File format

The server reads the Markdown + YAML frontmatter the extension emits:

```markdown
---
url: https://claude.ai/chat/abc-123
title: "Auth refactor plan"
captured_at: 2026-05-31T14:00:00.000Z
parser: claude-ai
tags: ["model:claude-opus-4"]
---

# Auth refactor plan
...
```

Files without frontmatter are still served (the whole file becomes the body, and
the title falls back to the first heading or the filename).

## Troubleshooting

**"I captured something but Claude Code can't see it."** This almost always
means the server and the extension disagree on *which directory* to use. The
server logs the exact absolute path it resolved on startup (to stderr):

```
[ccc-mcp] Watching 3 capture(s) in: /Users/you/project/.ccc-contexts
```

If you instead see `does not exist`, `is a file, not a directory`, or a count of
`0` when you expect captures, compare that absolute path against the directory
you linked in the extension's options page — they must resolve to the **same
folder**. The most common cause is a relative path (`./.ccc-contexts`) resolving
against an unexpected working directory; use an absolute path in the MCP config
if in doubt. The `list_contexts` tool surfaces the same diagnostic to the agent.

## Develop

```bash
npm install
npm run build # tsc -> dist/, makes bin executable
npm test # vitest
npm start # run against ./.ccc-contexts (or $CCC_CONTEXTS_DIR)
```

Logs go to **stderr** — stdout is the JSON-RPC channel and must stay clean.

## License

MIT
Loading
Loading