vercel/ai · error · Error

Unsupported MCP App resource MIME type: ${content.mimeType}

Error message

Unsupported MCP App resource MIME type: ${content.mimeType}

What it means

Thrown by getMCPAppResourceFromReadResult when the MCP App resource found in a resources/read result does not have the required MCP Apps MIME type (text/html + ui:// profile). MCP Apps are served as HTML resources, so the client only accepts resources advertised with that MIME type. Any other mimeType means the server is not returning a renderable MCP App resource.

Source

Thrown at packages/mcp/src/tool/mcp-apps.ts:244

/**
 * Extracts app HTML and rendering metadata from a `resources/read` result.
 */
export function getMCPAppResourceFromReadResult({
  uri,
  resource,
}: {
  uri: string;
  resource: ReadResourceResult;
}): MCPAppResource {
  const content = resource.contents.find(content => content.uri === uri);

  if (content == null) {
    throw new Error(`MCP App resource not found in read result: ${uri}`);
  }

  if (content.mimeType !== MCP_APP_MIME_TYPE) {
    throw new Error(
      `Unsupported MCP App resource MIME type: ${content.mimeType}`,
    );
  }

  const html =
    'text' in content && typeof content.text === 'string'
      ? content.text
      : 'blob' in content && typeof content.blob === 'string'
        ? new TextDecoder().decode(convertBase64ToUint8Array(content.blob))
        : undefined;

  if (html == null) {
    throw new Error(`Unsupported MCP App resource content format: ${uri}`);
  }

  const meta = getResourceUiMeta(content._meta);

  return { uri, mimeType: MCP_APP_MIME_TYPE, html, meta };

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Fix the MCP server so the ui:// resource is served with mimeType 'text/html;profile=mcp-app' (the MCP App MIME type).
  2. Verify the URI actually refers to an MCP App resource (_meta ui resource annotation), not an ordinary resource.
  3. Check for a server-side version mismatch and update the MCP server to a version that implements MCP Apps correctly.
  4. As a workaround, read the resource via client.readResource directly and handle the content yourself.

Example fix

// before (server serving wrong type)
{ uri: 'ui://widget/gauge', mimeType: 'text/plain', text: '<html>...' }
// after (server fix)
{ uri: 'ui://widget/gauge', mimeType: 'text/html;profile=mcp-app', text: '<html>...', _meta: { ui: { ... } } }
Defensive patterns

Strategy: type-guard

Validate before calling

const uriOk = typeof uri === 'string' && uri.startsWith('ui://');
const isAppResource = (c: { mimeType?: string }) => c.mimeType === 'text/html;profile=mcp-app';

Type guard

function isMCPAppContent(c: unknown): c is { uri: string; mimeType: string; text?: string; blob?: string } {
  return !!c && typeof c === 'object' && 'mimeType' in c && (c as any).mimeType === 'text/html;profile=mcp-app';
}

Try / catch

try {
  const res = await readMCPAppResource({ client, uri });
} catch (e) {
  if (e instanceof Error && e.message.startsWith('Unsupported MCP App resource MIME type')) {
    // render fallback UI or skip this tool's app
  } else throw e;
}

Prevention

When it happens

Trigger: Calling readMCPAppResource (or the resource() method) with a ui:// URI whose read result content has a mimeType other than MCP_APP_MIME_TYPE (e.g. text/plain, application/json, text/richtext).

Common situations: The MCP server serves the UI resource with a plain or wrong MIME type; the server implements MCP Apps incompletely; a server update changed the resource mimeType; the developer points at a normal (non-app) resource URI returned by a tool annotation.

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/af22ae4e6d3b45bc. Report an issue: GitHub.