{"record":{"id":"af22ae4e6d3b45bc","repo":"vercel/ai","slug":"unsupported-mcp-app-resource-mime-type-content","errorCode":null,"errorMessage":"Unsupported MCP App resource MIME type: ${content.mimeType}","messagePattern":"Unsupported MCP App resource MIME type: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mcp/src/tool/mcp-apps.ts","lineNumber":244,"sourceCode":"\n/**\n * Extracts app HTML and rendering metadata from a `resources/read` result.\n */\nexport function getMCPAppResourceFromReadResult({\n  uri,\n  resource,\n}: {\n  uri: string;\n  resource: ReadResourceResult;\n}): MCPAppResource {\n  const content = resource.contents.find(content => content.uri === uri);\n\n  if (content == null) {\n    throw new Error(`MCP App resource not found in read result: ${uri}`);\n  }\n\n  if (content.mimeType !== MCP_APP_MIME_TYPE) {\n    throw new Error(\n      `Unsupported MCP App resource MIME type: ${content.mimeType}`,\n    );\n  }\n\n  const html =\n    'text' in content && typeof content.text === 'string'\n      ? content.text\n      : 'blob' in content && typeof content.blob === 'string'\n        ? new TextDecoder().decode(convertBase64ToUint8Array(content.blob))\n        : undefined;\n\n  if (html == null) {\n    throw new Error(`Unsupported MCP App resource content format: ${uri}`);\n  }\n\n  const meta = getResourceUiMeta(content._meta);\n\n  return { uri, mimeType: MCP_APP_MIME_TYPE, html, meta };","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/mcp/src/tool/mcp-apps.ts#L226-L262","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Fix the MCP server so the ui:// resource is served with mimeType 'text/html;profile=mcp-app' (the MCP App MIME type).","Verify the URI actually refers to an MCP App resource (_meta ui resource annotation), not an ordinary resource.","Check for a server-side version mismatch and update the MCP server to a version that implements MCP Apps correctly.","As a workaround, read the resource via client.readResource directly and handle the content yourself."],"exampleFix":"// before (server serving wrong type)\n{ uri: 'ui://widget/gauge', mimeType: 'text/plain', text: '<html>...' }\n// after (server fix)\n{ uri: 'ui://widget/gauge', mimeType: 'text/html;profile=mcp-app', text: '<html>...', _meta: { ui: { ... } } }","handlingStrategy":"type-guard","validationCode":"const uriOk = typeof uri === 'string' && uri.startsWith('ui://');\nconst isAppResource = (c: { mimeType?: string }) => c.mimeType === 'text/html;profile=mcp-app';","typeGuard":"function isMCPAppContent(c: unknown): c is { uri: string; mimeType: string; text?: string; blob?: string } {\n  return !!c && typeof c === 'object' && 'mimeType' in c && (c as any).mimeType === 'text/html;profile=mcp-app';\n}","tryCatchPattern":"try {\n  const res = await readMCPAppResource({ client, uri });\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Unsupported MCP App resource MIME type')) {\n    // render fallback UI or skip this tool's app\n  } else throw e;\n}","preventionTips":["Only read resources advertised via tool _meta ui resourceUri annotations","Verify server implements MCP Apps spec with the correct MIME type","Test resource reads against the server during integration setup"],"tags":["mcp","mcp-apps","mime-type","resource"],"backgroundTag":"unsupported-mime-type","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}