A starter template for building ChatGPT apps with interactive widgets using MCP (Model Context Protocol) on Val Town.
Visit your deployment URL to get the MCP endpoint
Add to ChatGPT:
Test in ChatGPT:
list_messages
- Shows all messages in an interactive widgetadd_message
- Adds a new message and shows updated listget_message
- Shows details for a specific messageTools return discriminated unions that drive widget navigation:
{ kind: "message_list", messages: [...] } // → /list route
{ kind: "message_detail", id: 1, ... } // → /detail/:id route
The widget automatically navigates based on the kind
field.
backend/mcp/server.ts
shared/types.ts
frontend/widgets/routes.tsx
NavigationSync.tsx
to handle new kind