3 min read

Drawing a Project Card Inside Claude with MCP Apps

  • MCP
  • AI Agents
  • Claude
  • Cloudflare Workers

This site's MCP server at /mcp already let an assistant read my projects, posts and site stats as text. MCP Apps go one step further: a tool can come with a small interface that the client draws in the conversation. I added two. show_project draws a project card, and show_status draws the status panel with the uptime strip, Web Vitals and API latency.

What it took

  • A view per tool. Each app tool points to an HTML resource built with the @modelcontextprotocol/ext-apps SDK. The card and the panel draw from the same data the text tools return, so there is one source of truth.
  • Typed results. Every tool now declares an outputSchema and returns structuredContent. The card reads those typed fields instead of parsing text.
  • A stable origin. Claude serves each app's view from its own sandboxed origin, derived from the server's address. The resource declares that domain and the one CDN its script loads from, so the sandbox's Content-Security-Policy lets it run.
  • Not much weight. The first app added about 4.3 KiB to the Worker.

No directory listing was needed. Added as a custom connector, the cards render in Claude marked "Unverified", which is honest for a server nobody has reviewed.

The stale tool list

The second app was a tenth tool, and Claude Desktop kept listing nine after I reconnected. The server was right; the client was holding on to the old list. I had added the tool without changing the server's version. Bumping the version to 1.2.0 and starting a new chat fixed it. A test now ties the version to the tool list, so adding a tool without a bump fails the build.

The model can't see the card

The model in the chat never sees the interface it triggers. Whatever Claude says about the card is not evidence that it appeared, because the model only sees the tool's data. The only test is to look at the screen.

The same blind spot made answers repetitive: Claude would draw the card and then restate everything on it. The tool's description now tells the model that where the client shows the card, the user already sees it, so it should add a sentence at most.

Try it

In Claude, add a custom connector with the address https://andernet.dev/mcp and sign-in off, then ask to see one of my projects or how the site is doing. The tools only read, the server needs no account, and in clients without MCP Apps the same tools answer in plain text.