From b76642a09be2a21374e796397ffe9dcbb47e86fc Mon Sep 17 00:00:00 2001 From: Lucio Lelii Date: Tue, 22 Sep 2026 11:59:05 +0200 Subject: [PATCH] Let the browser reach the ports an execution is actually given The allowlist still named the shared service's fixed 5173, from before the dev server handed a port per execution. Every preview would have started on a port the browser was not allowed to open, and the failure would have read as a broken application rather than as a refused origin - the kind of mismatch that is found by exhausting the other explanations first. Co-Authored-By: Claude Opus 5 (1M context) --- mcp-stack.compose.yml | 5 ++++- mcp-stack.env.example | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mcp-stack.compose.yml b/mcp-stack.compose.yml index 3f99878..1847e36 100644 --- a/mcp-stack.compose.yml +++ b/mcp-stack.compose.yml @@ -130,7 +130,10 @@ services: context: ./browser-mcp environment: BROWSER_MCP_API_KEYS: ${BROWSER_MCP_API_KEYS} - BROWSER_MCP_ALLOWED_ORIGINS: ${BROWSER_MCP_ALLOWED_ORIGINS:-http://dev-server-worker:5173} + # Both: the shared service's fixed port, and the range the per-execution ones are given. + # Keep the range aligned with DEV_SERVER_PORT_RANGE or a preview starts on a port the + # browser is not allowed to open - which reads as a broken app, not as a refused origin. + BROWSER_MCP_ALLOWED_ORIGINS: ${BROWSER_MCP_ALLOWED_ORIGINS:-http://dev-server-worker:5173,http://dev-server-worker:5200-5219} BROWSER_MCP_MAX_SESSIONS: ${BROWSER_MCP_MAX_SESSIONS:-8} user: "1000:1000" read_only: true diff --git a/mcp-stack.env.example b/mcp-stack.env.example index 40cdcf5..ab309b5 100644 --- a/mcp-stack.env.example +++ b/mcp-stack.env.example @@ -23,7 +23,7 @@ DEV_SERVER_MAX_INSTANCES=4 # Every port an execution can be given has to be reachable by the browser, and the allowlist is by # exact origin - so the range is spelled out here. Keep it aligned with DEV_SERVER_PORT_RANGE. -BROWSER_MCP_ALLOWED_ORIGINS=http://dev-server-worker:5200-5219 +BROWSER_MCP_ALLOWED_ORIGINS=http://dev-server-worker:5173,http://dev-server-worker:5200-5219 CODING_AGENT_MCP_PORT=3101 DEV_SERVER_MCP_PORT=3102