cdt-smart-snapshot

cdt-smart-snapshot

A token-efficient MCP server for Chrome DevTools Protocol that provides smart snapshots, diffing, and screenshot-to-disk tools, reducing token usage dramatically compared to official snapshots.

Category
访问服务器

README

cdt-smart-snapshot

Token-efficient snapshot MCP server for Chrome DevTools Protocol.

Use alongside official chrome-devtools-mcp: operations (click / fill / navigate) stay on the official server; page perception (smart_snapshot / snapshot_diff / screenshot_to_disk) goes through this server.

Install

npm install
npm run build

Requires Node.js ^20.19 || ^22.12 || >=23 and a running Chromium-based browser with remote debugging (Edge/Chrome on port 9222, or 9223 via portproxy).

MCP configuration

Claude Code / Claude Desktop

{
  "mcpServers": {
    "cdt-smart-snapshot": {
      "command": "node",
      "args": ["/absolute/path/to/cdt-smart-snapshot/build/src/index.js"],
      "env": {
        "CDT_BROWSER_URL": "http://127.0.0.1:9222",
        "CDT_SNAPSHOT_DIR": "/tmp/cdt-snapshots"
      }
    }
  }
}

Hermes

Point Hermes at the same node …/build/src/index.js entry with the env vars above. Prefer CDT_WS_ENDPOINT when you already have a WebSocket debugger URL.

Tools

Tool Purpose
smart_snapshot Visible + interactive semantic tree with depth limit and dedupe
snapshot_diff Added / removed / changed nodes since the last snapshot
screenshot_to_disk Write screenshot to disk; returns a file path (no base64)

Environment

Variable Default Meaning
CDT_WS_ENDPOINT (unset) Prefer WebSocket CDP endpoint when set
CDT_BROWSER_URL http://127.0.0.1:9222 HTTP CDP URL for puppeteer.connect
CDT_SNAPSHOT_DIR $TMPDIR/cdt-snapshots Screenshot output directory
CDT_MAX_DEPTH 8 Default maxDepth

Benchmark

Measured 2026-08-04 on Edge 151 (Windows) via WSL2 + portproxy 9223. 15 diverse real sites × 3 rounds, official take_snapshot-equivalent (full AX tree, official format) vs. smart_snapshot pipeline. Network idle + retry loading; reduction is stable across rounds (max spread ≤ 2.1pp for 14/15 sites).

Per-site reduction (avg of valid rounds)

Site Type Official chars Smart chars Reduction
CNN news portal ~35K ~1.2K 96.5%
Amazon e-commerce ~37K ~2K 94.6%
BBC News news portal ~26K ~2.2K 91.3%
Reddit social ~31K ~3.4K 90.2%
163.com CN portal ~31K ~4.7K 84.8%
JD.com CN e-commerce ~10K ~2.4K 76.9%
Stack Overflow Q&A ~24K ~7K 70.6%
Gmail logged-in mail ~73K ~23K 68.9%
YouTube video ~2.6K ~1.4K 47.6%
Bilibili video ~5.6K ~3.6K 35.8%
Wikipedia long doc ~578K ~467K 19.3%
GitHub dev platform ~3.3K ~2.9K 11.2%
Baidu search ~2K ~1.8K 10.4%
Zhihu CN Q&A ~2.7K ~2.4K 9.4%
Google search ~913 ~855 6.3%

snapshot_diff (incremental, Gmail)

Step Output
First call full tree (~23K chars)
No-op step 1 line, 32 chars
Change step 8 lines, ~420 chars

Reading the numbers

  • High reduction (68–97%): portals / e-commerce / news / social — the page types agents operate on most. Hidden/ads/container nodes are dropped.
  • Medium (19–48%): video / long-doc — nav chains collapsed; body text kept.
  • Low (6–11%): search / Q&A / docs — official interestingOnly already trimmed most junk; body text is intentionally retained for the agent to read. This is a token-vs-information tradeoff, not a defect. For extreme savings on content pages, use evaluate to read specific sections.

Combined with snapshot_diff, a 30-step agent session on an interactive page consumes roughly 15–20% of the tokens of repeated full take_snapshot calls.

Reproduce: node bench/multi-site-3x.mjs (requires Edge debugging mode on 9222

  • portproxy 9223, set CDT_BROWSER_URL=http://<windows-host-ip>:9223).

Development

npm run test
npm run typecheck
npm run check-format

License

Apache-2.0

推荐服务器

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

官方
精选