From d91c1c53698693878fe0497c3dc20c5a35ce11bd Mon Sep 17 00:00:00 2001 From: riverLethe <865192079@qq.com> Date: Fri, 25 Jul 2025 23:02:24 +0800 Subject: [PATCH] feat/ui-0.22:set static NEXT_PUBLIC_MCP_URL --- frontend/next.config.js | 4 ---- frontend/src/components/theme/ProductDetailThemeSelector.tsx | 2 +- frontend/src/shared/components/marketplace/ServerConfig.tsx | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/frontend/next.config.js b/frontend/next.config.js index fa334c9..cda7e23 100644 --- a/frontend/next.config.js +++ b/frontend/next.config.js @@ -29,10 +29,6 @@ const nextConfig = { source: "/uploads/:path*", destination: `${process.env.NEXT_PUBLIC_API_URL || "http://127.0.0.1:8001"}/uploads/:path*`, }, - { - source: "/mcp/:path*", - destination: `${process.env.NEXT_PUBLIC_MCP_URL || "http://127.0.0.1:8002"}/mcp/:path*`, - }, ]; }, diff --git a/frontend/src/components/theme/ProductDetailThemeSelector.tsx b/frontend/src/components/theme/ProductDetailThemeSelector.tsx index 67e54ce..828530b 100644 --- a/frontend/src/components/theme/ProductDetailThemeSelector.tsx +++ b/frontend/src/components/theme/ProductDetailThemeSelector.tsx @@ -30,7 +30,7 @@ export const ProductDetailThemeSelector: React.FC< const [mcpName, setMcpName] = useState(""); useEffect(() => { if (url || !product.slug_name) return; - setUrl(`${window.location.origin}/mcp/${product.slug_name}`); + setUrl(`${window.location.protocol}//${window.location.hostname}:8002/mcp/${product.slug_name}`); }, [product.slug_name]); function sanitizeMCPServerName(rawName: string | undefined): string { if (!rawName) return "xpack-mcp-service"; diff --git a/frontend/src/shared/components/marketplace/ServerConfig.tsx b/frontend/src/shared/components/marketplace/ServerConfig.tsx index f443b32..43db7b1 100644 --- a/frontend/src/shared/components/marketplace/ServerConfig.tsx +++ b/frontend/src/shared/components/marketplace/ServerConfig.tsx @@ -21,7 +21,7 @@ export const ServerConfig: React.FC = ({ product, mcpName }) const [url, setUrl] = useState(process.env.NEXT_PUBLIC_MCP_URL || ""); useEffect(() => { if (url || !product.slug_name) return - setUrl(`${window.location.origin}/mcp/${product.slug_name}`); + setUrl(`${window.location.protocol}//${window.location.hostname}:8002/mcp/${product.slug_name}`); }, [product.slug_name]);