Focused Apps SDK + MCP example centered on Pizzaz widgets.
index.ts- MCP server entrypoint (SSE + tool wiring)tools/- MCP tool definitions (one file per tool)utils/- generic MCP server plumbing/helpersui/- React widget source codeassets/- built widget HTML/JS/CSS outputbuild-all.mts- widget production build scriptvite.config.mts- local widget dev server config
- Node.js 18+
- pnpm
pnpm installOptional local config:
cp .env.example .envMCP_PORTcontrols MCP server port (default8000)
Recommend installing the OpenAI developer docs MCP server.
Server URL (streamable HTTP): https://developers.openai.com/mcp
codex mcp add openaiDeveloperDocs --url https://developers.openai.com/mcp
codex mcp listAlternative config in ~/.codex/config.toml:
[mcp_servers.openaiDeveloperDocs]
url = "https://developers.openai.com/mcp"Add this instruction to AGENTS guidance when working with OpenAI platform topics:
Always use the OpenAI developer documentation MCP server if you need to work with the OpenAI API, ChatGPT Apps SDK, Codex,… without me having to explicitly ask.
Run everything with one command:
pnpm run devThis does:
- initial asset build
- UI rebuild watch on
ui/** - MCP server watch/restart on backend changes
- serves widget assets from MCP server at
/assets/* - serves latest widget template HTML from disk on each resource read, so UI-only changes are reflected without restarting MCP
To expose MCP publicly, run ngrok separately:
pnpm run dev
# in another terminal:
ngrok http 8000Build widget assets:
pnpm run buildRun MCP server:
pnpm run mcp:startRun MCP server in watch mode:
pnpm run mcp:devRun Vite UI dev server only:
pnpm run dev:viteOptional separate static asset serving (not needed for normal MCP dev):
BASE_URL=http://localhost:4444 pnpm run build
pnpm run serveDefault (MCP_PORT=8000):
GET /mcpPOST /mcp/messages?sessionId=...GET /assets/*
Run the MCP app locally:
pnpm run devIn a separate terminal, expose it with ngrok:
ngrok http 8000Then add this MCP URL in ChatGPT developer mode:
https://<your-tunnel-domain>/mcp
If assets are hosted elsewhere, override BASE_URL when building:
BASE_URL=https://your-server.com pnpm run build