@@ -4,11 +4,13 @@ import type { Resource } from '@modelcontextprotocol/sdk/types.js';
44export interface RenderHtmlResourceProps {
55 resource : Partial < Resource > ;
66 onGenericMcpAction : ( tool : string , params : Record < string , unknown > ) => Promise < unknown > ;
7+ style ?: React . CSSProperties ;
78}
89
910export const HtmlResource : React . FC < RenderHtmlResourceProps > = ( {
1011 resource,
1112 onGenericMcpAction,
13+ style,
1214} ) => {
1315 const [ htmlString , setHtmlString ] = useState < string | null > ( null ) ;
1416 const [ iframeSrc , setIframeSrc ] = useState < string | null > ( null ) ;
@@ -112,7 +114,7 @@ export const HtmlResource: React.FC<RenderHtmlResourceProps> = ({
112114 ref = { iframeRef }
113115 srcDoc = { htmlString }
114116 sandbox = "allow-scripts"
115- style = { { width : '100%' , minHeight : 200 , border : '1px solid #ccc' } }
117+ style = { { width : '100%' , minHeight : 200 , ... style } }
116118 title = "MCP HTML Resource (Embedded Content)"
117119 />
118120 ) ;
@@ -127,8 +129,8 @@ export const HtmlResource: React.FC<RenderHtmlResourceProps> = ({
127129 < iframe
128130 ref = { iframeRef }
129131 src = { iframeSrc }
130- sandbox = "allow-scripts allow-same-origin" // allow-same-origin might be needed for external sites if they use it
131- style = { { width : '100%' , minHeight : 200 , border : '1px solid #ccc' } }
132+ sandbox = "allow-scripts"
133+ style = { { width : '100%' , minHeight : 200 , ... style } }
132134 title = "MCP HTML Resource (URL)"
133135 />
134136 ) ;
0 commit comments