A minimal MCP App Server example with the UI HTML inlined directly in the server code.
This example demonstrates the simplest possible MCP App setup:
- Single-file server with inlined HTML UI
- No build step required (directly import the
@modelcontextprotocol/ext-appspackage from unpkg.com) - Tool registration with linked UI resource
server.ts- MCP server with inlined HTML UIserver-utils.ts- HTTP/stdio transport utilities
npm install
npm startThe server will start on http://localhost:3001/mcp.
- The server defines the UI HTML as a template string directly in the code
- A resource handler returns this HTML when the UI resource is requested
- A tool is registered that links to this UI resource via
_meta.ui.resourceUri - When the tool is invoked, the Host fetches and renders the inlined UI
This pattern is ideal for:
- Quick prototyping
- Simple tools with minimal UI
- Embedding servers in other applications
- Testing and development