{"record":{"id":"d1b101be0e058e14","repo":"vercel/ai","slug":"unsupported-mcp-app-resource-uri-uri","errorCode":null,"errorMessage":"Unsupported MCP App resource URI: ${uri}","messagePattern":"Unsupported MCP App resource URI: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mcp/src/tool/mcp-apps.ts","lineNumber":278,"sourceCode":"  const meta = getResourceUiMeta(content._meta);\n\n  return { uri, mimeType: MCP_APP_MIME_TYPE, html, meta };\n}\n\n/**\n * Reads a `ui://` resource from an MCP server and normalizes it for rendering.\n */\nexport async function readMCPAppResource({\n  client,\n  uri,\n  options,\n}: {\n  client: Pick<MCPClient, 'readResource'>;\n  uri: string;\n  options?: RequestOptions;\n}): Promise<MCPAppResource> {\n  if (!uri.startsWith('ui://')) {\n    throw new Error(`Unsupported MCP App resource URI: ${uri}`);\n  }\n\n  return getMCPAppResourceFromReadResult({\n    uri,\n    resource: await client.readResource({ uri, options }),\n  });\n}\n","sourceCodeStart":260,"sourceCodeEnd":286,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/mcp/src/tool/mcp-apps.ts#L260-L286","documentation":"Thrown by readMCPAppResource when the given URI does not start with the 'ui://' scheme. Only ui:// URIs are treated as MCP App resources; anything else is rejected before a resources/read request is made.","triggerScenarios":"Passing a file://, https://, or other non-ui:// URI (e.g. a tool output resource URI or a typo like 'ui:/') to readMCPAppResource or resource().","commonSituations":"Developer accidentally reads a regular MCP resource as an app; a tool annotation returns an ordinary resource URI; typo in the scheme; mixing up MCP Apps resources with standard MCP resources.","solutions":["Only pass URIs extracted via getMCPAppResourceUris or from tool _meta ui resourceUri fields, which are ui:// by spec.","Check the URI string for typos in the scheme (must be exactly 'ui://').","If you need a non-app resource, use client.readResource directly instead of readMCPAppResource."],"exampleFix":"// before\nawait readMCPAppResource({ client, uri: 'https://example.com/widget.html' });\n// after\nawait readMCPAppResource({ client, uri: 'ui://widget/gauge.html' });","handlingStrategy":"validation","validationCode":"if (!uri.startsWith('ui://')) {\n  throw new Error(`Expected ui:// MCP App resource URI, got: ${uri}`);\n}","typeGuard":"function isMCPAppUri(uri: string): boolean {\n  return uri.startsWith('ui://');\n}","tryCatchPattern":"try {\n  const app = await readMCPAppResource({ client, uri });\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Unsupported MCP App resource URI')) {\n    // fall back to client.readResource for non-app resources\n  } else throw e;\n}","preventionTips":["Derive app URIs from getMCPAppResourceUris instead of hand-writing them","Check the scheme with a helper before calling readMCPAppResource","Don't confuse standard MCP resources with MCP App (ui://) resources"],"tags":["mcp","mcp-apps","uri","validation"],"backgroundTag":"invalid-uri-scheme","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}