Skip to main content

Build for Production

Build your app for production using the Sunpeak CLI:
sunpeak build
This generates optimized JavaScript bundles in your dist/ directory. Each resource gets its own bundle file that can be served by your MCP server.

Publish to ChatGPT

Publish your MCP App to ChatGPT via the OpenAI Platform.

Prerequisites

  • A ChatGPT App created on the OpenAI Platform
  • Your MCP server configured and accessible to ChatGPT
  • Built resources (run sunpeak build)

Serving Resources

Your production MCP server needs to serve the built resource bundles. The resources should be accessible via HTTP(S) URLs that ChatGPT can fetch. Example server setup:
import { readFileSync, readdirSync } from 'fs';
import { join } from 'path';

// Load all built resources
const distDir = './dist';
const files = readdirSync(distDir).filter(f => f.endsWith('.js'));

const resources = files.map(file => {
  const name = file.replace('.js', '');
  const bundle = readFileSync(join(distDir, file), 'utf-8');
  return { name, bundle };
});

Environment Variables

Configure your production environment:
  • Set appropriate CSP (Content Security Policy) for your resources
  • Configure CORS if serving from a different domain
  • Set up HTTPS for secure communication
See the MCP Server guide for more details on setting up your production MCP server.