@extension.dev/mcp 4.8.0 → 5.1.0

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.
@@ -13,7 +13,7 @@
13
13
  cd page-summarizer
14
14
  ```
15
15
 
16
- 2. **Define the manifest** content script for the floating button, background script for orchestration:
16
+ 2. **Define the manifest**, content script for the floating button, background script for orchestration:
17
17
 
18
18
  ```json
19
19
  {
@@ -35,7 +35,7 @@
35
35
  }
36
36
  ```
37
37
 
38
- 3. **Build the content script** inject a floating button, handle click to extract `document.body.innerText`, send to background for processing.
38
+ 3. **Build the content script**, inject a floating button, handle click to extract `document.body.innerText`, send to background for processing.
39
39
 
40
40
  4. **Test it:**
41
41
  ```bash
@@ -69,7 +69,7 @@ Firefox will ignore the `chromium:world` field and run in the default isolated w
69
69
 
70
70
  - Chromium: use `chrome.*` namespace for Chrome-specific APIs (sidePanel, etc.)
71
71
  - Firefox: use `browser.*` namespace (auto-polyfilled by the framework)
72
- - For cross-browser code: use `browser.*` when possible the polyfill maps it to `chrome.*` on Chromium
72
+ - For cross-browser code: use `browser.*` when possible, the polyfill maps it to `chrome.*` on Chromium
73
73
 
74
74
  ## Testing across browsers
75
75
 
@@ -4,13 +4,13 @@
4
4
 
5
5
  When Claude creates a new extension, follow this order:
6
6
 
7
- 1. `manifest.json` always first, defines the extension surface
8
- 2. Background script (if needed) handles browser events
9
- 3. UI entry points HTML files referenced by manifest
10
- 4. UI scripts React/Vue/Svelte components mounted into HTML
11
- 5. Styles CSS/Tailwind files imported by scripts
12
- 6. `package.json` dependencies based on what was used above
13
- 7. Config files tsconfig.json, postcss.config.js, extension.config.js only if needed
7
+ 1. `manifest.json`, always first, defines the extension surface
8
+ 2. Background script (if needed), handles browser events
9
+ 3. UI entry points, HTML files referenced by manifest
10
+ 4. UI scripts, React/Vue/Svelte components mounted into HTML
11
+ 5. Styles, CSS/Tailwind files imported by scripts
12
+ 6. `package.json`, dependencies based on what was used above
13
+ 7. Config files, tsconfig.json, postcss.config.js, extension.config.js only if needed
14
14
 
15
15
  ## manifest.json rules
16
16
 
@@ -76,8 +76,8 @@ Use `chrome.storage.local` for persistent data. It works cross-browser when the
76
76
 
77
77
  Only request permissions the extension actually needs. Common ones:
78
78
 
79
- - `sidePanel` Chromium only, for side panel UI
80
- - `storage` for chrome.storage API
81
- - `activeTab` for accessing the current tab
82
- - `tabs` for tab management
83
- - `scripting` for programmatic script injection
79
+ - `sidePanel`. Chromium only, for side panel UI
80
+ - `storage`, for chrome.storage API
81
+ - `activeTab`, for accessing the current tab
82
+ - `tabs`, for tab management
83
+ - `scripting`, for programmatic script injection
@@ -1,6 +1,6 @@
1
1
  # extension.dev MCP Tool Specification
2
2
 
3
- Design document for `@extension.dev/mcp` an MCP server that exposes extension.dev capabilities as tools for Claude Code, Claude Desktop, and any MCP-compatible client.
3
+ Design document for `@extension.dev/mcp`, an MCP server that exposes extension.dev capabilities as tools for Claude Code, Claude Desktop, and any MCP-compatible client.
4
4
 
5
5
  ## Why this matters
6
6
 
@@ -34,13 +34,13 @@ examples/tree/main/examples/<slug> via go-git-it
34
34
  go-git-it clones subtree → copies to project path → cleanup temp
35
35
  ```
36
36
 
37
- No caching every create call re-fetches from GitHub. The MCP server can improve this.
37
+ No caching, every create call re-fetches from GitHub. The MCP server can improve this.
38
38
 
39
39
  ---
40
40
 
41
41
  ## Tool inventory
42
42
 
43
- ### Tier 1 Core tools (ship first)
43
+ ### Tier 1, Core tools (ship first)
44
44
 
45
45
  These map directly to existing programmatic APIs and provide immediate value.
46
46
 
@@ -85,7 +85,7 @@ These map directly to existing programmatic APIs and provide immediate value.
85
85
 
86
86
  #### `extension_list_templates`
87
87
 
88
- **Source:** New fetches and queries `templates-meta.json`
88
+ **Source:** New, fetches and queries `templates-meta.json`
89
89
 
90
90
  **Purpose:** Search and filter the template catalog. This is how Claude discovers what starting points exist before calling `extension_create`.
91
91
 
@@ -132,7 +132,7 @@ These map directly to existing programmatic APIs and provide immediate value.
132
132
  }
133
133
  ```
134
134
 
135
- **Returns:** Array of `{ slug, description, uiFramework, surfaces, tags, difficulty, useCases, repositoryUrl, downloads }` a filtered view of `templates-meta.json`.
135
+ **Returns:** Array of `{ slug, description, uiFramework, surfaces, tags, difficulty, useCases, repositoryUrl, downloads }`, a filtered view of `templates-meta.json`.
136
136
 
137
137
  **Implementation:**
138
138
 
@@ -241,7 +241,7 @@ These map directly to existing programmatic APIs and provide immediate value.
241
241
  }
242
242
  ```
243
243
 
244
- **Returns:** `{ port, browser, pid }` long-running process, returns control info.
244
+ **Returns:** `{ port, browser, pid }`, long-running process, returns control info.
245
245
 
246
246
  ---
247
247
 
@@ -249,7 +249,7 @@ These map directly to existing programmatic APIs and provide immediate value.
249
249
 
250
250
  **Source:** `programs/extension/commands/start.ts` → `extensionBuild()` + `extensionPreview()`
251
251
 
252
- **Purpose:** Build and launch in production mode (no HMR). The "production test" workflow builds first, then opens the browser with the built output.
252
+ **Purpose:** Build and launch in production mode (no HMR). The "production test" workflow, builds first, then opens the browser with the built output.
253
253
 
254
254
  ```json
255
255
  {
@@ -292,7 +292,7 @@ These map directly to existing programmatic APIs and provide immediate value.
292
292
 
293
293
  Both `extension_start` and `extension_preview` also accept `port`, `noBrowser`, and the shared launch flags: `profile`, `startingUrl`, `chromiumBinary`, `geckoBinary`, `host`, `publicHost`, `extensions` (same shapes as on `extension_dev`).
294
294
 
295
- **Why this is distinct from dev:** `dev` uses HMR and watches files. `start` builds once in production mode and launches what you'd use to verify a production build works before publishing.
295
+ **Why this is distinct from dev:** `dev` uses HMR and watches files. `start` builds once in production mode and launches, what you'd use to verify a production build works before publishing.
296
296
 
297
297
  ---
298
298
 
@@ -326,13 +326,13 @@ Both `extension_start` and `extension_preview` also accept `port`, `noBrowser`,
326
326
 
327
327
  ---
328
328
 
329
- ### Tier 2 Intelligence tools (high DX value)
329
+ ### Tier 2, Intelligence tools (high DX value)
330
330
 
331
331
  These combine extension.dev knowledge with the examples repo to make Claude _smart_ about extensions, not just a CLI wrapper.
332
332
 
333
333
  #### `extension_get_template_source`
334
334
 
335
- **Source:** New reads files from the examples repo
335
+ **Source:** New, reads files from the examples repo
336
336
 
337
337
  **Purpose:** Read the source code of a template to learn its patterns before building something similar. This is how Claude learns extension patterns by example rather than from documentation.
338
338
 
@@ -365,7 +365,7 @@ These combine extension.dev knowledge with the examples repo to make Claude _sma
365
365
  3. If `files` param is provided: fetch each file from `https://raw.githubusercontent.com/extension-js/examples/main/examples/<slug>/<file>`
366
366
  4. Return file contents alongside the template metadata for context
367
367
 
368
- **Why this matters:** When a user says "add a sidebar like the shadcn example," Claude can read the actual `sidebar-shadcn` source its manifest structure, background script pattern, component layout and replicate it accurately. The examples repo becomes a living pattern library for Claude.
368
+ **Why this matters:** When a user says "add a sidebar like the shadcn example," Claude can read the actual `sidebar-shadcn` source (its manifest structure, background script pattern, component layout) and replicate it accurately. The examples repo becomes a living pattern library for Claude.
369
369
 
370
370
  **Advanced pattern learning:** Complex content script patterns (multi-level imports, MAIN world) can be learned from `content-multi-one-entry`, `content-multi-three-entries`, and `content-main-world` example sources.
371
371
 
@@ -373,7 +373,7 @@ These combine extension.dev knowledge with the examples repo to make Claude _sma
373
373
 
374
374
  #### `extension_manifest_validate`
375
375
 
376
- **Source:** New tool wraps manifest parsing logic from `plugin-web-extension`
376
+ **Source:** New tool, wraps manifest parsing logic from `plugin-web-extension`
377
377
 
378
378
  **Purpose:** Validate and explain issues in a manifest.json.
379
379
 
@@ -402,7 +402,7 @@ These combine extension.dev knowledge with the examples repo to make Claude _sma
402
402
 
403
403
  **Returns:** `{ valid, errors[], warnings[], browserSupport: { chrome: {}, firefox: {} }, similarTemplates[] }`
404
404
 
405
- The `similarTemplates` field lists templates from the catalog with similar surfaces/permissions useful for cross-referencing a known-good example.
405
+ The `similarTemplates` field lists templates from the catalog with similar surfaces/permissions, useful for cross-referencing a known-good example.
406
406
 
407
407
  ---
408
408
 
@@ -444,7 +444,7 @@ The `similarTemplates` field lists templates from the catalog with similar surfa
444
444
 
445
445
  #### `extension_add_feature`
446
446
 
447
- **Source:** New tool codegen based on examples repo patterns
447
+ **Source:** New tool, codegen based on examples repo patterns
448
448
 
449
449
  **Purpose:** Add a feature surface to an existing extension (sidebar, content script, popup, options page, etc.)
450
450
 
@@ -484,7 +484,7 @@ The `similarTemplates` field lists templates from the catalog with similar surfa
484
484
  }
485
485
  ```
486
486
 
487
- **Implementation:** Internally calls `extension_get_template_source` to fetch the canonical pattern for the requested surface+framework combination, then generates the files and updates manifest.json. The examples repo is the codegen source not hard-coded templates.
487
+ **Implementation:** Internally calls `extension_get_template_source` to fetch the canonical pattern for the requested surface+framework combination, then generates the files and updates manifest.json. The examples repo is the codegen source, not hard-coded templates.
488
488
 
489
489
  ---
490
490
 
@@ -512,7 +512,7 @@ The `similarTemplates` field lists templates from the catalog with similar surfa
512
512
  "probe": {
513
513
  "type": "array",
514
514
  "items": { "type": "string" },
515
- "description": "CSS selectors to query returns element counts and samples for each"
515
+ "description": "CSS selectors to query. Returns element counts and samples for each"
516
516
  },
517
517
  "include": {
518
518
  "type": "array",
@@ -571,9 +571,9 @@ The `similarTemplates` field lists templates from the catalog with similar surfa
571
571
 
572
572
  - Chromium: Uses the existing CDP client (`CDPClient.evaluate()`, `CDPClient.getPageHTML()`) via the already-running dev session's remote debugging port
573
573
  - Firefox: Uses the existing RDP transport via the already-running dev session
574
- - The `context` parameter maps to the Phase A expansion in `SESSION-SOURCE-EXTENSION-CONTEXTS.md` currently only `page` works; extension UI contexts (`options`, `sidepanel`, `popup`, etc.) are planned
574
+ - The `context` parameter maps to the Phase A expansion in `SESSION-SOURCE-EXTENSION-CONTEXTS.md`, currently only `page` works; extension UI contexts (`options`, `sidepanel`, `popup`, etc.) are planned
575
575
 
576
- **Why this is the highest-value Tier 2 tool:** Claude can't fix what it can't see. When a content script doesn't inject, when a selector doesn't match, when the console is full of errors this tool tells Claude exactly what's happening in the live browser. For complex multi-level content script chains, `probe: ["[data-extension-root]"]` instantly shows whether injection succeeded.
576
+ **Why this is the highest-value Tier 2 tool:** Claude can't fix what it can't see. When a content script doesn't inject, when a selector doesn't match, when the console is full of errors, this tool tells Claude exactly what's happening in the live browser. For complex multi-level content script chains, `probe: ["[data-extension-root]"]` instantly shows whether injection succeeded.
577
577
 
578
578
  ---
579
579
 
@@ -634,7 +634,7 @@ The `similarTemplates` field lists templates from the catalog with similar surfa
634
634
 
635
635
  **Source:** MCP `lib/process-manager` + the `ready.json` contract (no CLI verb)
636
636
 
637
- **Purpose:** Terminate a running dev/start/preview session the dev server AND the browser it launched. The lifecycle counterpart to `extension_dev`/`extension_start`.
637
+ **Purpose:** Terminate a running dev/start/preview session, the dev server AND the browser it launched. The lifecycle counterpart to `extension_dev`/`extension_start`.
638
638
 
639
639
  ```json
640
640
  {
@@ -671,7 +671,7 @@ The `similarTemplates` field lists templates from the catalog with similar surfa
671
671
 
672
672
  ---
673
673
 
674
- ### Tier 3 Browser management tools
674
+ ### Tier 3, Browser management tools
675
675
 
676
676
  #### `extension_install_browser`
677
677
 
@@ -798,31 +798,31 @@ The `similarTemplates` field lists templates from the catalog with similar surfa
798
798
 
799
799
  | MCP Tool | Program | Source API | Data source | Needs new code? |
800
800
  | ------------------------------- | -------------------- | ----------------------------------------- | ------------------------------------------- | ------------------------------------------ |
801
- | **Tier 1 Core** | | | | |
801
+ | **Tier 1, Core** | | | | |
802
802
  | `extension_create` | `programs/create` | `extensionCreate()` | examples repo via go-git-it | Thin wrapper only |
803
- | `extension_list_templates` | New | | `templates-meta.json` release asset | Fetch + filter + cache |
804
- | `extension_build` | `programs/develop` | `extensionBuild()` | | Thin wrapper only |
805
- | `extension_dev` | `programs/develop` | `extensionDev()` | | Thin wrapper + process management |
806
- | `extension_start` | `programs/extension` | `extensionBuild()` + `extensionPreview()` | | Thin wrapper (already orchestrated in CLI) |
807
- | `extension_preview` | `programs/develop` | `extensionPreview()` | | Thin wrapper only |
808
- | **Tier 2 Intelligence** | | | | |
809
- | `extension_get_template_source` | New | | `templates-meta.json` + raw GitHub | Fetch + read files |
803
+ | `extension_list_templates` | New | n/a | `templates-meta.json` release asset | Fetch + filter + cache |
804
+ | `extension_build` | `programs/develop` | `extensionBuild()` | n/a | Thin wrapper only |
805
+ | `extension_dev` | `programs/develop` | `extensionDev()` | n/a | Thin wrapper + process management |
806
+ | `extension_start` | `programs/extension` | `extensionBuild()` + `extensionPreview()` | n/a | Thin wrapper (already orchestrated in CLI) |
807
+ | `extension_preview` | `programs/develop` | `extensionPreview()` | n/a | Thin wrapper only |
808
+ | **Tier 2, Intelligence** | | | | |
809
+ | `extension_get_template_source` | New | n/a | `templates-meta.json` + raw GitHub | Fetch + read files |
810
810
  | `extension_manifest_validate` | `programs/develop` | `plugin-web-extension` | `templates-meta.json` for similar templates | Extract validation logic |
811
- | `extension_inspect` | `programs/develop` | `--source` flag logic | | Extract into callable API |
811
+ | `extension_inspect` | `programs/develop` | `--source` flag logic | n/a | Extract into callable API |
812
812
  | `extension_source_inspect` | `programs/extension` | CDP client / RDP transport | Live browser via debugging protocol | Wire to running session |
813
813
  | `extension_list_extensions` | MCP `lib/cdp` | `Extensions.getExtensionInfo` (read-only) | Live browser via CDP (Chromium) | MCP tool (no CLI verb) |
814
814
  | `extension_wait` | `programs/extension` | `dev-wait.ts` | `ready.json` contract file | Thin wrapper (exists in CLI) |
815
815
  | `extension_stop` | MCP `lib/process-manager` | session registry + group signal | Session registry + `ready.json` pid | MCP tool (no CLI verb) |
816
816
  | `extension_add_feature` | New | `extension_get_template_source` | examples repo patterns | Codegen from examples |
817
- | **Agent bridge act / triggers** | | | | |
817
+ | **Agent bridge, act / triggers** | | | | |
818
818
  | `extension_eval` | `programs/extension` | bridge control channel | Live extension context | Wraps `extension eval` (`--allow-eval`) |
819
819
  | `extension_storage` | `programs/extension` | bridge control channel | `chrome.storage` | Wraps `extension storage` |
820
820
  | `extension_reload` | `programs/extension` | bridge control channel | Live extension | Wraps `extension reload` |
821
821
  | `extension_open` | `programs/extension` | bridge control channel | Surfaces + `action`/`command` replay | Wraps `extension open` |
822
822
  | `extension_logs` | `programs/extension` | bridge log/control channel | `logs.ndjson` + live channel | Wraps `extension logs` |
823
- | **Tier 3 Browser management** | | | | |
824
- | `extension_install_browser` | `programs/install` | `extensionInstall()` | | Thin wrapper only |
825
- | `extension_list_browsers` | `programs/install` | `getManagedBrowsersCacheRoot()` | | Thin wrapper only |
823
+ | **Tier 3, Browser management** | | | | |
824
+ | `extension_install_browser` | `programs/install` | `extensionInstall()` | n/a | Thin wrapper only |
825
+ | `extension_list_browsers` | `programs/install` | `getManagedBrowsersCacheRoot()` | n/a | Thin wrapper only |
826
826
  | `extension_detect_browsers` | `programs/extension` | Binary resolution chain | System PATH + managed cache | Extract from launch logic |
827
827
 
828
828
  ## Changes needed in existing programs
@@ -846,11 +846,11 @@ The `similarTemplates` field lists templates from the catalog with similar surfa
846
846
 
847
847
  ### `programs/extension/` (CLI + browsers)
848
848
 
849
- - **`--json` flag for all commands.** Machine-readable output for every command. This benefits not just MCP but any programmatic consumer. The `--ai-help` / `--format json` flags already exist extend this pattern to command output.
849
+ - **`--json` flag for all commands.** Machine-readable output for every command. This benefits not just MCP but any programmatic consumer. The `--ai-help` / `--format json` flags already exist, extend this pattern to command output.
850
850
  - **Exit codes.** Ensure distinct exit codes for different failure modes (missing manifest, build error, browser not found, etc.)
851
851
  - **`extension list` command.** Expose `extensionListTemplates()` as a CLI command. Shows the catalog in terminal or JSON.
852
852
  - **Extract binary detection into callable API.** The browser resolution chain (managed cache → WSL → custom binary → npm location packages) is embedded in `chromium-launch/index.ts` and `firefox-launch/index.ts`. Extract into `extensionDetectBrowsers()` for the `extension_detect_browsers` MCP tool.
853
- - **Extract source inspection into MCP-callable API.** The `--source` system is deeply integrated into the browser launch lifecycle. For MCP, we need a way to call it against an _already-running_ dev session. The ready.json contract already gives us port/pid the MCP server can connect to the CDP/RDP port directly.
853
+ - **Extract source inspection into MCP-callable API.** The `--source` system is deeply integrated into the browser launch lifecycle. For MCP, we need a way to call it against an _already-running_ dev session. The ready.json contract already gives us port/pid, the MCP server can connect to the CDP/RDP port directly.
854
854
  - **Extract wait mode into callable API.** The `dev-wait.ts` logic is CLI-only. Expose `extensionWait(projectPath, browser, timeout)` as a programmatic function.
855
855
  - **Expose the `start` command programmatically.** Currently `start` is CLI-only orchestration (build then preview). Add `extensionStart()` that chains `extensionBuild()` + `extensionPreview()` with the ready.json contract.
856
856
 
@@ -929,7 +929,7 @@ These fields enable `extension_list_templates` to match user intent ("I want to
929
929
 
930
930
  1. Add `--json` output flag to build/dev/start/preview/create commands in `programs/extension`
931
931
  2. Extract manifest validation into `extensionValidateManifest()` in `programs/develop`
932
- 3. Add `extensionListTemplates(filters?)` to `programs/create` fetches and caches `templates-meta.json`
932
+ 3. Add `extensionListTemplates(filters?)` to `programs/create`, fetches and caches `templates-meta.json`
933
933
  4. Add `extension list` CLI command wrapping the above
934
934
  5. Extract browser detection into `extensionDetectBrowsers()` in `programs/extension`
935
935
  6. Extract wait mode into `extensionWait()` in `programs/extension`
@@ -945,22 +945,22 @@ These fields enable `extension_list_templates` to match user intent ("I want to
945
945
 
946
946
  ### Phase 3: Live inspection tools
947
947
 
948
- 1. `extension_wait` poll ready.json contract (gate for inspection tools)
949
- 2. `extension_source_inspect` connect to running session's CDP/RDP port for live DOM inspection
950
- 3. `extension_detect_browsers` system browser detection
951
- 4. `extension_get_template_source` reads from examples repo via raw.githubusercontent.com
952
- 5. `extension_manifest_validate` cross-browser validation + similar template suggestions
948
+ 1. `extension_wait`, poll ready.json contract (gate for inspection tools)
949
+ 2. `extension_source_inspect`, connect to running session's CDP/RDP port for live DOM inspection
950
+ 3. `extension_detect_browsers`, system browser detection
951
+ 4. `extension_get_template_source`, reads from examples repo via raw.githubusercontent.com
952
+ 5. `extension_manifest_validate`, cross-browser validation + similar template suggestions
953
953
 
954
954
  ### Phase 4: Codegen + advanced tools
955
955
 
956
- 1. `extension_inspect` static build analysis from `--source` extraction
957
- 2. `extension_add_feature` codegen sourced from examples repo patterns
956
+ 1. `extension_inspect`, static build analysis from `--source` extraction
957
+ 2. `extension_add_feature`, codegen sourced from examples repo patterns
958
958
 
959
959
  ### Phase 5: Feedback loop
960
960
 
961
961
  1. MCP server reports which templates Claude recommends most → feed into `featured` rankings
962
962
  2. Track which `aiPromptExamples` lead to successful creates → improve matching
963
- 3. New templates added to examples repo are immediately available via `extension_list_templates` (no MCP server update needed it reads `templates-meta.json` at runtime)
963
+ 3. New templates added to examples repo are immediately available via `extension_list_templates` (no MCP server update needed, it reads `templates-meta.json` at runtime)
964
964
 
965
965
  ---
966
966
 
@@ -977,7 +977,7 @@ Typical power-user workflows that drive tool prioritization:
977
977
 
978
978
  | Workflow | Tool | Why |
979
979
  | ---------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |
980
- | Debugging injection failures | `extension_source_inspect` | `probe: ["[data-extension-root]"]` shows injection state, reinject generation, console errors no manual DevTools needed |
980
+ | Debugging injection failures | `extension_source_inspect` | `probe: ["[data-extension-root]"]` shows injection state, reinject generation, console errors, no manual DevTools needed |
981
981
  | Docker/devcontainer | `extension_detect_browsers` + `extension_wait` | Check browser availability, gate on dev server readiness |
982
982
  | Multi-browser | `extension_manifest_validate` + `extension_build` | Catch manifest divergence early, build for `chrome,firefox` |
983
983
  | Learning patterns | `extension_list_templates` + `extension_get_template_source` | Read `content-multi-one-entry`, `content-multi-three-entries` for multi-level import patterns |