Overview
Thesunpeak build command creates optimized, production-ready bundles for your MCP Resources. Each Resource file is built as a separate, standalone HTML bundle.
Output
The build process creates:- HTML - Optimized and compressed for minimal file size
- CSS extraction - Unused Tailwind styles removed automatically
- Asset optimization - Static assets with hashed filenames for caching
- Source maps - For debugging production issues
Output Directory
src/resources/{name}/ is built to dist/{name}/, containing the HTML bundle and metadata. The .json file is extracted from the resource export in your .tsx file. Simulation files are not included in the build output.
Tool & Server Compilation
In addition to resource HTML bundles, the build compiles server-side code:- Tools — Each
src/tools/*.tsfile is compiled via esbuild todist/tools/{name}.js. These are ESM bundles with relative imports resolved andnode_modulesresolved at runtime. - Server entry — If
src/server.tsexists, it’s compiled todist/server.js.
sunpeak start to run your production MCP server.
Automatic Discovery
The build automatically discovers and builds all resource folders:src/resources/search/→dist/search/search.html+dist/search/search.jsonsrc/resources/calendar/→dist/calendar/calendar.html+dist/calendar/calendar.json
Metadata JSON Files
The build extracts theresource export from each .tsx file and writes it to a JSON file with a generated uri field:
uri is generated using the resource name and a build timestamp for cache invalidation.
App Identity
Each built resource is wrapped in anAppProvider that identifies the app to the host during the ui/initialize handshake. The name and version are read from your project’s package.json:
search, calendar, and map resources will all report appInfo: { name: "my-weather-app", version: "1.2.0" } to the host.
Build Optimizations
Tree Shaking
Unused code is automatically removed from the bundle:CSS Purging
Tailwind CSS automatically removes unused utility classes:- Only classes actually used in your components are included
- Significantly reduces CSS file size
- No manual configuration required
Usage
Next Steps
After building, start the production server or deploy:sunpeak start
Start the production MCP server.
Deployment Guide
Deploy your app to production.