# Weavetab — Complete Documentation & Technical Knowledge Base (v2.6.0) > This file is a complete, aggregated knowledge base containing all documentation, plugin authoring specs, research papers, API references, architecture guides, and CLI manuals for Weavetab MCP. --- # Weavetab Plugin Authoring Specification (@weavetab/sdk v2.6.0) > Standalone specification for AI coding agents (Cursor, Claude Code, Antigravity, Windsurf, ChatGPT) to create, test, and publish Weavetab MCP plugins without needing to read the SDK repository or source code. ## 1. Quickstart CLI Scaffold a ready-to-publish TypeScript plugin in seconds: ```bash npx @weavetab/sdk init my-weavetab-plugin cd my-weavetab-plugin npm install npm run build npm test ``` ## 2. Minimal 20-Line Plugin (`src/index.ts`) Every Weavetab plugin exports a default plugin definition created with `definePlugin` from `@weavetab/sdk`: ```typescript import { definePlugin, createTool, z } from "@weavetab/sdk"; const extractHeadings = createTool({ name: "extract_headings", description: "Extracts all H1-H3 headings from the active browser tab.", inputSchema: z.object({ maxItems: z.number().int().min(1).max(100).default(25), }), handler: async (args, ctx) => { const headings = await ctx.cdp.evaluate(` Array.from(document.querySelectorAll('h1, h2, h3')) .slice(0, ${args.maxItems}) .map(el => el.textContent?.trim() || '') .filter(Boolean) `); return { count: headings.length, headings }; }, }); export default definePlugin({ name: "weavetab-plugin-headings", version: "1.0.0", description: "Fast heading extraction tool for Weavetab MCP.", permissions: { cdp: { evaluate: true, reason: "Reads H1-H3 text nodes from the active tab." }, }, tools: [extractHeadings], }); ``` ## 3. Plugin Context API (`ctx` passed to `handler(args, ctx)`) - `ctx.cdp.evaluate(expression: string): Promise` — Evaluates JavaScript in the active browser tab. - `ctx.cdp.send(method: string, params?: Record): Promise` — Sends a raw Chrome DevTools Protocol command (e.g. `Page.captureScreenshot`, `DOM.getDocument`, `Network.enable`). - `ctx.cdp.navigate(url: string): Promise` — Navigates the active tab. - `ctx.storage.get(key: string): Promise` — Reads plugin-scoped persistent JSON state (`~/.weavetab/plugin-storage/`). - `ctx.storage.set(key: string, value: T): Promise` — Writes plugin-scoped persistent JSON state. - `ctx.storage.delete(key: string): Promise` — Deletes a key from plugin storage. - `ctx.logger.info(msg)` / `ctx.logger.warn(msg)` / `ctx.logger.error(msg)` — Structured diagnostic logging. ## 4. Required `weavetab.json` Manifest (at package root) Auto-generate from your TypeScript entry with `npx weavetab-sdk manifest`, or create `weavetab.json` at the package root: ```json { "$schema": "https://weavetab.dev/schema/plugin.json", "name": "weavetab-plugin-headings", "displayName": "Heading Extractor", "version": "1.0.0", "description": "Fast heading extraction tool for Weavetab MCP.", "main": "dist/index.js", "engines": { "weavetab": ">=2.5.0", "node": ">=20.0.0" }, "permissions": { "cdp": { "evaluate": true, "reason": "Reads H1-H3 text nodes from the active tab." } }, "tools": [ { "name": "extract_headings", "description": "Extracts all H1-H3 headings from the active browser tab." } ] } ``` ## 5. Required `package.json` Fields for Marketplace Discovery To appear automatically on `https://weavetab.dev/discover`: 1. Include `"weavetab-plugin"` in `keywords`. 2. Include `"weavetab.json"` and `"dist"` in `files`. 3. Declare `"@weavetab/sdk": "^2.6.0"` in `dependencies` or `peerDependencies`. ## 6. Unit Testing with `PluginTestHarness` (`test/plugin.test.mjs`) ```javascript import test from "node:test"; import assert from "node:assert/strict"; import { PluginTestHarness } from "@weavetab/sdk"; import plugin from "../dist/index.js"; test("extract_headings returns headings from mocked CDP", async () => { const harness = new PluginTestHarness(plugin, { evaluateHandler: async () => ["Welcome", "Features"], }); const res = await harness.invokeTool("extract_headings", { maxItems: 10 }); assert.equal(res.count, 2); assert.deepEqual(res.headings, ["Welcome", "Features"]); }); ``` --- # SECTION 2: DOCUMENTATION PAGES ## DOC: Weavetab MCP Documentation (Slug: documentation) > Weavetab documentation guide for Documentation. # Weavetab MCP Documentation > **Package:** `@weavetab/mcp` | **Version:** 2.6.0 | **License:** AGPLv3 | **Author:** fy2ne --- ## Overview Weavetab is a production-grade, in-process MCP (Model Context Protocol) server providing AI agents with direct control across Chromium browsers and Electron desktop applications. It communicates directly over the Chrome DevTools Protocol (CDP) WebSocket — no WebDriver process, no browser binary download, no cloud middleware. ### Core Capabilities - **41 Built-in MCP Tools** across functional categories (Vision, Navigation, Input, Tabs, Mission Execution, Dialog, Wait, Storage, Device, Network, Canvas, Output, Evaluation, Office Documents) - **Direct CDP WebSocket** — Local in-process transport, zero external driver overhead - **Semantic Delta Engine** — 5-10x token reduction via per-tab snapshot diffing - **Ghost Cursor** — Bézier curve click engine with human acceleration and jitter - **Human Typing Engine** — burst-pattern profiling, per-character jitter, natural pauses - **Blind Injection** — enterprise-grade credential injection via `secrets.json` with domain scoping, Shadow DOM isolation, and JS property hardening - **Self-Learning** — per-domain session memory, knowledge hints, automatic framework detection - **Security Stack** — domain blacklist, RBAC (5 roles), rate limiter, loop detection, input filter, root guard - **Burst Mode** — chain N actions in 1 MCP call via `browser_burst` - **Plugin System** — Extensible plugin ecosystem supporting tool additions, overrides (with originalHandler wrapping), and tool removals across 3 trust tiers (Official, Verified, Unverified) - **GitHub Automation (Plugin)** — Repo analysis, file reading, issues, and PRs are provided by the official `@weavetab/plugin-github` plugin, not built in ### Weavetab Skills **Weavetab Skills** is an optional companion package (`@weavetab/skills`) that provides pre-built workflow patterns and mission templates for AI agents. These skills help agents understand complex Weavetab workflows and execute multi-step missions more effectively. **Installation:** ```bash npm install -g @weavetab/skills ``` **Available Skills:** - **Multi-step Form Automation** — Complex form filling with validation handling - **E-commerce Checkout** — Shopping cart navigation and payment processing - **Data Extraction Pipelines** — Structured data scraping and export - **Content Management Systems** — WordPress, Drupal, and CMS-specific workflows - **API Testing & Validation** — Endpoint testing and response verification Skills are automatically discovered by compatible MCP clients and provide context-aware guidance for mission planning. --- ## Architecture ``` MCP Client → stdio/WebSocket → WithSecurity Pipeline → CDP WebSocket → Chromium (RateLimit → DomainPolicy → RBAC) ``` ### Five Architectural Layers | Layer | Components | Responsibility | |-------|-----------|----------------| | **Transport** | stdio (JSON-RPC), WebSocket (port 3000) | MCP client communication | | **Security & Governance** | Domain blacklist, Rate limiter, RBAC, Root guard, Storage blocker | Pre-flight checks | | **Intelligence** | Session memory, Delta engine, DOM pruner, Trail/loop detection, Knowledge hints, Vision fallback | Token optimization, self-learning | | **Sensor Systems** | Network telemetry, DOM mutations, Human pacing, Agent state machine, Thought HUD | Runtime awareness | | **CDP Bridge** | DOM walker, Ghost cursor, Keystroke engine, Pruner, Shadow DOM injector, Tab manager, Browser launcher | Browser control | --- ## Tool Reference (41 Tools) All tools share: Zod schema validation, `withSecurity()` pipeline (rate limiting + domain policy + RBAC), structured audit logging. ### Vision & Reading (8 tools) | Tool | Description | |------|-------------| | `browser_map` | DOM enumeration with volatile `w:NN` ref IDs, Set-of-Marks visual grounding (`visual: true` / `"auto"`), entity & card container binding (`┌ Heading`), active modal hoisting (`╔═ ACTIVE DIALOG ═╗`), nav cluster collapsing, delta diffing, and scope filtering (`modal`, `form`, `main`). | | `browser_find` | Native CDP text search with single and multi-match (`all: true`, `limit: N`) returning bounding rects and selectors — ~10x cheaper than map | | `browser_scrape` | CSS/XPath structured data extraction in 1 CDP call | | `browser_inspect` | Computed CSS styles + inline styles + event listener types | | `browser_snapshot` | MHTML capture/restore of DOM state + resources | | `browser_screenshot` | PNG/JPEG capture via CDP, full-page + clip region, returns base64 data URL (no file pollution) | | `browser_console` | Read/clear buffered console logs and exceptions | | `browser_extract_design` | Extract design tokens, typography, colors, and clean CSS with pixel fidelity | ### Navigation (1 tool) | Tool | Description | |------|-------------| | `browser_navigate` | Ultra-low latency navigation (~150-300ms) with non-blocking readyState polling, parallelized metadata, domain blocklist enforcement, and `weavetab://` protocol | ### Input (9 tools) | Tool | Description | |------|-------------| | `browser_click` | Ghost Cursor (Bézier) click with direct visual mark targeting (`mark: N`), intent memory, occlusion detection, and stuck-loop detection | | `browser_type` | Human keystroke engine with zero-target `document.activeElement` typing, anti-unfocus click avoidance, jitter, and burst patterns | | `browser_type_secret` | Blind Injection from `secrets.json` — domain check before value load, Shadow DOM isolation, JS property hardening | | `browser_key` | Native keyboard dispatch with combo hotkeys (`"Ctrl+A"`, `"Cmd+K"`, `"Alt+Tab"`) and zero arbitrary delay | | `browser_pointer` | Hover, double-click, drag-and-drop, and multi-level flyout menu traversal via `hover_chain: ["File", "Export As", "PNG"]` | | `browser_select` | Native `