Unsupported resource
; -} -``` - -This pattern allows the `HtmlResource` component to handle mimeType-based rendering internally, making your code more future-proof as new content types (like `application/javascript`) are added. - -## Backwards Compatibility - -The `HtmlResource` component maintains backwards compatibility with the legacy `ui-app://` URI scheme: - -- **Legacy Support**: Resources with `ui-app://` URIs are automatically treated as URL content (equivalent to `mimeType: 'text/uri-list'`) even when they have the historically incorrect `mimeType: 'text/html'` -- **Automatic Detection**: The component detects legacy URIs and processes them correctly without requiring code changes -- **MimeType Override**: Ignores the incorrect `text/html` mimeType and treats content as URLs -- **Migration Encouragement**: A warning is logged when legacy URIs are detected, encouraging server updates -- **Seamless Transition**: Existing clients continue working with older servers during migration periods - -### Legacy URI Handling - -```tsx -// Both patterns work identically: -// Legacy (automatically detected and corrected): -Временная метка: ${new Date().toISOString()}
`; + +const resourceBlock = createHtmlResource({ + uri: 'ui://server-generated/item1', + content: { type: 'rawHtml', htmlString: myHtmlPayload }, + delivery: 'text', +}); + + +// Отправьте этот resourceBlock как часть вашего ответа MCP... +``` + +### В проекте React (Пример на стороне клиента) + +```tsx +// App.tsx (ваше приложение React) +import React, { useState, useEffect } from 'react'; +import { HtmlResource } from '@mcp-ui/client'; + +// Фиктивная структура ответа MCP +interface McpToolResponse { + content: HtmlResource[]; +} + +function App() { + const [mcpData, setMcpData] = useStateНеподдерживаемый элемент контента
; + })} +