Hello MCP is a remix of OpenAI's hello-realtime demo that adds Model Context Protocol (MCP) support for server-side tool execution.
This demo showcases:
getFavoriteFood
tool to demonstrate MCP functionalityIf you remix the app, you'll just need to pop in your own OPENAI_API_KEY
(from
platform.openai.com).
MCP enables server-side tool execution, keeping your business logic and API keys secure on the server rather than exposing them to the client.
Try asking questions like:
The tool knows about: Thomas, Brian, Emil, Yana, Alex, Max, Justin, and Sam.
Standard WebRTC Flow:
/rtc
endpoint handles SDP negotiation with OpenAIMCP-Enhanced Flow (when enabled):
/mcp
)GET /
- serves the WebRTC-based app with MCP togglePOST /rtc
- creates a new WebRTC-based Realtime API session (with optional ?mcp=true
)POST /sip
- handles an incoming Realtime API SIP callPOST /observer
- internal endpoint to establish a Realtime API websocket for session controlPOST /mcp
- MCP protocol endpoint for tool discovery and executionGET /mcp/tools
- Debug endpoint to list available tools├── frontend/
│ └── index.html # HTML/JS application for WebRTC with MCP support
├── main.tsx # Main entrypoint for the val.town app
└── routes/
|── mcp.ts # MCP protocol handler with getFavoriteFood tool
|── observer.ts # Server-side session control for SIP & WebRTC
|── rtc.ts # WebRTC session setup with MCP configuration
|── sip.ts # SIP webhook handling and session setup
└── utils.ts # Realtime API session configuration with MCP support
The MCP implementation follows the JSON-RPC 2.0 specification:
{ "method": "initialize", "params": { "protocolVersion": "2025-06-18" } }
{ "method": "tools/list", "result": { "tools": [...] } }
{ "method": "tools/call", "params": { "name": "getFavoriteFood", "arguments": { "name": "Thomas" } } }