Skip to main content
Glama

What is this?

MCP Apps is the MCP extension that lets a server ship a small web page along with a tool. The host (Claude, for example) renders that page in a sandboxed iframe inside the conversation, and the page can talk back.

This repo is the smallest useful example I could write, plus one that shows off:

Tool

What you get

show_hello_widget

A counter that receives the tool's input, calls the server, and drafts a message to Claude

render_3d_scene

An animated three.js scene built from a JSON spec, drawn while the model is still writing it

get_server_time

A plain tool that the counter widget calls by itself

Related MCP server: claude-mcp-render-local-widgets

Quick start

git clone https://github.com/zainulabidin302/mcp-apps-playground.git
cd mcp-apps-playground
npm install

Add the server to Claude Desktop (Settings → Developer → Edit Config):

{
  "mcpServers": {
    "hello-mcp-app": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-apps-playground/server.js"]
    }
  }
}

Restart Claude Desktop, then try:

Use show_hello_widget to greet Sara, starting at 3.

Use render_3d_scene to build a neon solar system: a glowing sun, three planets orbiting it, one with a moon, and a galaxy behind.

How it works

An MCP App has three parts. Two of them are ordinary MCP.

1. A UI resource: one HTML file under a ui:// address.

server.registerResource("hello-widget", "ui://hello/widget.html",
  { mimeType: "text/html;profile=mcp-app" },
  async () => ({ contents: [{ uri, mimeType, text: html }] }));

2. A tool that points to it: this is the whole link.

server.registerTool("show_hello_widget", {
  inputSchema: { name: z.string() },
  _meta: { ui: { resourceUri: "ui://hello/widget.html" } },
}, async ({ name, start = 0 }) => ({
  content: [{ type: "text", text: `Widget for ${name}` }], // fallback for hosts with no UI
  structuredContent: { name, start },                      // data for the view
}));

3. The view: the page listens, then talks back.

const app = new App({ name: "hello-widget" });

app.ontoolinput  = ({ arguments: a }) => setTitle(a.name);        // what the model sent
app.ontoolresult = (r) => setCount(r.structuredContent.start);    // what the server returned

await app.callServerTool({ name: "get_server_time" });            // view -> server
await app.sendMessage({ role: "user", content: [/* ... */] });    // view -> chat

await app.connect();

Always return useful content as well: a host that does not render views shows only that text.

Things I learned the hard way

  • sendMessage does not post silently. In Claude Desktop it drafts the message and asks you before sending.

  • The view gets no network by default. server.js inlines the App SDK (and three.js, via esbuild) into one <script>, so the page needs no CSP allowances.

  • ontoolinputpartial fires while the model is still writing the arguments. The 3D scene uses it to add objects one by one. It is about ten lines.

The anim3d spec

render_3d_scene takes a declarative scene:

{
  "title": "Neon solar system", "background": "#02010a", "stars": 2000, "bloom": 1.4,
  "camera": { "position": [0, 4, 9], "autoRotate": 0.4 },
  "objects": [
    { "shape": "sphere", "material": "glow", "color": "#ffaa33", "scale": 1.6,
      "animate": [{ "type": "pulse", "amount": 0.05 }],
      "children": [
        { "shape": "sphere", "color": "#3399ff", "scale": 0.35,
          "animate": [{ "type": "orbit", "radius": 2.2, "speed": 0.8 }] }
      ] },
    { "shape": "galaxy", "count": 20000, "radius": 6, "color": "#ff66cc", "color2": "#3344ff",
      "position": [0, -1.5, 0], "animate": [{ "type": "spin", "speed": 0.1 }] }
  ]
}
  • Shapes: box, sphere, torus, torusKnot, cone, cylinder, icosahedron, octahedron, dodecahedron, tetrahedron, ring, plane, capsule, particles, galaxy

  • Materials: standard, glow (works with bloom), glass, wire, toon

  • Animations (stackable): spin, float, bounce, orbit, pulse, colorCycle, wobble, wave (plane only)

  • children are positioned and animated relative to their parent, e.g. moons orbiting planets.

createStage(container, spec) from src/anim3d.js also works on its own in any page.

Ship it

  • Local bundle: npm run pack builds a .mcpb file from manifest.json that Claude Desktop can install. Pack it on the platform you will run it on, because esbuild ships a native binary. The manifest validates and packs; I have not tested installing the bundle yet.

  • Remote connector: the same server behind a URL also works in Claude on the web and on mobile. That needs an HTTP transport in place of stdio, which this repo does not include.

Project layout

server.js            MCP server: resources, tools, and the HTML bundling
widget.html          the counter view
scene.html           shell for the 3D view
src/scene-widget.js  3D view: App SDK wiring
src/anim3d.js        tiny declarative layer over three.js
manifest.json        MCP Bundle manifest

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to respond to users with live, persistent, interactive web apps served at a single URL that evolve in place as the conversation continues. It exposes UI generation and evolution tools over MCP so agent responses can include clickable buttons and streaming interfaces alongside chat replies.
      24 PyPI
      4
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Exposes a catalog of fast, single-purpose interactive widgets as MCP tools with sandboxed iframe apps, letting AI agents invoke them over Streamable HTTP alongside a login-free human playground. Includes tool discovery, embeddable widget views, and auto-generated discovery metadata.
      1
      MIT