extension_build
Build a browser extension for production.
Quick start
Build this extension for Chrome and Firefox
Asked to build for two browsers, the agent builds and reads the output folder by folder.
How the agent uses it
This tool always passes --browser (chrome unless you set it), so the output lands in dist/<browser>/ (dist/chrome by default) and the answer's outputPath always names the folder that was written (the engine's reported path, else dist/<browser> under the package root, the same folder this tool checked for the manifest), with zipPath beside it when a zip was asked for: read those paths instead of assuming one. To know what is in the build (sizes, entry points, the checks a store reviewer runs) call extension_analyze on the same projectPath and browser instead of listing or reading the output folder by hand; the answer's hint says so. A scaffolded project's own npm run build runs extension build with no --browser, which the engine defaults to chromium, so that script writes dist/chromium/ instead. Pass zip:true to also package a .zip for store submission. With browser:'safari' the build converts the extension into a macOS app through Xcode, and bundleId sets the identifier it ships under. The build refuses a manifest with build-blocking errors unless you pass skipValidation:true, because such a manifest yields a broken bundle the bundler itself never flags.
Reference
| Group | local, on by default |
| Tier | Create and build |
| Needs | none |
| Read only | no |
| Destructive | no |
| Idempotent | yes |
| Reaches the open web | no |
Inputs
| Input | Type | Required | Default | What it does |
|---|---|---|---|---|
projectPath | string | yes | Extension project root | |
browser | "chrome" | "chromium" | "edge" | "brave" | "opera" | "vivaldi" | "yandex" | "firefox" | "waterfox" | "librewolf" | "zen" | "floorp" | "safari" | "chromium-based" | "gecko-based" | "firefox-based" | "webkit-based" | no | "chrome" | |
zip | boolean | no | false | Create a .zip file for store distribution |
zipSource | boolean | no | false | Include source code zip (required by some stores) |
zipFilename | string | no | Custom .zip file name (defaults to name and version) | |
polyfill | boolean | no | false | Apply cross-browser polyfill |
silent | boolean | no | false | Suppress build output |
mode | "development" | "production" | "none" | no | "production" | Bundler mode override (also sets NODE_ENV) |
skipValidation | boolean | no | false | Build even when extension_manifest_validate reports build-blocking errors. The build normally refuses: the engine itself stops only on missing scripts, icons, DNR rule files, default_locale and manifest_version, and ships a bundle over the rest. |
appName | string | no | Safari targets only: name of the generated macOS app, which also names the Xcode scheme and the .app on disk. Defaults to the manifest name. | |
bundleId | string | no | Safari targets only: a reverse-DNS bundle identifier you own, such as com.acme.readinglist. Without one the app is packaged under a generated dev.extensionjs.* identifier derived from the app name, which two projects with the same name share, and the first team to register it takes it. | |
macOsOnly | boolean | no | true | Safari targets only: generate a macOS-only Xcode project. Pass false for a universal project that also targets iOS and iPadOS, which is what you want if the extension ships on iPhone or iPad. |
forceRegenerate | boolean | no | false | Safari targets only: regenerate the Xcode project even when the engine considers it up to date. Use it when an earlier packaging run left the project broken. |
Next
- MCP server: install, the two groups and the session gates
- Install in your client
extension_add_feature: Plan the surface before adding an options page, a popup, a side panel, a content script, a devtools panel, a new tab page or a background script to an existing extension.extension_create: Create a browser extension project from a template in the extension.dev catalog.extension_docs_search: Find the docs page to cite before answering any question about a WebExtension API, a manifest key, a permission, or a difference between Chrome, Firefox, Edge and Safari.extension_templates: Browse the extension.dev template catalog.