From 43af24430c15797c6a6a51a4153040deeb1bb5aa Mon Sep 17 00:00:00 2001 From: Marco Vinciguerra Date: Thu, 16 Jul 2026 15:00:21 +0200 Subject: [PATCH 1/2] feat: send User-Agent header on API requests Co-Authored-By: Claude Opus 4.8 (1M context) --- src/scrapegraph_mcp/server.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/scrapegraph_mcp/server.py b/src/scrapegraph_mcp/server.py index e5e429f..b052775 100644 --- a/src/scrapegraph_mcp/server.py +++ b/src/scrapegraph_mcp/server.py @@ -219,6 +219,7 @@ def __init__(self, api_key: str, base_url: Optional[str] = None) -> None: "SGAI-APIKEY": api_key, "Content-Type": "application/json", "accept": "application/json", + "User-Agent": f"scrapegraph-mcp/{MCP_SERVER_VERSION}", "X-SDK-Version": f"scrapegraph-mcp@{MCP_SERVER_VERSION}", } self.client = httpx.Client(timeout=httpx.Timeout(_api_timeout_s())) From a1ef44e81f5a42aeded02d60e8013dcfb601b1aa Mon Sep 17 00:00:00 2001 From: Marco Vinciguerra Date: Thu, 16 Jul 2026 15:03:43 +0200 Subject: [PATCH 2/2] fix: add ASGI type annotations to RedirectMiddleware for mypy Co-Authored-By: Claude Opus 4.8 (1M context) --- src/scrapegraph_mcp/server.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/scrapegraph_mcp/server.py b/src/scrapegraph_mcp/server.py index b052775..4eb50ca 100644 --- a/src/scrapegraph_mcp/server.py +++ b/src/scrapegraph_mcp/server.py @@ -83,6 +83,7 @@ from smithery.decorators import smithery from starlette.requests import Request from starlette.responses import JSONResponse, RedirectResponse +from starlette.types import ASGIApp, Receive, Scope, Send # Configure logging logging.basicConfig( @@ -111,18 +112,18 @@ class BrowserRedirectMiddleware: ``/health`` endpoint are left untouched. """ - def __init__(self, app, docs_url: str = DOCS_URL) -> None: + def __init__(self, app: ASGIApp, docs_url: str = DOCS_URL) -> None: self.app = app self.docs_url = docs_url - async def __call__(self, scope, receive, send) -> None: + async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] == "http" and self._is_browser_navigation(scope): response = RedirectResponse(self.docs_url, status_code=302) await response(scope, receive, send) return await self.app(scope, receive, send) - def _is_browser_navigation(self, scope) -> bool: + def _is_browser_navigation(self, scope: Scope) -> bool: if scope["method"] not in ("GET", "HEAD"): return False if scope["path"].rstrip("/") != "":