diff --git a/capiscio_mcp/connect.py b/capiscio_mcp/connect.py index 2423944..b7ce4ab 100644 --- a/capiscio_mcp/connect.py +++ b/capiscio_mcp/connect.py @@ -381,7 +381,7 @@ async def connect( cached_org_id = org_id_file.read_text().strip() or None except (OSError, UnicodeDecodeError): cached_org_id = None - if cached_org_id: + if cached_org_id and "CAPISCIO_BUNDLE_URL" not in os.environ: os.environ["CAPISCIO_BUNDLE_URL"] = f"{server_url}/v1/bundles/{cached_org_id}" # Default enforcement mode to EM-GUARD when a bundle URL is configured. @@ -546,7 +546,7 @@ async def connect( # Update bundle URL if registration yielded a new/different org_id. # (API key and cached bundle URL were already set in Step 1.5 before # the Go core could be started.) - if org_id and org_id != cached_org_id: + if org_id and org_id != cached_org_id and "CAPISCIO_BUNDLE_URL" not in os.environ: os.environ["CAPISCIO_BUNDLE_URL"] = f"{server_url}/v1/bundles/{org_id}" if not os.environ.get("CAPISCIO_ENFORCEMENT_MODE"): os.environ["CAPISCIO_ENFORCEMENT_MODE"] = "EM-GUARD"