@weavetab/mcp 2.5.0-beta.5 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/AGENTS.md +49 -49
  2. package/ARCHITECTURE.md +590 -590
  3. package/README.md +216 -100
  4. package/SECURITY.md +207 -207
  5. package/TROUBLESHOOTING.md +373 -365
  6. package/dist/anticaptcha/detector.js +395 -395
  7. package/dist/anticaptcha/solver.js +130 -130
  8. package/dist/cdp/bridge.js +73 -73
  9. package/dist/cdp/connector.js +46 -22
  10. package/dist/cdp/extension.js +34 -34
  11. package/dist/cdp/helpers.js +174 -174
  12. package/dist/cdp/pruner.js +195 -195
  13. package/dist/cdp/ref_cache.js +66 -66
  14. package/dist/cdp/security.js +10 -10
  15. package/dist/cdp/verify.js +57 -57
  16. package/dist/cdp/walker.js +563 -525
  17. package/dist/cli/plugin.js +26 -3
  18. package/dist/config/loader.d.ts +0 -3
  19. package/dist/config/loader.js +0 -9
  20. package/dist/index.js +0 -4
  21. package/dist/intelligence/intent.js +81 -81
  22. package/dist/intelligence/sessionMemory.js +2 -2
  23. package/dist/overlay/ghost.js +22 -22
  24. package/dist/overlay/injector.js +89 -89
  25. package/dist/plugin/extension_bridge.js +54 -54
  26. package/dist/plugin/interface.d.ts +7 -0
  27. package/dist/plugin/loader.js +3 -4
  28. package/dist/plugin/schema.d.ts +11 -0
  29. package/dist/plugin/schema.js +59 -0
  30. package/dist/security/guard.js +18 -18
  31. package/dist/sensors/actionability.js +167 -167
  32. package/dist/sensors/guard.js +29 -29
  33. package/dist/sensors/network.js +15 -17
  34. package/dist/server.d.ts +1 -1
  35. package/dist/server.js +173 -144
  36. package/dist/state/delta.js +6 -7
  37. package/dist/tools/automation.js +85 -85
  38. package/dist/tools/canvas.js +48 -25
  39. package/dist/tools/checkpoint.js +94 -35
  40. package/dist/tools/click.js +52 -41
  41. package/dist/tools/clipboard.js +80 -74
  42. package/dist/tools/design_extract.js +441 -441
  43. package/dist/tools/dialog.js +13 -13
  44. package/dist/tools/emulation.d.ts +2 -0
  45. package/dist/tools/emulation.js +7 -0
  46. package/dist/tools/fill.js +344 -347
  47. package/dist/tools/find.js +78 -52
  48. package/dist/tools/highlight.js +67 -67
  49. package/dist/tools/inspect.js +54 -25
  50. package/dist/tools/key.js +42 -35
  51. package/dist/tools/navigate.d.ts +1 -1
  52. package/dist/tools/navigate.js +35 -35
  53. package/dist/tools/office/parse.js +62 -18
  54. package/dist/tools/pdf.d.ts +9 -0
  55. package/dist/tools/pdf.js +7 -4
  56. package/dist/tools/performance.d.ts +11 -4
  57. package/dist/tools/performance.js +94 -42
  58. package/dist/tools/performance_test.d.ts +2 -2
  59. package/dist/tools/performance_test.js +69 -69
  60. package/dist/tools/pointer.js +116 -116
  61. package/dist/tools/read.js +99 -67
  62. package/dist/tools/recording.js +9 -0
  63. package/dist/tools/scrape.js +146 -146
  64. package/dist/tools/screenshot.d.ts +2 -0
  65. package/dist/tools/screenshot.js +46 -4
  66. package/dist/tools/scroll.d.ts +3 -1
  67. package/dist/tools/scroll.js +13 -15
  68. package/dist/tools/select.d.ts +3 -0
  69. package/dist/tools/select.js +131 -124
  70. package/dist/tools/snapshot.js +8 -6
  71. package/dist/tools/storage.d.ts +5 -1
  72. package/dist/tools/storage.js +16 -0
  73. package/dist/tools/tabs.d.ts +7 -5
  74. package/dist/tools/tabs.js +79 -26
  75. package/dist/tools/thought.js +8 -8
  76. package/dist/tools/type.js +274 -274
  77. package/dist/tools/type_secret.js +23 -23
  78. package/dist/tools/upload.js +3 -3
  79. package/dist/tools/video_compiler.js +9 -0
  80. package/dist/tools/wait.js +35 -35
  81. package/dist/version.d.ts +1 -1
  82. package/dist/version.js +1 -1
  83. package/docs/DOCUMENTATION.md +583 -585
  84. package/docs/PLUGINS.md +139 -121
  85. package/docs/TOOLS.md +3 -4
  86. package/docs/architecture/blind-injection.md +83 -83
  87. package/docs/architecture/overview.md +49 -49
  88. package/docs/configuration/configuration.md +39 -27
  89. package/docs/configuration/folders.md +62 -55
  90. package/docs/desktop-automation/electron-apps.md +225 -214
  91. package/docs/get-started/installation.md +1 -1
  92. package/docs/get-started/introduction.md +60 -60
  93. package/docs/get-started/quickstart.md +2 -2
  94. package/docs/get-started/setup-wizard.md +1 -1
  95. package/docs/intelligence/site-profiles.md +151 -151
  96. package/docs/tools/tools.md +582 -631
  97. package/docs/troubleshooting/trouble-loop.md +31 -31
  98. package/ext-dist/background.js +415 -415
  99. package/ext-dist/content.js +2527 -2527
  100. package/ext-dist/dashboard.html +583 -583
  101. package/ext-dist/hud/hud.js +3 -3
  102. package/ext-dist/hud/index.html +20 -20
  103. package/ext-dist/manifest.json +73 -73
  104. package/ext-dist/styles.css +223 -223
  105. package/mcp.json +796 -805
  106. package/package.json +8 -8
  107. package/server.json +23 -23
  108. package/smithery.yaml +7 -11
  109. package/dist/cdp/walker.test.d.ts +0 -2
  110. package/dist/cdp/walker.test.js +0 -172
  111. package/dist/intelligence/sessionMemory.test.d.ts +0 -2
  112. package/dist/intelligence/sessionMemory.test.js +0 -62
  113. package/dist/intelligence/trail.test.d.ts +0 -2
  114. package/dist/intelligence/trail.test.js +0 -110
  115. package/dist/state/cache.test.d.ts +0 -2
  116. package/dist/state/cache.test.js +0 -76
  117. package/dist/state/delta.test.d.ts +0 -2
  118. package/dist/state/delta.test.js +0 -279
  119. package/dist/state/groups.d.ts +0 -15
  120. package/dist/state/groups.js +0 -80
  121. package/dist/tools/accessibility.d.ts +0 -14
  122. package/dist/tools/accessibility.js +0 -32
  123. package/dist/tools/ask.d.ts +0 -14
  124. package/dist/tools/ask.js +0 -49
  125. package/dist/tools/click_and_wait.d.ts +0 -33
  126. package/dist/tools/click_and_wait.js +0 -149
  127. package/dist/tools/drag.d.ts +0 -15
  128. package/dist/tools/drag.js +0 -29
  129. package/dist/tools/geo.d.ts +0 -19
  130. package/dist/tools/geo.js +0 -29
  131. package/dist/tools/github/analyze.d.ts +0 -4
  132. package/dist/tools/github/analyze.js +0 -113
  133. package/dist/tools/github/cache.d.ts +0 -21
  134. package/dist/tools/github/cache.js +0 -28
  135. package/dist/tools/github/index.d.ts +0 -19
  136. package/dist/tools/github/index.js +0 -40
  137. package/dist/tools/github/issues.d.ts +0 -9
  138. package/dist/tools/github/issues.js +0 -88
  139. package/dist/tools/github/pr.d.ts +0 -5
  140. package/dist/tools/github/pr.js +0 -88
  141. package/dist/tools/github/rateLimiter.d.ts +0 -4
  142. package/dist/tools/github/rateLimiter.js +0 -46
  143. package/dist/tools/github/read.d.ts +0 -34
  144. package/dist/tools/github/read.js +0 -74
  145. package/dist/tools/github/repoContext.d.ts +0 -20
  146. package/dist/tools/github/repoContext.js +0 -129
  147. package/dist/tools/hover.d.ts +0 -19
  148. package/dist/tools/hover.js +0 -57
  149. package/dist/tools/integration.test.d.ts +0 -2
  150. package/dist/tools/integration.test.js +0 -96
  151. package/dist/tools/macro_compiler.d.ts +0 -7
  152. package/dist/tools/macro_compiler.js +0 -82
  153. package/dist/tools/mouse.d.ts +0 -21
  154. package/dist/tools/mouse.js +0 -62
  155. package/dist/tools/response.d.ts +0 -129
  156. package/dist/tools/response.js +0 -5
  157. package/dist/tools/wait_for.d.ts +0 -23
  158. package/dist/tools/wait_for.js +0 -30
  159. package/dist/tools/windows.d.ts +0 -22
  160. package/dist/tools/windows.js +0 -57
@@ -1,585 +1,583 @@
1
- # Weavetab MCP Documentation
2
-
3
- > **Package:** `@weavetab/mcp` | **Version:** 2.5.0 | **License:** AGPLv3 | **Author:** fy2ne
4
-
5
- ---
6
-
7
- ## Overview
8
-
9
- Weavetab is a production-grade, in-process MCP (Model Context Protocol) server providing AI agents with direct, physical Layer 0 control across Chromium browsers and Electron desktop applications. It communicates directly over the Chrome DevTools Protocol (CDP) WebSocket at Layer 0 — no WebDriver process, no browser binary download, no cloud middleware.
10
-
11
- ### Core Capabilities
12
-
13
- - **44 Built-in MCP Tools** across functional categories (Vision, Navigation, Input, Tabs, Mission Execution, Dialog, Wait, Storage, Device, Network, Canvas, Output, Evaluation, GitHub, Office Documents)
14
- - **Direct CDP WebSocket** — 3-8ms mean latency, zero process overhead
15
- - **Semantic Delta Engine** — 5-10x token reduction via per-tab snapshot diffing
16
- - **Ghost Cursor** — Bézier curve click engine with human acceleration and jitter
17
- - **Human Typing Engine** — burst-pattern profiling, per-character jitter, natural pauses
18
- - **Blind Injection** — enterprise-grade credential injection via `secrets.json` with domain scoping, Shadow DOM isolation, and JS property hardening
19
- - **Self-Learning** — per-domain session memory, knowledge hints, automatic framework detection
20
- - **Security Stack** — domain blacklist, RBAC (4 roles), rate limiter, loop detection, input filter, root guard
21
- - **Burst Mode** — chain N actions in 1 MCP call via `browser_burst`
22
- - **Plugin System** — Extensible plugin ecosystem supporting tool additions, overrides (with originalHandler wrapping), and tool removals across 3 trust tiers (Official, Verified, Unverified)
23
- - **GitHub Integration** — Unified `browser_github` tool for repo analysis, file reading, issues, and PRs
24
-
25
- ### Weavetab Skills
26
-
27
- **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.
28
-
29
- **Installation:**
30
- ```bash
31
- npm install -g @weavetab/skills
32
- ```
33
-
34
- **Available Skills:**
35
- - **Multi-step Form Automation** — Complex form filling with validation handling
36
- - **E-commerce Checkout** — Shopping cart navigation and payment processing
37
- - **Data Extraction Pipelines** — Structured data scraping and export
38
- - **Content Management Systems** — WordPress, Drupal, and CMS-specific workflows
39
- - **API Testing & Validation** — Endpoint testing and response verification
40
-
41
- Skills are automatically discovered by compatible MCP clients and provide context-aware guidance for mission planning.
42
-
43
- ---
44
-
45
- ## Architecture
46
-
47
- ```
48
- MCP Client → stdio/WebSocket → WithSecurity Pipeline → CDP WebSocket → Chromium
49
- (RateLimit → DomainPolicy → RBAC)
50
- ```
51
-
52
- ### Five Architectural Layers
53
-
54
- | Layer | Components | Responsibility |
55
- |-------|-----------|----------------|
56
- | **Transport** | stdio (JSON-RPC), WebSocket (port 3000) | MCP client communication |
57
- | **Security & Governance** | Domain blacklist, Rate limiter, RBAC, Root guard, Storage blocker | Pre-flight checks |
58
- | **Intelligence** | Session memory, Delta engine, DOM pruner, Trail/loop detection, Knowledge hints, Vision fallback | Token optimization, self-learning |
59
- | **Sensor Systems** | Network telemetry, DOM mutations, Human pacing, Agent state machine, Thought HUD | Runtime awareness |
60
- | **CDP Bridge** | DOM walker, Ghost cursor, Keystroke engine, Pruner, Shadow DOM injector, Tab manager, Browser launcher | Browser control |
61
-
62
- ---
63
-
64
- ## Tool Reference (44 Tools)
65
-
66
- All tools share: Zod schema validation, `withSecurity()` pipeline (rate limiting + domain policy + RBAC), structured audit logging.
67
-
68
- ### Vision & Reading (8 tools)
69
-
70
- | Tool | Description |
71
- |------|-------------|
72
- | `browser_map` | DOM enumeration (v3.0) 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`). |
73
- | `browser_find` | Native CDP text search with single and multi-match (`all: true`, `limit: N`) returning bounding rects and selectors — ~10x cheaper than map |
74
- | `browser_scrape` | CSS/XPath structured data extraction in 1 CDP call |
75
- | `browser_inspect` | Computed CSS styles + inline styles + event listener types |
76
- | `browser_snapshot` | MHTML capture/restore of DOM state + resources |
77
- | `browser_screenshot` | PNG/JPEG capture via CDP, full-page + clip region, returns base64 data URL (no file pollution) |
78
- | `browser_console` | Read/clear buffered console logs and exceptions |
79
- | `browser_extract_design` | Extract design tokens, typography, colors, and clean CSS with pixel fidelity |
80
-
81
- ### Navigation (1 tool)
82
-
83
- | Tool | Description |
84
- |------|-------------|
85
- | `browser_navigate` | Ultra-low latency navigation (~150-300ms) with non-blocking readyState polling, parallelized metadata, domain blocklist enforcement, and `weavetab://` protocol |
86
-
87
- ### Input (9 tools)
88
-
89
- | Tool | Description |
90
- |------|-------------|
91
- | `browser_click` | Ghost Cursor (Bézier) click with direct visual mark targeting (`mark: N`), intent memory, occlusion detection, and stuck-loop detection |
92
- | `browser_type` | Human keystroke engine with zero-target `document.activeElement` typing, anti-unfocus click avoidance, jitter, and burst patterns |
93
- | `browser_type_secret` | Blind Injection from `secrets.json` — domain check before value load, Shadow DOM isolation, JS property hardening |
94
- | `browser_key` | Native keyboard dispatch with combo hotkeys (`"Ctrl+A"`, `"Cmd+K"`, `"Alt+Tab"`) and zero arbitrary delay |
95
- | `browser_pointer` | Hover, double-click, drag-and-drop, and multi-level flyout menu traversal via `hover_chain: ["File", "Export As", "PNG"]` |
96
- | `browser_select` | Native `<select>` dropdown selection — React/Vue safe (prototype setter + events) |
97
- | `browser_fill` | Smart multi-field form batch completion with input discovery scanner (`scan: true`), flexible field selectors, and Google Sheets `grid_data` |
98
- | `browser_upload` | Bypass file dialogs via CDP `DOM.setFileInputFiles` |
99
- | `browser_scroll` | Fast non-blocking directional + element-relative scroll without redundant action map rebuilds |
100
-
101
- ### Tabs & Windows (2 tools)
102
-
103
- | Tool | Description |
104
- |------|-------------|
105
- | `browser_tabs` | Open/switch/close/list/consolidate (dedup)/heal (recover crash). Also list/focus windows |
106
- | `browser_detect` | Detect installed browsers + CDP feature coverage per engine (Chromium, Firefox, WebKit) |
107
-
108
- ### Mission Execution (2 tools)
109
-
110
- | Tool | Description |
111
- |------|-------------|
112
- | `browser_burst` | Chain N actions in 1 MCP call. Supports 4 macro steps: `type_and_send`, `navigate_and_read`, `click_and_wait`, `scroll_and_read` |
113
- | `browser_automation` | Inject persistent self-running scripts — monitoring, polling, background extraction |
114
-
115
- ### Dialog & User Interaction (3 tools)
116
-
117
- | Tool | Description |
118
- |------|-------------|
119
- | `browser_dialog` | Accept/dismiss JavaScript alert/confirm/prompt dialogs |
120
- | `browser_thoughts` | Green thought bubbles: feedback (one-way) or question with input (sentence/paragraph modes) |
121
- | `browser_clipboard` | System clipboard R/W (text + images) |
122
-
123
- ### Wait & Timing (2 tools)
124
-
125
- | Tool | Description |
126
- |------|-------------|
127
- | `browser_wait` | Wait for element/text/URL/stable/network/auto — timeout configurable, optional loop counter reset (`reset_loop: true`) |
128
- | `browser_captcha` | Autonomous zero-API detection and solving for Cloudflare Turnstile, reCAPTCHA v2/v3, GeeTest, and hCaptcha via CDP mouse physics |
129
-
130
- ### Storage & Cookies (2 tools)
131
-
132
- | Tool | Description |
133
- |------|-------------|
134
- | `browser_storage` | localStorage & sessionStorage get/set/clear |
135
- | `browser_cookies` | Cookies get/set/delete |
136
-
137
- ### Device & Environment (2 tools)
138
-
139
- | Tool | Description |
140
- |------|-------------|
141
- | `browser_viewport` | Viewport, device emulation, geolocation, timezone override |
142
- | `browser_emulate` | Network throttling (3G/4G/offline), CPU slowdown, geolocation, timezone, and User-Agent override |
143
-
144
- ### Network (1 tool)
145
-
146
- | Tool | Description |
147
- |------|-------------|
148
- | `browser_network_intercept` | Mock API responses, block tracking, and retrieve raw protocol network telemetry (TLS/SSL certificate metadata, microsecond timing breakdown, OS-level failure reasons) |
149
-
150
- ### Canvas & Visual (2 tools)
151
-
152
- | Tool | Description |
153
- |------|-------------|
154
- | `browser_canvas` | Get image data (base64 PNG) or draw points on canvas |
155
- | `browser_highlight` | Visual CDP overlay highlight — zero token cost |
156
-
157
- ### Output (2 tools)
158
-
159
- | Tool | Description |
160
- |------|-------------|
161
- | `browser_pdf` | Print page to PDF — landscape, scale, page ranges |
162
- | `browser_recording` | Compile browser screencast frames into video (.webp, .gif, .mp4, .webm) |
163
-
164
- ### Evaluation (1 tool)
165
-
166
- | Tool | Description |
167
- |------|-------------|
168
- | `browser_eval` | Run arbitrary JS via CDP Runtime.evaluate. On `Weavetab://` pages, supports building UIs via `wt-dashboard-command` events |
169
-
170
- ### Performance (1 tool)
171
-
172
- | Tool | Description |
173
- |------|-------------|
174
- | `browser_performance` | FCP, LCP, TTI metrics, resource timings |
175
-
176
- ### GitHub (1 tool)
177
-
178
- | Tool | Description |
179
- |------|-------------|
180
- | `browser_github` | Action-based repo metadata analysis, raw source file reading, issue triage, and PR inspection |
181
-
182
- ### Utility (5 tools)
183
-
184
- | Tool | Description |
185
- |------|-------------|
186
- | `list_plugins` | Inspect installed SDK plugins, loaded tool overrides, and capability manifests |
187
- | `load_plugin` | Dynamically load a Weavetab plugin by npm package name with isolated sandboxing |
188
- | `browser_checkpoint` | Snapshot and restore browser state (cookies, storage, scroll/URL) into named checkpoints for time-travel and rollback |
189
- | `browser_pattern_learn` | Read, register, and update named workflow patterns and site quirks per origin |
190
- | `browser_office` | Parse Word (`.docx`), Excel (`.xlsx`), PDF, and CSV files into structured data |
191
-
192
- ---
193
-
194
- ## Secrets Management
195
-
196
- Secrets are stored in structured `secrets.json` files with `chmod 600` enforcement and atomic file writes (temp file + rename).
197
-
198
- ### Resolution Order
199
-
200
- 1. `./.Weavetab/secrets.json` (project-scoped, opt-in via `Weavetab secrets init --project`)
201
- 2. `~/.Weavetab/secrets.json` (global default)
202
-
203
- > **Note:** The legacy `.env`-based `EnvSecretProvider` is **deprecated and no longer supported**. All secrets must use `secrets.json`.
204
-
205
- ### CLI Commands
206
-
207
- ```bash
208
- Weavetab secrets set MY_KEY # Prompts for value securely
209
- Weavetab secrets list # Shows keys + domains only (never values)
210
- Weavetab secrets rm MY_KEY # Remove a secret
211
- Weavetab secrets init --project # Create project-scoped secrets + config
212
- ```
213
-
214
- ### Secrets File Format
215
-
216
- ```json
217
- {
218
- "API_KEY": {
219
- "value": "sk-...",
220
- "domains": ["api.example.com"],
221
- "description": "Production API key"
222
- }
223
- }
224
- ```
225
-
226
- ### Blind Injection
227
-
228
- Use `browser_type_secret` to inject credentials without exposing them to the LLM:
229
-
230
- ```typescript
231
- browser_type_secret({
232
- id: "w:1",
233
- envKey: "API_KEY"
234
- })
235
- ```
236
-
237
- The value is permanently masked as `[REDACTED]` in all subsequent DOM reads and audit logs.
238
-
239
- ---
240
-
241
- ## Configuration
242
-
243
- ### Config File Locations
244
-
245
- - **Global:** `~/.Weavetab/config.json`
246
- - **Project:** `./.Weavetab/config.json` (if exists, takes precedence)
247
-
248
- ### Config Structure
249
-
250
- ```json
251
- {
252
- "browserType": "chromium",
253
- "headless": false,
254
- "devMode": true,
255
- "maxActionsPerMinute": 60,
256
- "role": "admin",
257
- "telemetry": false,
258
- "attachPort": 0,
259
- "extension": true,
260
- "cookies": false,
261
- "browserFlags": [],
262
- "policies": [],
263
- "electron": {
264
- "discord": "C:\\Users\\<user>\\AppData\\Local\\Discord\\app-<version>\\Discord.exe",
265
- "antigravity": "C:\\Users\\<user>\\AppData\\Local\\Programs\\antigravity\\Antigravity.exe",
266
- "vscode": "C:\\Users\\<user>\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe"
267
- }
268
- }
269
- ```
270
-
271
- ### Configuration Options
272
-
273
- | Option | Type | Default | Description |
274
- |--------|------|---------|-------------|
275
- | `browserType` | string | "chromium" | Browser to use (chromium, firefox, webkit) |
276
- | `headless` | boolean | false | Run browser in headless mode |
277
- | `devMode` | boolean | true | Enable HUD overlay and verbose logging |
278
- | `maxActionsPerMinute` | number | 60 | Rate limit for tool executions |
279
- | `role` | string | "admin" | RBAC role (admin, system, viewer, automation) |
280
- | `telemetry` | boolean | false | Enable anonymous usage telemetry |
281
- | `attachPort` | number | 0 | Chrome DevTools Protocol port |
282
- | `extension` | boolean | true | Enable Weavetab extension integration |
283
- | `cookies` | boolean | false | Persist cookies/storage across sessions. When `false`, `document.cookie`, `localStorage`, and `sessionStorage` are all neutered at the browser level (returns empty/null for everything) + a fresh isolated profile is used each session. When `true`, cookies/storage work normally and persist via the profile directory. |
284
- | `browserFlags` | string[] | `[]` | Extra Chromium command-line flags to append on launch (e.g., `["--disable-web-security"]`). The `--disable-sync` flag is mandatory and cannot be overridden — any conflicting flag is automatically dropped. |
285
- | `policies` | PolicyEntry[] | `[]` | Domain-level access control policies (see [Domain Policy](#domain-policy) below). Supersedes the legacy `block`/`allow` lists. |
286
- | `electron` | Record<string, string> | `{}` | Map of registered Electron desktop applications (e.g. Discord, VS Code, Figma, Antigravity, local dev apps) to executable paths or startup commands. |
287
-
288
- ---
289
-
290
- ## Domain Policy
291
-
292
- The `policies` config option provides **fine-grained domain-level access control** that supersedes the legacy `block`/`allow` lists. Policies are checked **in array order** before every tool execution — the first matching pattern wins. If no policy matches, the legacy `block`/`allow` lists are checked as fallback, then access is allowed by default.
293
-
294
- Configure policies directly in your config file (or via `~/.Weavetab/policy.json`):
295
-
296
- ```json
297
- {
298
- "policies": [
299
- {
300
- "pattern": "*.banking.com",
301
- "mode": "deny"
302
- },
303
- {
304
- "pattern": "banking.com",
305
- "mode": "allow"
306
- },
307
- {
308
- "pattern": "*.internal.com",
309
- "mode": "read-only"
310
- },
311
- {
312
- "pattern": "*.trusted.com",
313
- "mode": "allow"
314
- },
315
- {
316
- "pattern": "*.audit-logs.com",
317
- "mode": "audit-only"
318
- }
319
- ]
320
- }
321
- ```
322
-
323
- ### Policy Modes
324
-
325
- | Mode | Description |
326
- |------|-------------|
327
- | `allow` | Full access to all tools. Explicitly whitelists a domain. |
328
- | `read-only` | Only observation tools allowed: map, find, scrape, console, eval, inspect, snapshot, pdf, cookies. Blocks write tools (click, type, navigate, etc.). |
329
- | `deny` | Complete block of all interactions on that domain. |
330
- | `audit-only` | All tools allowed, but every action is logged for audit trails. |
331
-
332
- ### Key Differences from `block`/`allow` Lists
333
-
334
- | Feature | Legacy `block`/`allow` | `policies` |
335
- |---------|----------------------|------------|
336
- | Modes | Only allow or deny | 4 modes: allow, deny, read-only, audit-only |
337
- | Wildcards | Supported | Supported (`*` wildcard) |
338
- | Order | No ordering | **First match wins** — order matters |
339
- | Granularity | Domain only | Domain + per-tool enforcement (read-only blocks writes) |
340
- | Check timing | At navigation | Every tool execution |
341
-
342
- ---
343
-
344
- ## RBAC Roles
345
-
346
- ### Role Definitions
347
-
348
- | Role | Permissions |
349
- |------|-------------|
350
- | `admin` | Full access to all tools |
351
- | `operator` | Full access to all tools (standard agent role) |
352
- | `viewer` | Read-only observation tools only (`browser_map`, `browser_find`, `browser_scrape`, `browser_console`, `browser_eval`, `browser_inspect`, `browser_extract_design`, `browser_snapshot`, `browser_screenshot`, `browser_pdf`, `browser_cookies`, `browser_tabs`, `browser_wait`, `browser_pattern_learn`, `browser_github`) |
353
- | `automation` | Full access except `browser_thoughts` (non-interactive CI/CD mode) |
354
- | `system` | Internal tools only (`browser_thoughts`, `browser_detect`, `browser_performance`, `browser_checkpoint`, `browser_pattern_learn`) |
355
-
356
- ### Setting Role
357
-
358
- ```json
359
- {
360
- "role": "viewer"
361
- }
362
- ```
363
-
364
- ---
365
-
366
- ## Performance Optimization
367
-
368
- ### Token Efficiency
369
-
370
- Use `browser_map` with delta and pruning for maximum efficiency:
371
-
372
- ```typescript
373
- // First call: full map
374
- browser_map({ prune: true })
375
-
376
- // Subsequent calls: only changes
377
- browser_map({ delta: true, prune: true })
378
- ```
379
-
380
- ### Latency Optimization
381
-
382
- - Use `fast: true` in click operations for faster execution
383
- - Enable `prune: true` to reduce DOM processing time
384
- - Use cached ref IDs instead of label-based lookups
385
- - Avoid unnecessary DOM walks with `browser_find` for text search
386
-
387
- ### Memory Optimization
388
-
389
- - Clear cache periodically: `Weavetab reset`
390
- - Use `limit` parameter in `browser_map` to reduce cache size
391
- - Enable `prune: true` to reduce memory footprint
392
- - Restart Weavetab for long-running sessions
393
-
394
- ---
395
-
396
- ## Plugin System
397
-
398
- ### Creating a Plugin
399
-
400
- Create any npm package with a `weavetab.json` manifest at its root:
401
-
402
- ```json
403
- // my-plugin/package.json
404
- {
405
- "name": "wt-my-tool",
406
- "version": "1.0.0",
407
- "main": "index.js",
408
- "type": "module"
409
- }
410
- ```
411
-
412
- ```json
413
- // my-plugin/weavetab.json
414
- {
415
- "name": "My Custom Tool",
416
- "version": "1.0.0",
417
- "description": "Custom MCP tool for Weavetab",
418
- "tools": [
419
- {
420
- "name": "browser_my_custom_tool",
421
- "description": "My custom tool description"
422
- }
423
- ]
424
- }
425
- ```
426
-
427
- ```typescript
428
- // my-plugin/index.ts
429
- import type { WeavetabPlugin } from "@weavetab/mcp";
430
-
431
- const plugin: WeavetabPlugin = {
432
- name: "wt-my-tool",
433
- version: "1.0.0",
434
- tools: [
435
- {
436
- name: "browser_my_custom_tool",
437
- description: "My custom tool description",
438
- handler: async (args, session, config) => {
439
- // Your tool implementation
440
- return { success: true, data: "result" };
441
- }
442
- }
443
- ]
444
- };
445
-
446
- export default plugin;
447
- ```
448
-
449
- ### Installing Plugins
450
-
451
- ```bash
452
- # Official plugins
453
- weavetab plugin add @weavetab/plugin-sample
454
-
455
- # Community plugins (any npm name)
456
- weavetab plugin add wt-my-tool
457
- # or via npm
458
- npm install wt-my-tool
459
- ```
460
-
461
- Plugins with a valid `weavetab.json` are automatically discovered on Weavetab startup.
462
-
463
- ---
464
-
465
- ## Weavetab Skills
466
-
467
- ### Using Skills
468
-
469
- Skills provide pre-built workflow patterns that help agents understand complex multi-step operations:
470
-
471
- ```bash
472
- npm install -g @weavetab/skills
473
- ```
474
-
475
- ### Available Skills
476
-
477
- - **Form Automation** — Handles complex forms with validation, multi-page flows, and error recovery
478
- - **E-commerce** — Shopping cart navigation, product selection, checkout processes
479
- - **Data Extraction** — Structured scraping, pagination handling, data export
480
- - **CMS Workflows** — WordPress, Drupal, and other CMS-specific operations
481
- - **API Testing** — Endpoint discovery, request/response validation, test automation
482
-
483
- ### Skill Integration
484
-
485
- Skills are automatically discovered by MCP clients and provide:
486
-
487
- - Context-aware workflow guidance
488
- - Step-by-step mission templates
489
- - Error handling patterns
490
- - Best practice recommendations
491
-
492
- ---
493
-
494
- ## Electron & Desktop Application Automation
495
-
496
- Weavetab natively supports **generic automation of any Electron or Chromium-based desktop application** (e.g. Discord, Slack, VS Code, Antigravity IDE, Figma, Obsidian, Postman, or local developer applications running from source).
497
-
498
- ### Why It Works at Layer 0
499
- Electron desktop applications run a bundled Chromium/Blink engine under the hood. When started with Chrome DevTools Protocol debugging enabled (either automatically via Weavetab or via `--remote-debugging-port`), Weavetab connects directly to the desktop app's internal WebSockets and exposes all 50 MCP tools without requiring external drivers or wrappers.
500
-
501
- ### Registering Applications
502
- In `~/.weavetab/config.json` or project-scoped `.weavetab/config.json`:
503
-
504
- ```json
505
- {
506
- "electron": {
507
- "discord": "C:\\Users\\<user>\\AppData\\Local\\Discord\\app-1.0.9183\\Discord.exe",
508
- "antigravity": "C:\\Users\\<user>\\AppData\\Local\\Programs\\antigravity\\Antigravity.exe",
509
- "vscode": "C:\\Users\\<user>\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe",
510
- "figma": "C:\\Users\\<user>\\AppData\\Local\\Figma\\Figma.exe",
511
- "obsidian": "C:\\Users\\<user>\\AppData\\Local\\Obsidian\\Obsidian.exe",
512
- "my-app": "C:\\path\\to\\my-project\\node_modules\\electron\\dist\\electron.exe"
513
- }
514
- }
515
- ```
516
-
517
- ### Automating Local / Source-Hosted Projects
518
- When developing an Electron app locally (e.g. `localhost:3000` or running via Vite/Webpack/Electron forge):
519
-
520
- 1. **Launch with remote debugging enabled:**
521
- ```bash
522
- npx electron . --remote-debugging-port=9222
523
- # or with npm scripts:
524
- npm run dev -- --remote-debugging-port=9222
525
- ```
526
-
527
- 2. **Automate via MCP tools:**
528
- Set `"attachPort": 9222` or register the dev script in `"electron"` config.
529
-
530
- ### Tool Execution Flow with Desktop Apps
531
- Every Weavetab tool supports the optional `app` parameter:
532
-
533
- | Tool Call | Desktop Behavior |
534
- | :--- | :--- |
535
- | `browser_navigate({ app: "antigravity" })` | Launches or connects to Antigravity's CDP session |
536
- | `browser_tabs({ action: "list", app: "antigravity" })` | Lists all windows, webviews, and workbench tabs in the app |
537
- | `browser_tabs({ action: "switch", tabId: "<id>", app: "antigravity" })` | Switches active focus to the specified workbench or window |
538
- | `browser_map({ app: "antigravity" })` | Generates semantic Ref IDs (`w:NN`) for the desktop app's active window |
539
- | `browser_click({ ref: "w:12", app: "antigravity" })` | Sends Ghost Cursor click to the desktop app element |
540
- | `browser_type({ ref: "w:15", text: "...", app: "discord" })` | Types text directly into the desktop app input field |
541
- | `browser_eval({ expression: "...", app: "vscode" })` | Evaluates JavaScript inside the desktop app frame context |
542
-
543
- ---
544
-
545
- ## Troubleshooting
546
-
547
- ### Common Issues
548
-
549
- 1. **CDP connection failed** — Ensure Chrome is running with `--remote-debugging-port=9222`
550
- 2. **Extension not loading** — Use headed mode or `--headless=new` Chrome flag
551
- 3. **High memory usage** — Clear cache with `Weavetab reset` or enable pruning
552
- 4. **Token usage high** — Use `delta: true` and `prune: true` in `browser_map`
553
- 5. **Clicks failing** — Use ref IDs from `browser_map` instead of labels
554
-
555
- ### Debug Mode
556
-
557
- Enable `devMode: true` in config for:
558
-
559
- - Real-time tool execution timing
560
- - Token usage estimates
561
- - Detailed error messages
562
- - HUD overlay in browser
563
-
564
- ### Audit Logs
565
-
566
- Review `~/.Weavetab/logs/audit.log` for:
567
-
568
- - Tool invocation history
569
- - Error messages and stack traces
570
- - Domain policy violations
571
- - Security events
572
-
573
- For detailed troubleshooting, see [TROUBLESHOOTING.md](../TROUBLESHOOTING.md).
574
-
575
- ---
576
-
577
- ## Additional Resources
578
-
579
- - [Tool Reference](tools/tools.md)
580
- - [Plugin System Guide](PLUGINS.md)
581
- - [Architecture Documentation](../ARCHITECTURE.md)
582
- - [Support & Community](../SUPPORT.md)
583
- - [Security Policy](../SECURITY.md)
584
- - [Contributing Guidelines](../CONTRIBUTING.md)
585
- - [Troubleshooting Guide](../TROUBLESHOOTING.md)
1
+ # Weavetab MCP Documentation
2
+
3
+ > **Package:** `@weavetab/mcp` | **Version:** 2.5.1 | **License:** AGPLv3 | **Author:** fy2ne
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ Weavetab is a production-grade, in-process MCP (Model Context Protocol) server providing AI agents with direct, physical Layer 0 control across Chromium browsers and Electron desktop applications. It communicates directly over the Chrome DevTools Protocol (CDP) WebSocket at Layer 0 — no WebDriver process, no browser binary download, no cloud middleware.
10
+
11
+ ### Core Capabilities
12
+
13
+ - **41 Built-in MCP Tools** across functional categories (Vision, Navigation, Input, Tabs, Mission Execution, Dialog, Wait, Storage, Device, Network, Canvas, Output, Evaluation, Office Documents)
14
+ - **Direct CDP WebSocket** — 3-8ms mean latency, zero process overhead
15
+ - **Semantic Delta Engine** — 5-10x token reduction via per-tab snapshot diffing
16
+ - **Ghost Cursor** — Bézier curve click engine with human acceleration and jitter
17
+ - **Human Typing Engine** — burst-pattern profiling, per-character jitter, natural pauses
18
+ - **Blind Injection** — enterprise-grade credential injection via `secrets.json` with domain scoping, Shadow DOM isolation, and JS property hardening
19
+ - **Self-Learning** — per-domain session memory, knowledge hints, automatic framework detection
20
+ - **Security Stack** — domain blacklist, RBAC (5 roles), rate limiter, loop detection, input filter, root guard
21
+ - **Burst Mode** — chain N actions in 1 MCP call via `browser_burst`
22
+ - **Plugin System** — Extensible plugin ecosystem supporting tool additions, overrides (with originalHandler wrapping), and tool removals across 3 trust tiers (Official, Verified, Unverified)
23
+ - **GitHub Automation (Plugin)** — Repo analysis, file reading, issues, and PRs are provided by the official `@weavetab/plugin-github` plugin, not built in
24
+
25
+ ### Weavetab Skills
26
+
27
+ **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.
28
+
29
+ **Installation:**
30
+ ```bash
31
+ npm install -g @weavetab/skills
32
+ ```
33
+
34
+ **Available Skills:**
35
+ - **Multi-step Form Automation** — Complex form filling with validation handling
36
+ - **E-commerce Checkout** — Shopping cart navigation and payment processing
37
+ - **Data Extraction Pipelines** — Structured data scraping and export
38
+ - **Content Management Systems** — WordPress, Drupal, and CMS-specific workflows
39
+ - **API Testing & Validation** — Endpoint testing and response verification
40
+
41
+ Skills are automatically discovered by compatible MCP clients and provide context-aware guidance for mission planning.
42
+
43
+ ---
44
+
45
+ ## Architecture
46
+
47
+ ```
48
+ MCP Client → stdio/WebSocket → WithSecurity Pipeline → CDP WebSocket → Chromium
49
+ (RateLimit → DomainPolicy → RBAC)
50
+ ```
51
+
52
+ ### Five Architectural Layers
53
+
54
+ | Layer | Components | Responsibility |
55
+ |-------|-----------|----------------|
56
+ | **Transport** | stdio (JSON-RPC), WebSocket (port 3000) | MCP client communication |
57
+ | **Security & Governance** | Domain blacklist, Rate limiter, RBAC, Root guard, Storage blocker | Pre-flight checks |
58
+ | **Intelligence** | Session memory, Delta engine, DOM pruner, Trail/loop detection, Knowledge hints, Vision fallback | Token optimization, self-learning |
59
+ | **Sensor Systems** | Network telemetry, DOM mutations, Human pacing, Agent state machine, Thought HUD | Runtime awareness |
60
+ | **CDP Bridge** | DOM walker, Ghost cursor, Keystroke engine, Pruner, Shadow DOM injector, Tab manager, Browser launcher | Browser control |
61
+
62
+ ---
63
+
64
+ ## Tool Reference (41 Tools)
65
+
66
+ All tools share: Zod schema validation, `withSecurity()` pipeline (rate limiting + domain policy + RBAC), structured audit logging.
67
+
68
+ ### Vision & Reading (8 tools)
69
+
70
+ | Tool | Description |
71
+ |------|-------------|
72
+ | `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`). |
73
+ | `browser_find` | Native CDP text search with single and multi-match (`all: true`, `limit: N`) returning bounding rects and selectors — ~10x cheaper than map |
74
+ | `browser_scrape` | CSS/XPath structured data extraction in 1 CDP call |
75
+ | `browser_inspect` | Computed CSS styles + inline styles + event listener types |
76
+ | `browser_snapshot` | MHTML capture/restore of DOM state + resources |
77
+ | `browser_screenshot` | PNG/JPEG capture via CDP, full-page + clip region, returns base64 data URL (no file pollution) |
78
+ | `browser_console` | Read/clear buffered console logs and exceptions |
79
+ | `browser_extract_design` | Extract design tokens, typography, colors, and clean CSS with pixel fidelity |
80
+
81
+ ### Navigation (1 tool)
82
+
83
+ | Tool | Description |
84
+ |------|-------------|
85
+ | `browser_navigate` | Ultra-low latency navigation (~150-300ms) with non-blocking readyState polling, parallelized metadata, domain blocklist enforcement, and `weavetab://` protocol |
86
+
87
+ ### Input (9 tools)
88
+
89
+ | Tool | Description |
90
+ |------|-------------|
91
+ | `browser_click` | Ghost Cursor (Bézier) click with direct visual mark targeting (`mark: N`), intent memory, occlusion detection, and stuck-loop detection |
92
+ | `browser_type` | Human keystroke engine with zero-target `document.activeElement` typing, anti-unfocus click avoidance, jitter, and burst patterns |
93
+ | `browser_type_secret` | Blind Injection from `secrets.json` — domain check before value load, Shadow DOM isolation, JS property hardening |
94
+ | `browser_key` | Native keyboard dispatch with combo hotkeys (`"Ctrl+A"`, `"Cmd+K"`, `"Alt+Tab"`) and zero arbitrary delay |
95
+ | `browser_pointer` | Hover, double-click, drag-and-drop, and multi-level flyout menu traversal via `hover_chain: ["File", "Export As", "PNG"]` |
96
+ | `browser_select` | Native `<select>` dropdown selection — React/Vue safe (prototype setter + events) |
97
+ | `browser_fill` | Smart multi-field form batch completion with input discovery scanner (`scan: true`), flexible field selectors, and Google Sheets `grid_data` |
98
+ | `browser_upload` | Bypass file dialogs via CDP `DOM.setFileInputFiles` |
99
+ | `browser_scroll` | Fast non-blocking directional + element-relative scroll without redundant action map rebuilds |
100
+
101
+ ### Tabs & Windows (2 tools)
102
+
103
+ | Tool | Description |
104
+ |------|-------------|
105
+ | `browser_tabs` | Open/switch/close/list/consolidate (dedup)/heal (recover crash). Also list/focus windows |
106
+ | `browser_detect` | Detect installed browsers + CDP feature coverage per engine (Chromium, Firefox, WebKit) |
107
+
108
+ ### Mission Execution (2 tools)
109
+
110
+ | Tool | Description |
111
+ |------|-------------|
112
+ | `browser_burst` | Chain N actions in 1 MCP call. Supports 4 macro steps: `type_and_send`, `navigate_and_read`, `click_and_wait`, `scroll_and_read` |
113
+ | `browser_automation` | Inject persistent self-running scripts — monitoring, polling, background extraction |
114
+
115
+ ### Dialog & User Interaction (3 tools)
116
+
117
+ | Tool | Description |
118
+ |------|-------------|
119
+ | `browser_dialog` | Accept/dismiss JavaScript alert/confirm/prompt dialogs |
120
+ | `browser_thoughts` | Green thought bubbles: feedback (one-way) or question with input (sentence/paragraph modes) |
121
+ | `browser_clipboard` | System clipboard R/W (text, images, or both in one write) |
122
+
123
+ ### Wait & Timing (2 tools)
124
+
125
+ | Tool | Description |
126
+ |------|-------------|
127
+ | `browser_wait` | Wait for element/text/URL/stable/network/auto — timeout configurable, optional loop counter reset (`reset_loop: true`) |
128
+ | `browser_captcha` | Autonomous zero-API detection and solving for Cloudflare Turnstile, reCAPTCHA v2/v3, GeeTest, and hCaptcha via CDP mouse physics |
129
+
130
+ ### Storage & Cookies (2 tools)
131
+
132
+ | Tool | Description |
133
+ |------|-------------|
134
+ | `browser_storage` | localStorage & sessionStorage get/set/clear |
135
+ | `browser_cookies` | Cookies get/set/delete |
136
+
137
+ ### Device & Environment (2 tools)
138
+
139
+ | Tool | Description |
140
+ |------|-------------|
141
+ | `browser_viewport` | Viewport, device emulation, geolocation, timezone override |
142
+ | `browser_emulate` | Network throttling (3G/4G/offline), CPU slowdown, geolocation, timezone, and User-Agent override |
143
+
144
+ ### Network (1 tool)
145
+
146
+ | Tool | Description |
147
+ |------|-------------|
148
+ | `browser_network_intercept` | Mock API responses, block tracking, and retrieve raw protocol network telemetry (TLS/SSL certificate metadata, microsecond timing breakdown, OS-level failure reasons) |
149
+
150
+ ### Canvas & Visual (2 tools)
151
+
152
+ | Tool | Description |
153
+ |------|-------------|
154
+ | `browser_canvas` | Get image data (base64 PNG) or draw points on canvas |
155
+ | `browser_highlight` | Visual CDP overlay highlight — zero token cost |
156
+
157
+ ### Output (2 tools)
158
+
159
+ | Tool | Description |
160
+ |------|-------------|
161
+ | `browser_pdf` | Print page to PDF — landscape, scale, page ranges |
162
+ | `browser_recording` | Compile browser screencast frames into video (.webp, .gif, .mp4, .webm) |
163
+
164
+ ### Evaluation (1 tool)
165
+
166
+ | Tool | Description |
167
+ |------|-------------|
168
+ | `browser_eval` | Run arbitrary JS via CDP Runtime.evaluate. On `weavetab://` pages, supports building UIs via `wt-dashboard-command` events |
169
+
170
+ ### Performance (1 tool)
171
+
172
+ | Tool | Description |
173
+ |------|-------------|
174
+ | `browser_performance` | Core Web Vitals, memory, navigation timing, and resource timings |
175
+
176
+ ### GitHub Automation (Plugin)
177
+
178
+ GitHub support is no longer a built-in tool. It is provided by the official `@weavetab/plugin-github` plugin, which registers a single `github` tool (actions: `analyze`, `read`, `issues`, `pr`). Install it with `weavetab plugin add @weavetab/plugin-github`.
179
+
180
+ ### Utility (3 tools)
181
+
182
+ | Tool | Description |
183
+ |------|-------------|
184
+ | `browser_checkpoint` | Snapshot and restore browser state (cookies, storage, scroll/URL) into named checkpoints for time-travel and rollback |
185
+ | `browser_pattern_learn` | Read, register, and update named workflow patterns and site quirks per origin |
186
+ | `browser_office` | Parse Word (`.docx`), Excel (`.xlsx`), PDF, and CSV files into structured data |
187
+
188
+ ---
189
+
190
+ ## Secrets Management
191
+
192
+ Secrets are stored in structured `secrets.json` files with `chmod 600` enforcement and atomic file writes (temp file + rename).
193
+
194
+ ### Resolution Order
195
+
196
+ 1. `./.weavetab/secrets.json` (project-scoped, opt-in via `weavetab secrets init --project`)
197
+ 2. `~/.weavetab/secrets.json` (global default)
198
+
199
+ > **Note:** The legacy `.env`-based `EnvSecretProvider` is **deprecated and no longer supported**. All secrets must use `secrets.json`.
200
+
201
+ ### CLI Commands
202
+
203
+ ```bash
204
+ weavetab secrets set MY_KEY # Prompts for value securely
205
+ weavetab secrets list # Shows keys + domains only (never values)
206
+ weavetab secrets rm MY_KEY # Remove a secret
207
+ weavetab secrets init --project # Create project-scoped secrets + config
208
+ ```
209
+
210
+ ### Secrets File Format
211
+
212
+ ```json
213
+ {
214
+ "API_KEY": {
215
+ "value": "sk-...",
216
+ "domains": ["api.example.com"],
217
+ "description": "Production API key"
218
+ }
219
+ }
220
+ ```
221
+
222
+ ### Blind Injection
223
+
224
+ Use `browser_type_secret` to inject credentials without exposing them to the LLM:
225
+
226
+ ```typescript
227
+ browser_type_secret({
228
+ id: "w:1",
229
+ envKey: "API_KEY"
230
+ })
231
+ ```
232
+
233
+ The value is permanently masked as `[REDACTED]` in all subsequent DOM reads and audit logs.
234
+
235
+ ---
236
+
237
+ ## Configuration
238
+
239
+ ### Config File Locations
240
+
241
+ - **Global:** `~/.weavetab/config.json`
242
+ - **Project:** `./.weavetab/config.json` (if exists, takes precedence)
243
+
244
+ ### Config Structure
245
+
246
+ ```json
247
+ {
248
+ "browserType": "chromium",
249
+ "headless": false,
250
+ "devMode": true,
251
+ "maxActionsPerMinute": 60,
252
+ "role": "admin",
253
+ "telemetry": false,
254
+ "attachPort": 0,
255
+ "extension": true,
256
+ "cookies": false,
257
+ "browserFlags": [],
258
+ "policies": [],
259
+ "electron": {
260
+ "discord": "C:\\Users\\<user>\\AppData\\Local\\Discord\\app-<version>\\Discord.exe",
261
+ "antigravity": "C:\\Users\\<user>\\AppData\\Local\\Programs\\antigravity\\Antigravity.exe",
262
+ "vscode": "C:\\Users\\<user>\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe"
263
+ }
264
+ }
265
+ ```
266
+
267
+ ### Configuration Options
268
+
269
+ | Option | Type | Default | Description |
270
+ |--------|------|---------|-------------|
271
+ | `browserType` | string | "chromium" | Browser to use (chromium, firefox, webkit) |
272
+ | `headless` | boolean | false | Run browser in headless mode |
273
+ | `devMode` | boolean | false | Enable HUD overlay and verbose logging |
274
+ | `maxActionsPerMinute` | number | 60 | Rate limit for tool executions |
275
+ | `role` | string | "admin" | RBAC role (admin, operator, viewer, automation, system) |
276
+ | `telemetry` | boolean | false | Enable anonymous usage telemetry |
277
+ | `attachPort` | number | 0 | Chrome DevTools Protocol port |
278
+ | `extension` | boolean | true | Enable Weavetab extension integration |
279
+ | `cookies` | boolean | false | Persist cookies/storage across sessions. When `false`, `document.cookie`, `localStorage`, and `sessionStorage` are all neutered at the browser level (returns empty/null for everything) + a fresh isolated profile is used each session. When `true`, cookies/storage work normally and persist via the profile directory. |
280
+ | `browserFlags` | string[] | `[]` | Extra Chromium command-line flags to append on launch (e.g., `["--disable-web-security"]`). The `--disable-sync` flag is mandatory and cannot be overridden — any conflicting flag is automatically dropped. |
281
+ | `policies` | PolicyEntry[] | `[]` | Domain-level access control policies (see [Domain Policy](#domain-policy) below). Supersedes the legacy `block`/`allow` lists. |
282
+ | `electron` | Record<string, string> | `{}` | Map of registered Electron desktop applications (e.g. Discord, VS Code, Figma, Antigravity, local dev apps) to executable paths or startup commands. |
283
+
284
+ ---
285
+
286
+ ## Domain Policy
287
+
288
+ The `policies` config option provides **fine-grained domain-level access control** that supersedes the legacy `block`/`allow` lists. Policies are checked **in array order** before every tool execution — the first matching pattern wins. If no policy matches, the legacy `block`/`allow` lists are checked as fallback, then access is allowed by default.
289
+
290
+ Configure policies in your `config.json` under the top-level `policies` array:
291
+
292
+ ```json
293
+ {
294
+ "policies": [
295
+ {
296
+ "pattern": "*.banking.com",
297
+ "mode": "deny"
298
+ },
299
+ {
300
+ "pattern": "banking.com",
301
+ "mode": "allow"
302
+ },
303
+ {
304
+ "pattern": "*.internal.com",
305
+ "mode": "read-only"
306
+ },
307
+ {
308
+ "pattern": "*.trusted.com",
309
+ "mode": "allow"
310
+ },
311
+ {
312
+ "pattern": "*.audit-logs.com",
313
+ "mode": "audit-only"
314
+ }
315
+ ]
316
+ }
317
+ ```
318
+
319
+ ### Policy Modes
320
+
321
+ | Mode | Description |
322
+ |------|-------------|
323
+ | `allow` | Full access to all tools. Explicitly whitelists a domain. |
324
+ | `read-only` | Only observation tools allowed: map, find, scrape, console, eval, inspect, snapshot, pdf, cookies. Blocks write tools (click, type, navigate, etc.). |
325
+ | `deny` | Complete block of all interactions on that domain. |
326
+ | `audit-only` | All tools allowed, but every action is logged for audit trails. |
327
+
328
+ ### Key Differences from `block`/`allow` Lists
329
+
330
+ | Feature | Legacy `block`/`allow` | `policies` |
331
+ |---------|----------------------|------------|
332
+ | Modes | Only allow or deny | 4 modes: allow, deny, read-only, audit-only |
333
+ | Wildcards | Supported | Supported (`*` wildcard) |
334
+ | Order | No ordering | **First match wins** — order matters |
335
+ | Granularity | Domain only | Domain + per-tool enforcement (read-only blocks writes) |
336
+ | Check timing | At navigation | Every tool execution |
337
+
338
+ ---
339
+
340
+ ## RBAC Roles
341
+
342
+ ### Role Definitions
343
+
344
+ | Role | Permissions |
345
+ |------|-------------|
346
+ | `admin` | Full access to all tools |
347
+ | `operator` | Full access to all tools (standard agent role) |
348
+ | `viewer` | Read-only observation tools only (`browser_map`, `browser_find`, `browser_scrape`, `browser_console`, `browser_eval`, `browser_inspect`, `browser_extract_design`, `browser_snapshot`, `browser_screenshot`, `browser_pdf`, `browser_cookies`, `browser_tabs`, `browser_wait`, `browser_pattern_learn`) |
349
+ | `automation` | Full access except `browser_thoughts` (non-interactive CI/CD mode) |
350
+ | `system` | Internal tools only (`browser_thoughts`, `browser_detect`, `browser_performance`, `browser_checkpoint`, `browser_pattern_learn`) |
351
+
352
+ ### Setting Role
353
+
354
+ ```json
355
+ {
356
+ "role": "viewer"
357
+ }
358
+ ```
359
+
360
+ ---
361
+
362
+ ## Performance Optimization
363
+
364
+ ### Token Efficiency
365
+
366
+ Use `browser_map` with delta and pruning for maximum efficiency:
367
+
368
+ ```typescript
369
+ // First call: full map
370
+ browser_map({ prune: true })
371
+
372
+ // Subsequent calls: only changes
373
+ browser_map({ delta: true, prune: true })
374
+ ```
375
+
376
+ ### Latency Optimization
377
+
378
+ - Use `speed: "fast"` on `browser_scroll` and `profile: "fast"` on `browser_type` for faster execution
379
+ - Enable `prune: true` to reduce DOM processing time
380
+ - Use cached ref IDs instead of label-based lookups
381
+ - Avoid unnecessary DOM walks with `browser_find` for text search
382
+
383
+ ### Memory Optimization
384
+
385
+ - Clear cache periodically: `weavetab reset`
386
+ - Use `limit` parameter in `browser_map` to reduce cache size
387
+ - Enable `prune: true` to reduce memory footprint
388
+ - Restart Weavetab for long-running sessions
389
+
390
+ ---
391
+
392
+ ## Plugin System
393
+
394
+ ### Creating a Plugin
395
+
396
+ Create any npm package with a `weavetab.json` manifest at its root:
397
+
398
+ ```json
399
+ // my-plugin/package.json
400
+ {
401
+ "name": "wt-my-tool",
402
+ "version": "1.0.0",
403
+ "main": "index.js",
404
+ "type": "module"
405
+ }
406
+ ```
407
+
408
+ ```json
409
+ // my-plugin/weavetab.json
410
+ {
411
+ "name": "My Custom Tool",
412
+ "version": "1.0.0",
413
+ "description": "Custom MCP tool for Weavetab",
414
+ "tools": [
415
+ {
416
+ "name": "my_custom_tool",
417
+ "description": "My custom tool description"
418
+ }
419
+ ]
420
+ }
421
+ ```
422
+
423
+ ```typescript
424
+ // my-plugin/index.ts
425
+ import { definePlugin, type PluginContext } from "@weavetab/sdk";
426
+
427
+ export default definePlugin({
428
+ name: "wt-my-tool",
429
+
430
+ async onLoad(ctx: PluginContext) {
431
+ ctx.mcp.registerTool({
432
+ name: "my_custom_tool",
433
+ description: "My custom tool description",
434
+ schema: {
435
+ type: "object",
436
+ properties: { query: { type: "string" } },
437
+ required: ["query"]
438
+ },
439
+ handler: async (args, session) => {
440
+ return { content: [{ type: "text", text: "result" }] };
441
+ }
442
+ });
443
+ }
444
+ });
445
+ ```
446
+
447
+ ### Installing Plugins
448
+
449
+ ```bash
450
+ # Official plugins
451
+ weavetab plugin add @weavetab/plugin-sample
452
+
453
+ # Community plugins (any npm name)
454
+ weavetab plugin add wt-my-tool
455
+ # or via npm
456
+ npm install wt-my-tool
457
+ ```
458
+
459
+ Plugins with a valid `weavetab.json` are automatically discovered on Weavetab startup.
460
+
461
+ ---
462
+
463
+ ## Weavetab Skills
464
+
465
+ ### Using Skills
466
+
467
+ Skills provide pre-built workflow patterns that help agents understand complex multi-step operations:
468
+
469
+ ```bash
470
+ npm install -g @weavetab/skills
471
+ ```
472
+
473
+ ### Available Skills
474
+
475
+ - **Form Automation** — Handles complex forms with validation, multi-page flows, and error recovery
476
+ - **E-commerce** — Shopping cart navigation, product selection, checkout processes
477
+ - **Data Extraction** — Structured scraping, pagination handling, data export
478
+ - **CMS Workflows** — WordPress, Drupal, and other CMS-specific operations
479
+ - **API Testing** — Endpoint discovery, request/response validation, test automation
480
+
481
+ ### Skill Integration
482
+
483
+ Skills are automatically discovered by MCP clients and provide:
484
+
485
+ - Context-aware workflow guidance
486
+ - Step-by-step mission templates
487
+ - Error handling patterns
488
+ - Best practice recommendations
489
+
490
+ ---
491
+
492
+ ## Electron & Desktop Application Automation
493
+
494
+ Weavetab natively supports **generic automation of any Electron or Chromium-based desktop application** (e.g. Discord, Slack, VS Code, Antigravity IDE, Figma, Obsidian, Postman, or local developer applications running from source).
495
+
496
+ ### Why It Works at Layer 0
497
+ Electron desktop applications run a bundled Chromium/Blink engine under the hood. When started with Chrome DevTools Protocol debugging enabled (either automatically via Weavetab or via `--remote-debugging-port`), Weavetab connects directly to the desktop app's internal WebSockets and exposes all 41 built-in MCP tools without requiring external drivers or wrappers.
498
+
499
+ ### Registering Applications
500
+ In `~/.weavetab/config.json` or project-scoped `.weavetab/config.json`:
501
+
502
+ ```json
503
+ {
504
+ "electron": {
505
+ "discord": "C:\\Users\\<user>\\AppData\\Local\\Discord\\app-1.0.9183\\Discord.exe",
506
+ "antigravity": "C:\\Users\\<user>\\AppData\\Local\\Programs\\antigravity\\Antigravity.exe",
507
+ "vscode": "C:\\Users\\<user>\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe",
508
+ "figma": "C:\\Users\\<user>\\AppData\\Local\\Figma\\Figma.exe",
509
+ "obsidian": "C:\\Users\\<user>\\AppData\\Local\\Obsidian\\Obsidian.exe",
510
+ "my-app": "C:\\path\\to\\my-project\\node_modules\\electron\\dist\\electron.exe"
511
+ }
512
+ }
513
+ ```
514
+
515
+ ### Automating Local / Source-Hosted Projects
516
+ When developing an Electron app locally (e.g. `localhost:3000` or running via Vite/Webpack/Electron forge):
517
+
518
+ 1. **Launch with remote debugging enabled:**
519
+ ```bash
520
+ npx electron . --remote-debugging-port=9222
521
+ # or with npm scripts:
522
+ npm run dev -- --remote-debugging-port=9222
523
+ ```
524
+
525
+ 2. **Automate via MCP tools:**
526
+ Set `"attachPort": 9222` or register the dev script in `"electron"` config.
527
+
528
+ ### Tool Execution Flow with Desktop Apps
529
+ Every Weavetab tool supports the optional `app` parameter:
530
+
531
+ | Tool Call | Desktop Behavior |
532
+ | :--- | :--- |
533
+ | `browser_navigate({ app: "antigravity" })` | Launches or connects to Antigravity's CDP session |
534
+ | `browser_tabs({ action: "list", app: "antigravity" })` | Lists all windows, webviews, and workbench tabs in the app |
535
+ | `browser_tabs({ action: "switch", tabId: "<id>", app: "antigravity" })` | Switches active focus to the specified workbench or window |
536
+ | `browser_map({ app: "antigravity" })` | Generates semantic Ref IDs (`w:NN`) for the desktop app's active window |
537
+ | `browser_click({ ref: "w:12", app: "antigravity" })` | Sends Ghost Cursor click to the desktop app element |
538
+ | `browser_type({ ref: "w:15", text: "...", app: "discord" })` | Types text directly into the desktop app input field |
539
+ | `browser_eval({ expression: "...", app: "vscode" })` | Evaluates JavaScript inside the desktop app frame context |
540
+
541
+ ---
542
+
543
+ ## Troubleshooting
544
+
545
+ ### Common Issues
546
+
547
+ 1. **CDP connection failed** — Ensure Chrome is running with `--remote-debugging-port=9222`
548
+ 2. **Extension not loading** — Use headed mode or `--headless=new` Chrome flag
549
+ 3. **High memory usage** — Clear cache with `weavetab reset` or enable pruning
550
+ 4. **Token usage high** — Use `delta: true` and `prune: true` in `browser_map`
551
+ 5. **Clicks failing** — Use ref IDs from `browser_map` instead of labels
552
+
553
+ ### Debug Mode
554
+
555
+ Enable `devMode: true` in config for:
556
+
557
+ - Real-time tool execution timing
558
+ - Token usage estimates
559
+ - Detailed error messages
560
+ - HUD overlay in browser
561
+
562
+ ### Audit Logs
563
+
564
+ Review the latest `~/.weavetab-system/logs/mission_<timestamp>.log` for:
565
+
566
+ - Tool invocation history
567
+ - Error messages and stack traces
568
+ - Domain policy violations
569
+ - Security events
570
+
571
+ For detailed troubleshooting, see [TROUBLESHOOTING.md](../TROUBLESHOOTING.md).
572
+
573
+ ---
574
+
575
+ ## Additional Resources
576
+
577
+ - [Tool Reference](tools/tools.md)
578
+ - [Plugin System Guide](PLUGINS.md)
579
+ - [Architecture Documentation](../ARCHITECTURE.md)
580
+ - [Support & Community](../SUPPORT.md)
581
+ - [Security Policy](../SECURITY.md)
582
+ - [Contributing Guidelines](../CONTRIBUTING.md)
583
+ - [Troubleshooting Guide](../TROUBLESHOOTING.md)