āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā š shadcn/directory/brennenrocks/utilcn/chatgpt-app/setup ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
Before you install the frontend or backend blocks, read the official <Link href="https://developers.openai.com/apps-sdk">ChatGPT Apps SDK documentation</Link>. It covers the platform concepts, hosting requirements, and deployment workflow this example builds on.
This example ships a single MCP tool named add. The tool:
{ a, b, sum }.Once the frontend build script runs and the backend starts, ChatGPT will display a card that shows both operands and their computed sum when the add tool is invoked.
Install the frontend block. Add the <Link href="/docs/chatgpt-app/frontend">chatgpt-app frontend</Link> to your project so you get index.jsx, the widget hooks, and build-chatgpt-widgets.ts.
Build the widget assets. Run the build script to emit hashed HTML, CSS, and JS bundles under your configured assets/ directory:
pnpm tsx build-chatgpt-widgets.ts
Re-run this command whenever you change the widget UI.
Install the backend block. Add the <Link href="/docs/chatgpt-app/backend">chatgpt-app-backend</Link> files so you can host mcp-server.ts, register the add tool, and serve the widget HTML.
Expose the MCP server. Start mcp-server.ts, then use ngrok (or a similar tunnel) to forward the port:
pnpm tsx mcp-server.ts
ngrok http 8000
Copy the HTTPS ngrok URL and note the /mcp SSE endpoint.
Connect the app inside ChatGPT.
https://your-ngrok-url/mcp.Test the experience. Ask ChatGPT to use your new app. When the add tool runs, it will prompt for two numbers and render the widget that displays both inputs and their sum.

ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā