Agate Browser MCP
by sanirudh17
README.md
<div align="center">
<img src="assets/agate-icon-256.png" width="112" alt="Agate icon" />
# Agate
**A local-first Chromium browser agent, browser-automation MCP, and Windows computer-use skill — powered by your installed coding agents.**
Use the coding agents already on your machine (OpenCode, Antigravity, Claude Code, Codex, Pi, Grok) to read pages, summarize YouTube videos and open PDFs, fill forms, automate browser tabs, or drive Windows desktop apps — with zero external npm dependencies and no extra API subscriptions.
[](LICENSE)
[](#platform-support)
[](#platform-support)
[](#manual-setup)
</div>
---
## Overview
Agate turns the coding agents you already pay for and run locally into a fast, private browser and desktop automation toolkit. Everything runs on your machine over localhost (`127.0.0.1`) with **zero runtime npm dependencies** — just Node.js 22+.
It ships as three focused pillars that work together or independently:
1. **Agate Browser Extension** — A native Chromium side-panel agent with live mid-run steering, dynamic per-model reasoning effort controls, YouTube transcript insights, open-PDF Q&A with Markdown table rendering, and file uploads.
2. **Agate Browser MCP** (`agate mcp`) — A **browser-automation MCP server** exposing 18 `browser_*` tools (strictly browser-only, zero OS desktop tools) so any MCP-capable coding agent can inspect, read, and automate your real Chromium browser.
3. **Agate Computer-Use Skill** (`agate os` + `skill/SKILL.md`) — A **Windows-tuned** desktop automation CLI and agent skill built on Win32 UI Automation for driving native Windows applications cleanly without stealing focus unnecessarily.
> **Fastest way to get started:** Paste the [coding-agent setup prompt](#set-up-with-your-coding-agent) into Claude Code, OpenCode, Codex, Antigravity, or Cursor — or follow the [manual setup steps](#manual-setup) below.
---
## Contents
- [Platform Support](#platform-support)
- [Set Up with Your Coding Agent](#set-up-with-your-coding-agent)
- [Manual Setup](#manual-setup)
- [Features](#features)
- [Supported Coding Agents](#supported-coding-agents)
- [CLI & MCP Reference](#cli--mcp-reference)
- [Project Structure](#project-structure)
- [Privacy & Security](#privacy--security)
- [Development & Testing](#development--testing)
- [License](#license)
---
## Platform Support
| Component | Platforms | What It Covers | Entry Point |
| --- | --- | --- | --- |
| **Agate Browser Extension** | **Windows, macOS, Linux** (Chrome, Edge, Brave, Arc, Vivaldi) | Side-panel chat & page automation, YouTube insights, open-PDF Q&A, file uploads, live steering | Load unpacked `extension/` + `agate bridge` |
| **Agate Browser MCP** | **Windows, macOS, Linux** | Browser-automation MCP server (18 `browser_*` tools, zero desktop tools). Uses the extension relay first (Chrome default, optional `browser` arg) with automatic CDP fallback | `agate mcp` |
| **Agate Computer-Use Skill** | **Windows 10 / 11 only** | Specifically tuned for Windows via native Win32 UI Automation (`CacheRequest` batched snapshots, semantic `@dN` refs, batched clicks, `--snap`, `--query`, `--close`) | `agate os ... --allow-os-input` + `skill/SKILL.md` |
---
## Set Up with Your Coding Agent
Copy and paste this prompt into your coding agent (**Claude Code**, **OpenCode**, **Codex**, **Antigravity**, **Cursor**, etc.) to install and configure Agate automatically:
```text
Set up Agate from https://github.com/sanirudh17/Agate on this machine:
1. Check that Node.js 22+ is installed.
2. Clone https://github.com/sanirudh17/Agate.git into a sensible local directory (or use the current clone if already inside it) and run `npm link` so the `agate` CLI is available on PATH (Agate has zero npm dependencies, so no `npm install` is needed).
3. Register the Agate Browser MCP server in my coding agent's MCP config using command `agate` with args `["mcp"]` (or fallback to `node <repo-path>/src/cli.js mcp` if global PATH linking isn't available).
4. If this machine is running Windows, also install the Windows Computer-Use skill by copying `skill/SKILL.md` into my agent's skills directory (for example `~/.claude/skills/agate/SKILL.md` and/or `~/.agents/skills/agate/SKILL.md`). Skip step 4 on macOS/Linux since the computer-use skill is Windows-only.
5. Run `npm test` in the Agate repo to verify everything passes.
6. Give me the exact local path to the `extension/` folder so I can load it unpacked in my Chromium browser (`chrome://extensions` or `edge://extensions` -> Developer mode -> Load unpacked), and tell me how to start `agate bridge`.
```
---
## Manual Setup
### Prerequisites
- **[Node.js](https://nodejs.org/)** 22 or newer (zero external packages to install)
- Any **Chromium browser** (Chrome, Edge, Brave, Arc, Vivaldi) for the extension and Browser MCP
- **Windows 10 / 11** *(only if you want to use the Windows Computer-Use Skill)*
### 1. Clone and link the CLI
```bash
git clone https://github.com/sanirudh17/Agate.git
cd Agate
npm link
```
*(No `npm install` needed — Agate has zero runtime dependencies. If you prefer not to link globally, replace `agate` with `node src/cli.js` in the commands below.)*
### 2. Start the local bridge
```bash
agate bridge
```
On Windows, you can also double-click `start-bridge.cmd` in the repository root.
The bridge listens strictly on `http://127.0.0.1:49200` and auto-detects installed local agents (`opencode`, `agy`, `claude`, `codex`, `pi`, `grok`).
### 3. Load the Browser Extension (Windows, macOS, Linux)
1. Open `chrome://extensions` (or `edge://extensions`, `brave://extensions`).
2. Enable **Developer mode**.
3. Click **Load unpacked** and select the `extension/` folder inside your `Agate` clone.
4. Click the **Agate** toolbar icon (or press `Alt+Shift+A`) to open the side panel.
### 4. Connect Agate Browser MCP to your coding agent (Windows, macOS, Linux)
Add Agate to your MCP client configuration (Claude Code, OpenCode, Codex, Antigravity, Cursor, Windsurf, etc.):
```json
{
"mcpServers": {
"agate": {
"command": "agate",
"args": ["mcp"]
}
}
}
```
Or using an explicit path without `npm link`:
```json
{
"mcpServers": {
"agate": {
"command": "node",
"args": ["/absolute/path/to/Agate/src/cli.js", "mcp"]
}
}
}
```
For Claude Code CLI:
```bash
claude mcp add --scope user agate -- agate mcp
```
### 5. Install the Windows Computer-Use Skill *(Windows only)*
Copy `skill/SKILL.md` into your coding agent's skills directory:
```powershell
# Example for Claude Code / OpenCode / Antigravity
New-Item -ItemType Directory -Force "$HOME\.claude\skills\agate", "$HOME\.agents\skills\agate" | Out-Null
Copy-Item .\skill\SKILL.md "$HOME\.claude\skills\agate\SKILL.md"
Copy-Item .\skill\SKILL.md "$HOME\.agents\skills\agate\SKILL.md"
```
You can also print the skill instructions anytime with `agate skill`.
---
## Features
**Browser Extension (Cross-Platform)**
- **Auto-detected local agents & dynamic reasoning effort.** Queries live ACP `configOptions` via `POST /model/config` so the effort slider adapts automatically to each model — 2 stops (`None · High`) on 2-level models, 5 stops (`Low · Medium · High · XHigh · Max`) on 5-level models, or `Default` on fixed-reasoning models.
- **Live steering, queuing, and instant takeover.** Press `Enter` mid-run to steer the agent immediately, `Ctrl+Enter` to queue a follow-up prompt, or `Esc` / **Pause** / **Stop** inside the tab overlay pill to take control back instantly.
- **Fast deterministic reflexes & guards.** Zero-millisecond search and single-click reflexes, premature-done guard, and lazy-hydration input protection for modern SPAs (React, Vue, Wikipedia Vector 2022).
- **YouTube video insights (no API key).** Ask about an open YouTube tab or paste any YouTube URL from any tab to extract timestamped transcripts and chapter breakdowns automatically.
- **Open-PDF Q&A with Markdown tables.** Reads local `file:///` PDFs, public `https://` PDFs, and authenticated browser-session PDFs page-by-page (`[Page N]`), rendering structured tables cleanly in the side panel.
- **File & image attachments.** Attach `.md`, `.txt`, `.pdf`, `.docx`, `.csv`, or images into chat context and upload them directly to `<input type="file">` fields without triggering OS file pickers.
- **Obsidian & Paper themes.** Self-hosted Geist typography, smoked-amethyst takeover border, single GPU-composited cursor, and one-click prompt copy.
**Browser-Automation MCP Server (Cross-Platform)**
- **18 dedicated `browser_*` tools, zero desktop side effects.** Includes `browser_tabs`, `browser_open`, `browser_navigate`, `browser_snapshot`, `browser_read`, `browser_read_batch`, `browser_click`, `browser_type`, `browser_select`, `browser_upload`, `browser_press`, `browser_scroll`, `browser_wait`, `browser_batch`, `browser_screenshot`, `browser_dismiss_cookies`, `browser_switch_tab`, and `browser_close_tab`.
- **Real browser first, automatic CDP fallback.** Routes through your live browser via the Agate extension relay (Chrome default, optional `browser` parameter for Edge/Brave/Opera/Vivaldi) and falls back cleanly to direct Chrome DevTools Protocol when needed.
- **Parallel multi-tab reading & compact diffs.** `browser_read_batch` reads up to 8 tabs or URLs in parallel in one call; repeat snapshots emit compact incremental diffs wrapped in cryptographic prompt-injection fences.
- **Built-in YouTube & file-upload support.** `browser_read` automatically enriches YouTube pages with transcripts and chapters, and `browser_upload` attaches local files directly to hidden or visible file inputs.
**Windows Computer-Use Skill (Windows Only)**
- **Native Win32 UI Automation engine.** Persistent PowerShell + C# UIA worker using `CacheRequest` batched snapshots so dense Windows apps return semantic `@dN` refs in a single fast round-trip.
- **Minimal-turn 1-shot workflows.** Chain launch, snapshot, batched clicks, targeted control readback, and teardown in two commands:
```powershell
agate os launch calc --snap --session s1 --allow-os-input
agate os click d33 d32 d30 d26 d31 d35 d29 --query Display --close --session s1 --allow-os-input
```
- **Process-aware window targeting.** Matches windows by process and title without colliding with terminal tabs, recovers cleanly from `STALE_REF`, and supports virtualized list scraping (`os scroll-collect`), deterministic UI waits (`os wait`), clipboard-safe pasting (`os paste`), and window screenshots (`os screenshot`).
---
## Supported Coding Agents
Agate automatically detects local CLIs on your `PATH` and exposes them in the extension's provider picker:
| Agent | Detection / Protocol | Notes |
| --- | --- | --- |
| **OpenCode** | ACP (`opencode acp`) | Full model discovery + dynamic per-model reasoning effort |
| **Antigravity** | ACP (`agy`) | Full model discovery + session streaming |
| **Claude Code** | CLI / ACP (`claude`) | Uses your existing local Claude Code login |
| **Codex** | CLI / ACP (`codex`) | Uses your existing local Codex login |
| **Pi** | CLI (`pi`) | Lightweight local coding agent |
| **Grok** | CLI (`grok`) | Local Grok CLI integration |
---
## CLI & MCP Reference
```bash
# Local bridge & Browser MCP server (Windows, macOS, Linux)
agate bridge [--port 49200] [--model opencode/beam-free]
agate mcp [--bridge-url http://127.0.0.1:49200]
agate read-doc ./document.pdf
agate skill
# Live Extension Relay CLI (Windows, macOS, Linux)
agate ext tabs [--browser chrome]
agate ext open https://example.com
agate ext snap
agate ext read
# Windows Desktop Computer-Use CLI (Windows only; requires --allow-os-input)
agate os launch calc --snap --session s1 --allow-os-input
agate os snapshot --app "Notepad" --session s1 --allow-os-input
agate os click d12 --query "Result" --close --session s1 --allow-os-input
agate close --session s1
```
---
## Project Structure
```text
Agate/
├── assets/ # App icons
├── extension/ # Cross-platform Chromium MV3 side-panel extension
│ ├── manifest.json # Extension manifest (MV3)
│ ├── background.js # Service worker, bridge relay, PDF & YouTube Q&A routing
│ ├── content.js # DOM perception, SPA rebind, takeover overlay, file upload
│ ├── sidepanel.* # Side-panel UI, Markdown tables, dynamic effort slider
│ └── icons/ # Toolbar icons and agent provider marks
├── skill/
│ └── SKILL.md # Windows-tuned computer-use skill for coding agents
├── src/
│ ├── cli.js # `agate` CLI entry point
│ ├── brains/ # ACP, CLI-agent, Anthropic, Gemini, and mock brains
│ ├── browser/ # CDP driver, incremental diffs, reflexes, readback
│ ├── core/ # Engine, documents/PDF reader, YouTube transcripts, security fences
│ ├── daemon/ # Local bridge (`127.0.0.1:49200`) & per-session daemons
│ ├── mcp/ # Browser-only MCP server (`agate mcp`, 18 browser_* tools)
│ └── os/ # Windows UI Automation worker & SendInput fallback (Windows only)
└── test/ # Node built-in test runner suite (`npm test`)
```
---
## Privacy & Security
- **Localhost-only bindings.** The bridge (`127.0.0.1:49200`) and session daemons bind strictly to loopback and refuse external network connections; session daemons authenticate requests with a per-session random bearer token.
- **No telemetry, no accounts, no cloud relay.** Prompts and page context go directly from your machine to whichever local coding agent you chose.
- **Explicit OS input opt-in.** Desktop `agate os` commands are refused (`PermissionError`) unless `--allow-os-input` is explicitly passed.
- **Sensitive field & handoff protection.** Password and payment inputs are masked during observation and blocked from automated typing; Cloudflare, CAPTCHA, and 2FA gates pause automatically for human handoff.
- **Prompt-injection isolation.** Untrusted page, PDF, and transcript content is wrapped in rotating cryptographic nonce fences (`<agate_page_data nonce="...">`).
---
## Development & Testing
```bash
# Run the full unit and integration test suite
npm test
# Run the real-Chrome smoke suite
npm run smoke
```
---
## License
MIT — see [LICENSE](LICENSE).