Overview
TherunMCPServer function creates an MCP server that serves your built apps to hosts like ChatGPT. It’s designed for local development and testing against real MCP App hosts.
Quick Start
sunpeak handles MCP server configuration automatically:src/tools/ and simulations from tests/simulations/, and serves the apps with automatic rebuilding.
Connecting to ChatGPT
Once your MCP server is running:Run a tunnel
Expose your local server with a tunnel:Copy the forwarding URL (e.g.,
https://abc123.ngrok.io).Connect to ChatGPT
Open ChatGPT in developer mode and connect your app:
- Go to
User > Settings > Apps & Connectors > Create. - Enter your tunnel URL with the
/mcppath:https://abc123.ngrok.io/mcp. - Complete the connection flow.
Configuration Options
MCPServerConfig
MCP server name displayed in the host.
MCP server version.
Server port. Can also be set via the
PORT environment variable.Array of simulations with built resource paths. Each simulation must include:
distPath(string, required) - Path to the built resource HTML filetool(Tool, required) - MCP Tool definitionresource(Resource, required) - MCP Resource definitiontoolResult(object, optional) - Mock response data
Server Endpoints
The MCP server exposes:| Endpoint | Method | Description |
|---|---|---|
/mcp | GET | SSE stream for MCP communication |
/mcp/messages | POST | Message endpoint for client requests |
How It Works
The dev server creates MCP Tools and Resources from your tool files and simulations:- Tools — One per simulation, using metadata from the corresponding
src/tools/file (toolconfig,schema). When called, returns the simulation’stoolResult.structuredContentas fixture data. Tool metadata includingvisibilityis preserved. - Resources — One per resource, containing the built resource HTML from
distPath(or Vite HMR HTML for local connections). Resource metadata includingpermissions,csp,prefersBorder, anddomainis preserved.
Server Helpers
For custom MCP server setups,sunpeak/mcp re-exports server helpers from the MCP Apps SDK:
sunpeak start handles production serving automatically. See the Deployment Guide for details.
See Also
MCP Server Guide
Step-by-step guide for connecting to ChatGPT.
Simulation
Complete simulation interface documentation.