Public
Like
1
ChatAppSDKStarter
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
index.ts
https://laurynas--0199cd92ced671e8a8db90fbd3a88d30.web.val.run
A starter template for building ChatGPT apps with interactive widgets using MCP (Model Context Protocol) on Val Town.
- Backend: Hono + MCP Lite + Drizzle ORM + SQLite
- Widget: React 19 + TanStack Router + OpenAI App SDK
-
Visit your deployment URL to get the MCP endpoint
-
Add to ChatGPT:
- Open ChatGPT settings → Apps & Connectors -> Create (you will need developer mode enabled)
- Add MCP server with your endpoint URL
-
Test in ChatGPT:
- "List all messages"
- "Add a message: Hello!"
- "Show me message #1"
list_messages
- Shows all messages in an interactive widgetadd_message
- Adds a new message and shows updated listget_message
- Shows details for a specific message
Tools 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.
- Add tool in
backend/mcp/server.ts
- Define output schema in
shared/types.ts
- Create widget route in
frontend/widgets/routes.tsx
- Update
NavigationSync.tsx
to handle newkind