From b06fc47d290dec1b5aeccd577752434ff3203440 Mon Sep 17 00:00:00 2001 From: b3nw Date: Thu, 21 May 2026 14:55:42 +0000 Subject: [PATCH] fix: use hardcoded default base URL for report_url fallback The SCHWAB_MCP_BASE_URL env var may not be set in all deployment environments. Default to https://schwab-mcp.ext.ben.io so the report_url enrichment works out of the box. --- server.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server.py b/server.py index 39d354c..716ace1 100644 --- a/server.py +++ b/server.py @@ -69,6 +69,8 @@ try: except Exception: _startup_logger.info("schwab-scraper package version: (unknown)") +_DEFAULT_BASE_URL = "https://schwab-mcp.ext.ben.io" + # --------------------------------------------------------------------------- # Log capture helper — captures scraper logs to a string buffer AND tees @@ -477,9 +479,8 @@ async def get_morningstar_data(ticker: str, debug: bool = False) -> str: ): data = result["data"] if hasattr(data, "report_url") and data.report_url is None and data.source is not None: - base = os.getenv("SCHWAB_MCP_BASE_URL", "").rstrip("/") - if base: - data.report_url = f"{base}/reports/{ticker.upper()}/pdf" + base = os.getenv("SCHWAB_MCP_BASE_URL", _DEFAULT_BASE_URL).rstrip("/") + data.report_url = f"{base}/reports/{ticker.upper()}/pdf" return serialize(result)