Index of every page on this site: llms.txt
All skills
mcp-use avatar

/mcp-apps-builder

@338b9a7 official
by Manufactmcp-use/mcp-use11k stars
1,535
Run it yourself

Build, modify, debug, migrate, review, or verify TypeScript MCP servers and MCP Apps with mcp-use. Use for tools, resources, prompts, middleware, Views, authentication, Skills over MCP, scaffolding, and advanced features.

Use this Skill: https://skilld.dev/gh/mcp-use/mcp-use/mcp-apps-builder

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesviews.md

≈1.4k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Views

Bind a View

Create views/<name>/view.tsx. Export the rendering tool ref, declare its outputSchema, bind view: { name }, and return matching structuredContent. The directory name and view.name must match exactly.

Use result content for a concise model-readable summary, structuredContent for typed render data, and _meta for invocation-specific data that should be visible only to the View.

Read the rendering call

Destructure useToolContext() and narrow its discriminated lifecycle before reading toolOutput:

import { useToolContext } from "mcp-use/react";

export default function ProductResults() {
  const { status, toolInput, toolOutput, error, meta } =
    useToolContext<"search-products">();

  if (status === "pending") {
    return <SearchSkeleton query={toolInput?.query} />;
  }

  if (status === "error") {
    return <ErrorBanner message={error.message} />;
  }

  const source = typeof meta?.source === "string" ? meta.source : undefined;
  return <Results items={toolOutput.items} source={source} />;
}

toolInput may be partial while pending. Treat meta as untyped external data and validate or narrow it before use.

Choose the interaction channel

  • useCallTool("tool-name"): call an exported server tool with inferred types.
  • useDynamicTool: call a runtime-generated tool when no static ref exists.
  • useSendFollowUp: request a new model turn.
  • useOpenExternal: ask the host to open a URL outside the sandbox.
  • useDisplayMode: inspect and request a supported presentation mode.
  • useViewTool: expose a temporary action that operates on the mounted UI.
  • useFiles: use host file capabilities after checking support.

Guard host actions with useHostContext() capability signals. A host may reject or modify a request, so render pending and failure states and read the resulting host state.

State and model context

  • Use React state for ephemeral UI details the model does not need.
  • Use useViewState(objectDefault) for JSON-serializable selections, filters, drafts, or progress that future model turns should understand.
  • Use <ModelContext content="..."> to describe currently visible UI declaratively.
  • Store durable business data in the backend, not View state.

Do not put secrets or large render-only payloads into model-visible state. Keep _uiContext reserved for the runtime.

Presentation, assets, and CSP

Use ThemeProvider, ViewControls, useViewTheme, or viewConfig only when their behavior is needed; the runtime bootstraps the host bridge and enables automatic resizing by default. A named viewConfig may restrict supported display modes or disable automatic resize.

Keep View code and CSS under its View folder. Put shared public files in public/ and resolve them through the framework's public asset base rather than a hard-coded localhost URL.

Declare exact external origins in view.csp:

  • connectDomains for fetch, EventSource, and WebSocket.
  • resourceDomains for scripts, styles, images, fonts, and media.
  • frameDomains for embedded frames.
  • baseUriDomains only for an intentional external base URI.

UI origin, endpoint identity, and host metadata

For SDK versions with automatic endpoint-based Claude domains, configure the UI origin on the tool: view: { name: "wave", domain: "https://wavebyvento.com" }. Set MCP_URL=https://wave-by-vento.run.mcp-use.com and server basePath: "/mcp". ChatGPT receives ui.domain: "https://wavebyvento.com"; Claude receives the first 32 hex characters of SHA-256 of the full https://wave-by-vento.run.mcp-use.com/mcp endpoint plus .claudemcpcontent.com. Do not hash the website or asset origin.

Inspect the installed SDK: older versions hash view.domain itself. Upgrade to endpoint-based handling before removing an existing compatibility helper. Do not invent uiOrigin or mcpEndpoint config fields.

For View domain resolution, origin-only MCP_URL appends basePath; a URL with a path is the full endpoint, preserved verbatim. With OAuth, use origin-only MCP_URL because OAuth configuration requires it. Without MCP_URL, the SDK uses the request path/query and forwarded/request origin. Set the public URL explicitly when a proxy rewrites paths. MCP_ASSETS_URL controls assets, never Claude identity.

HTTP(S) view.domain URLs normalize to origins. Use an HTTPS origin without /mcp for ChatGPT. Precomputed Claude domains remain supported but are Claude-only; replace them with the UI origin for cross-host apps. Omitting view.domain keeps host defaults. Without an HTTP request or MCP_URL, Claude falls back to the authored domain.

Remove helpers that overwrite generated resource _meta.ui.domain after next(); they clobber Claude conversion. Preserve generated ui fields when adding unrelated metadata. Configure the resource through view.domain, not tool _meta or tool result _meta. Generated resources use standard ui.domain only. On manually authored ChatGPT resources, openai/widgetDomain is an alias, not an override for an invalid ui.domain; keep both consistent if both are emitted. Custom resources and response middleware remain author-controlled.

frameDomains allows nested iframes inside the View. It does not set the View origin or fix domain validation. Add it only for actual nested embeds.

Verify resources/read for ChatGPT and Claude, including an endpoint with /mcp and a UI origin on another host. Claude detection uses advertised client name, falling back to User-Agent when no name is present; unknown clients receive the UI origin. Do not claim host publishing validation from SDK tests alone.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning11d5 checks · Risk SAFE
  • Gen Agent Trust Hub11d

    This skill provides comprehensive instructions for building and maintaining TypeScript MCP servers using the mcp-use framework, including scaffolding, authentication, and UI components.

  • Socket11d

    No alerts

  • Snyk11d

    Risk: LOW · No issues

  • Runlayer8mo

    6/20 files flagged

  • ZeroLeaks6mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 338b9a7. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 6 days ago.

Activeupdated 2 weeks ago
  • MCP
  • TypeScript
  • mcp-use
  • server
  • tools
  • resources
  • prompts
  • widgets
  • authentication

README badge

README badge for mcp-use/mcp-use/mcp-apps-builder

Provides architecture patterns, best practices, and reference guides for building MCP servers with the mcp-use framework, covering tools, resources, prompts, widgets, authentication, and deployment. Essential reading before implementing any MCP server feature—use the navigation guide to find the specific reference file for your task.

Generated from the current SKILL.md.

Is this skill for building MCP servers or using them?
This skill is for building MCP servers with mcp-use. It provides architecture patterns, authentication setup, and implementation guides for tools, resources, prompts, and widgets.
Do I need to read all the reference files before starting?
No. Start with concepts.md and architecture.md for foundations, then read only the specific reference file for the feature you're implementing (e.g., tools.md for creating a tool, authentication/overview.md for adding auth).
Can I manually create MCP server boilerplate instead of using the CLI?
No. Always use `npx create-mcp-use-app` to scaffold new projects. The CLI sets up TypeScript, dev scripts, inspector integration, and widget compilation that are difficult to replicate manually.
How do I test my MCP server without the inspector UI?
Use the `mcp-use client` CLI tool to drive your server from the terminal. Commands like `npx mcp-use client connect dev http://localhost:3000/mcp` let you list and call tools directly, optionally saving a screenshot with `--screenshot`.
Does this cover widget development?
Yes. The skill includes guides for building React-based widgets covering basics, state management, interactivity, theming, file uploads, and keeping the AI model aware of UI state.

Generated from the current SKILL.md. These answers refresh after source changes.