claude-annotate

claude-annotate

Enables visual annotation on web pages for Claude Code, allowing element selection, comment addition, screenshot capture, and structured UI feedback for code fixes via an MCP server.

Category
访问服务器

README

<p> <img src="banner.png" alt="Claude Annotate" width="1100"> </p>

Claude Annotate

Visual annotation for AI. Click elements, capture screenshots, fix code.

License: MIT Browser

/annotate

Figma-like annotation experience with floating inline note cards. DevTools-like element picker in vanilla JS.

Click elements, add comments, submit. The agent gets selectors, box model, accessibility, screenshots — everything it needs to fix your UI.

https://github.com/user-attachments/assets/115b10ca-86e8-4b1c-b8a4-492c68759c58

Fork note — Claude Code support. This fork adds an MCP server in server/ that brings the same annotation workflow to Claude Code. The Chrome extension and native host are reused unchanged — only the agent layer differs. Upstream: nicobailon/claude-annotate.

Claude Code (MCP)

cd server
npm install && npm run build
# Load chrome-extension/ in Chrome (Developer Mode), note the extension ID, then:
( cd ../chrome-extension/native && ./install.sh <extension-id> )   # restart browser
claude mcp add claude-annotate -- node "$PWD/dist/index.js"            # restart Claude Code

Then ask Claude to annotate a page — it calls the annotate tool, you click/comment in the browser, and Claude receives selectors, box model, accessibility, your comments, and screenshots (returned both inline and as temp files). Default wait is 600s. Full setup, config, and tests: server/README.md.

Quick Start (Pi)

1. Install Pi Extension

pi install npm:claude-annotate

Restart pi to load the extension.

2. Load Supported Browser Extension

  1. Open the extensions page in Google Chrome, Google Chrome for Testing, or Chromium, and enable Developer mode
  2. Click Load unpacked → select the chrome-extension/ folder inside the installed package
  3. Click the Claude Annotate icon in the toolbar

3. Install Native Host

The popup shows your extension ID. Click Copy next to the install command, then run it from chrome-extension/native/ in the installed package:

./install.sh <extension-id>

This installs the native messaging manifest for Google Chrome, Google Chrome for Testing, and Chromium on macOS, plus the default/current config-home locations for those browsers on Linux. Fully quit and reopen that browser. The popup will show Connected when ready.

Usage

/annotate                  # Current browser tab
/annotate https://x.com    # Opens URL first
Action How
Select element Click on page
Cycle ancestors Alt/⌥+scroll while hovering
Multi-select Toggle "Multi" or Shift+click
Add comment Type in note card textarea
Toggle screenshot 📷 button in note card header
Reposition note Drag by header
Scroll to element Click selector in note card
Toggle note Click numbered badge
Expand/collapse all ▼/▲ buttons in toolbar
Toggle edit capture "Etch" toggle in toolbar
Toggle annotation UI ⌘/Ctrl+Shift+P
Close ESC

Features

Context Capture — Each element automatically gets box model breakdown (padding, border, margin), accessibility info (role, name, focusable, ARIA states), all HTML attributes, and key CSS styles (display, position, overflow, colors, typography). Enable Debug mode for computed styles (40+ properties), parent context, and CSS variables.

Inline Note Cards — Draggable floating cards with per-element comments, SVG connectors linking notes to elements, click-to-scroll, and per-element screenshot toggles.

Screenshots — Individual crops per element (20px padding) or full-page mode with numbered badges drawn on the screenshot to identify elements. Toggle per element with the 📷 button.

Edit Capture — Toggle "Etch" in the toolbar to record DevTools edits. Change inline styles, modify CSS rules, add/remove classes, edit text — everything is tracked via MutationObserver. A pulsing red dot and badge counter show recording status. At submit, the extension takes before/after screenshots by briefly undoing visual changes, and produces structured property-level diffs the agent can map to source code. Works alongside element selection or standalone.

Restricted Tabs — If the current tab is chrome:// or other restricted URLs, providing a URL opens a new tab automatically. Popup button and keyboard shortcut auto-inject the content script on fresh tabs.

Output

## Page Annotation: https://example.com
**Viewport:** 1440×900

**Context:** Fix the styling issues

### Selected Elements (2)

1. **button**
   - Selector: `#submit-btn`
   - ID: `submit-btn`
   - Classes: `btn, btn-primary`
   - Text: "Submit"
   - **Box Model:** 120×40 (content: 96×24, padding: 8 16, border: 1, margin: 0 8)
   - **Attributes:** type="submit", data-testid="submit"
   - **Styles:** display: flex, backgroundColor: rgb(59, 130, 246)
   - **Accessibility:** role=button, name="Submit", focusable=true, disabled=false
   - **Comment:** Make this blue with rounded corners

2. **div**
   - Selector: `.error-message`
   - Classes: `error-message, hidden`
   - Text: "Please fill required fields"
   - **Box Model:** 300×20 (content: 300×20, padding: 0, border: 0, margin: 0 0 8)
   - **Accessibility:** focusable=false, disabled=false
   - **Comment:** This should appear in red, not hidden

### Screenshots

- Element 1: /var/folders/.../claude-annotate-...-el1.png
- Element 2: /var/folders/.../claude-annotate-...-el2.png

## Edit Capture (2 changes, 35s)

### Inline Style Changes

**`#submit-btn`**
- `background-color`: `rgb(59, 130, 246)``rgb(37, 99, 235)`
- `border-radius`: added `8px`

### CSS Rule Changes

**`.btn-primary:hover`** (styles.css)
- `background-color`: `rgb(37, 99, 235)``rgb(29, 78, 216)`

### Before/After Screenshots

- Before: /var/folders/.../claude-annotate-...-before.png
- After: /var/folders/.../claude-annotate-...-after.png

Debug mode adds computed styles, parent context, and CSS variables per element. Edit capture appears when the Etch toggle is enabled and changes are detected.

Architecture

Pi Extension (index.ts)
    ↕ Unix Socket (/tmp/claude-annotate.sock)
Native Host (host.cjs)
    ↕ Browser Native Messaging
Browser Extension (background.js → content.js)
File Purpose
index.ts Pi extension — /annotate command + tool
types.ts TypeScript interfaces
chrome-extension/content.js Element picker UI (vanilla JS)
chrome-extension/background.js Native messaging, screenshots, tab routing
chrome-extension/native/host.cjs Socket ↔ native messaging bridge
chrome-extension/popup.html Connection status + setup

Auth token generated per-run at /tmp/claude-annotate.token. Socket and token files use 0600 permissions.

Claude Code variant: the server/ MCP server replaces the Pi extension at the top of this stack — it speaks the same Unix-socket protocol to the unchanged native host, so the bottom two layers are identical. See server/README.md.

Development

No build step. Edit content.js or background.js directly, reload at chrome://extensions. Pi extension (TypeScript) loads via jiti — restart pi after changes.

tail -f /tmp/claude-annotate-host.log                    # Native host logs
# chrome://extensions → Claude Annotate → service worker  # Background logs
# DevTools on target page                              # Content script logs

Troubleshooting

Issue Fix
UI doesn't appear Refresh page, check service worker console
"restricted URL" error Provide a URL: /annotate https://example.com
Native host not connecting Click extension icon → check status, re-run install, fully restart the supported browser
"Extension ID mismatch" Copy install command from popup, re-run
Socket errors ls -la /tmp/claude-annotate.sock

Verify native host:

  • macOS Google Chrome: cat ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.claude.annotate.json
  • macOS Google Chrome for Testing: cat ~/Library/Application\ Support/Google/ChromeForTesting/NativeMessagingHosts/com.claude.annotate.json
  • macOS Chromium: cat ~/Library/Application\ Support/Chromium/NativeMessagingHosts/com.claude.annotate.json
  • Linux Google Chrome (default path): cat ~/.config/google-chrome/NativeMessagingHosts/com.claude.annotate.json
  • Linux Google Chrome for Testing (default path): cat ~/.config/google-chrome-for-testing/NativeMessagingHosts/com.claude.annotate.json
  • Linux Chromium (default path): cat ~/.config/chromium/NativeMessagingHosts/com.claude.annotate.json
  • Linux with custom config home: echo "${CHROME_CONFIG_HOME:-${XDG_CONFIG_HOME:-$HOME/.config}}"

If your Linux browser uses a different XDG config root, export CHROME_CONFIG_HOME or XDG_CONFIG_HOME before running ./install.sh <extension-id>. Custom --user-data-dir layouts are not handled by this installer.

License

MIT

推荐服务器

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

官方
精选