Skip to content

Commit ddb292a

Browse files
committed
fix: handle server-side rendering in InspectorIframe component
1 parent 0988b03 commit ddb292a

File tree

1 file changed

+9
-0
lines changed
  • app/web/pages/mcpServer/components/inspectorIframe

1 file changed

+9
-0
lines changed

app/web/pages/mcpServer/components/inspectorIframe/index.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ interface InspectorIframeProps {
1515
}
1616

1717
const createQueryString = (config?: InspectorConfig) => {
18+
if (typeof location === 'undefined') {
19+
return '';
20+
}
21+
1822
const queryParams: Record<string, string> = {
1923
MCP_PROXY_PORT: mcpInspectorServerPort.toString(),
2024
transport: config?.transport || 'streamable-http',
@@ -31,6 +35,11 @@ const createQueryString = (config?: InspectorConfig) => {
3135
const InspectorIframe = ({ config }: InspectorIframeProps) => {
3236
const queryString = useMemo(() => createQueryString(config), [config]);
3337

38+
// 仅在客户端渲染 iframe
39+
if (typeof location === 'undefined') {
40+
return null;
41+
}
42+
3443
return (
3544
<div className="mcp-inspector-iframe" style={{ minHeight: 800, height: 800 }}>
3645
<iframe

0 commit comments

Comments
 (0)