diff --git a/extension/src/ui/connect.tsx b/extension/src/ui/connect.tsx index e9e410e..69a95c1 100644 --- a/extension/src/ui/connect.tsx +++ b/extension/src/ui/connect.tsx @@ -44,8 +44,18 @@ const ConnectApp: React.FC = () => { const relayUrl = params.get('mcpRelayUrl'); if (!relayUrl) { - setShowButtons(false); - setStatus({ type: 'error', message: 'Missing mcpRelayUrl parameter in URL.' }); + handleReject('Missing mcpRelayUrl parameter in URL.'); + return; + } + + try { + const host = new URL(relayUrl).hostname; + if (host !== '127.0.0.1' && host !== '[::1]') { + handleReject(`MCP extension only allows loopback connections (127.0.0.1 or [::1]). Received host: ${host}`); + return; + } + } catch (e) { + handleReject(`Invalid mcpRelayUrl parameter in URL: ${relayUrl}. ${e}`); return; }