Skip to content

Commit 6ff9b68

Browse files
committed
fix(client): styling
1 parent d8a4b14 commit 6ff9b68

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

packages/client/src/components/HtmlResource.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ import type { Resource } from '@modelcontextprotocol/sdk/types.js';
44
export interface RenderHtmlResourceProps {
55
resource: Partial<Resource>;
66
onGenericMcpAction: (tool: string, params: Record<string, unknown>) => Promise<unknown>;
7+
style?: React.CSSProperties;
78
}
89

910
export 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

Comments
 (0)