MCPcopy Index your code
hub / github.com/JodusNodus/opencode-chrome-annotation

github.com/JodusNodus/opencode-chrome-annotation @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
97 symbols 231 edges 16 files 0 documented · 0% updated 2mo ago★ 732 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

OpenCode Chrome Annotation

version license

Annotate any page in Chrome and send the screenshot, selected element metadata, and your instruction directly into OpenCode.

https://github.com/user-attachments/assets/bdee8a15-6720-4e57-b28d-ee6440722b71

Install

Add the plugin to your OpenCode config:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-chrome-annotation@latest"]
}

Install the Chrome extension from the Chrome Web Store:

https://chromewebstore.google.com/detail/abeihanpaeioklkhioiigklonbomhjfd

How It Works

  1. Start OpenCode in your project.
  2. Click the extension button in Chrome.
  3. Connect the current tab to your OpenCode session from the in-page picker.
  4. Click Annotate in the in-page pill.
  5. Select an element, write your instruction, and submit.

What Gets Sent

  • Your written instruction.
  • The current page URL and title.
  • Selected element metadata such as selector, tag, text, role, aria label, and bounds.
  • A screenshot saved locally by the plugin and referenced in the OpenCode prompt.

Troubleshooting

The plugin runs a local HTTP server bound to 127.0.0.1 on ports 39240-39260. The extension discovers the active OpenCode plugin instance over localhost.

  • The extension can't start a new session, you need to be in an active OpenCode session to connect.
  • If the extension can't find any session, ask your agent to run chrome_status that should give a detailed report.
  • Make sure OpenCode and your Chromium browser exist in the same localhost network (not in seperate containers).

Development

Plugin

The OpenCode plugin source lives in src/plugin.ts. The published package entrypoint is generated at dist/plugin.js.

Install dependencies:

bun install

Build the plugin:

bun run build

Extension

The Chrome extension source lives in extension-src/. The loadable extension output is generated into extension/ and is not tracked by git.

bun run build:extension

Then load the generated extension/ directory from chrome://extensions.

To create the Chrome Web Store upload zip:

bun run build:zip

Extension points exported contracts — how you extend this code

HTMLElement (Interface)
(no doc)
extension-src/globals.d.ts

Core symbols most depended-on inside this repo

logExtension
called by 14
extension-src/logger.ts
json
called by 8
src/plugin.ts
warnExtension
called by 7
extension-src/logger.ts
setLastAnnotationStatus
called by 5
src/plugin.ts
logDebug
called by 4
src/plugin.ts
isExplicitFalse
called by 4
src/plugin.ts
unwrapClientResult
called by 4
src/plugin.ts
postJson
called by 4
extension-src/server-api.ts

Shape

Function 96
Interface 1

Languages

TypeScript100%

Modules by API surface

src/plugin.ts25 symbols
extension-src/annotation-picker.ts17 symbols
extension-src/session-picker.ts12 symbols
extension-src/background.ts11 symbols
extension-src/claims-store.ts10 symbols
extension-src/server-api.ts6 symbols
extension-src/connection-monitor.ts5 symbols
extension-src/ui-overlays.ts4 symbols
extension-src/logger.ts3 symbols
extension-src/injected/dom.ts2 symbols
extension-src/tabs.ts1 symbols
extension-src/globals.d.ts1 symbols

For agents

$ claude mcp add opencode-chrome-annotation \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact