mrt_bundle_push
Creates a bundle from a pre-built PWA Kit or Storefront Next project and pushes it to Managed Runtime (MRT). Optionally deploys to a target environment after push.
Overview
The mrt_bundle_push tool bundles a pre-built project and uploads it to Managed Runtime. It:
- Reads the build directory (default:
./build). - Creates a bundle with server-only files (SSR) and shared files.
- Pushes the bundle to Managed Runtime.
- Optionally deploys to a target environment (staging or production).
Important: The project must already be built (e.g., npm run build completed) before using this tool.
This tool is shared across the MRT, PWAV3, and STOREFRONTNEXT toolsets.
Authentication
Requires Managed Runtime (MRT) credentials. See MRT Credentials for complete details.
Configuration priority:
- Flags (
--api-key,--project,--environment) - Environment variables (
SFCC_MRT_API_KEY,SFCC_MRT_PROJECT,SFCC_MRT_ENVIRONMENT) ~/.mobifyconfig file (or~/.mobify--[hostname]if--cloud-originis set)
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
buildDirectory | string | No | ./build | Path to build directory containing the built project files. Can be absolute or relative to the project directory. |
message | string | No | None | Deployment message to include with the bundle push. Useful for tracking deployments. |
ssrOnly | string | No | ssr.js,ssr.mjs,server/**/* | Comma-separated glob patterns for server-only files (SSR). These files are only included in the server bundle. |
ssrShared | string | No | static/**/*,client/**/* | Comma-separated glob patterns for shared files. These files are included in both server and client bundles. |
deploy | boolean | No | false | Whether to deploy to an environment after push. When true, environment must be provided via --environment flag or SFCC_MRT_ENVIRONMENT. |
Usage Examples
Push Bundle Only
Push a bundle without deploying:
Use the MCP tool to push the bundle from ./build directory to Managed Runtime.Push and Deploy to Staging
Push a bundle and deploy to staging:
Use the MCP tool to build and push my Storefront Next bundle to staging.Push and Deploy to Production
Push a bundle and deploy to production with a message:
Use the MCP tool to deploy my PWA Kit or Storefront Next bundle to production with a deployment message.Custom Build Directory
Push from a custom build directory:
Use the MCP tool to push the bundle from ./dist directory to Managed Runtime.Output
Returns a push result object containing:
bundleId- Unique identifier for the pushed bundleprojectSlug- MRT project slugtarget- Target environment (if deployed)deployed- Whether the bundle was deployed (ifdeploy: true)message- Deployment message (if provided)
Requirements
- Pre-built project (run
npm run buildor equivalent first) - MRT API key configured
- MRT project slug configured
- Valid build directory with required files
Error Handling
The tool throws an error if:
projectisn’t provided (required)deploy: truebutenvironmentisn’t provided- Build directory doesn’t exist or is invalid
- MRT API authentication fails
- Bundle push fails
Related Tools
- Part of the MRT, PWAV3, and STOREFRONTNEXT toolsets
- Auto-enabled for PWA Kit v3 and Storefront Next projects
See Also
- MRT Toolset - Overview of Managed Runtime tools
- Authentication Setup - Set up MRT API key
- Configuration - Configure MRT credentials
- CLI Reference - Equivalent CLI command:
b2c mrt bundle push