scout: add scout_click_coords tool, document Sourcepoint limitation

- Add scout_click_coords for manual coordinate-based clicks (useful when
  CSS selectors can't reach cross-origin iframes)
- Document in _dismiss_cookie_banner why Sourcepoint is not auto-dismissed:
  HAR captures traffic regardless of banner visibility; coordinate clicks
  are too brittle across screen sizes
- Add missing asyncio import to server.py

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Deeman
2026-02-21 17:34:08 +01:00
parent d96f977c0f
commit 079c189e0a
2 changed files with 22 additions and 0 deletions

View File

@@ -214,6 +214,11 @@ async def _dismiss_cookie_banner(tab) -> bool:
except Exception:
continue
# Note: cross-origin full-page iframe banners (Sourcepoint on German publishers)
# are not dismissed here — coordinate clicks are too brittle across screen sizes.
# HAR recording captures network traffic regardless of banner visibility,
# so dismissal is only needed when we must click navigation elements.
# For those cases, use scout_click_coords manually.
return False

View File

@@ -14,6 +14,7 @@ Usage (via .mcp.json):
uv run --package scout scout-server
"""
import asyncio
import logging
import sys
@@ -160,6 +161,22 @@ async def scout_analyze(har_path: str) -> str:
return analyze.format_summary(summary)
@mcp.tool()
async def scout_click_coords(x: int, y: int) -> str:
"""Click at specific viewport coordinates. Useful for cross-origin iframes
where CSS selectors can't reach (e.g. Sourcepoint cookie banners on German sites).
Args:
x: Horizontal pixel position from left edge.
y: Vertical pixel position from top edge.
"""
assert browser._state["tab"] is not None, "No browser open — call scout_visit first"
await browser._state["tab"].mouse.click(x, y)
await asyncio.sleep(1.0)
title = await browser._state["tab"].title
return f"Clicked at ({x}, {y})\nCurrent title: {title}"
@mcp.tool()
async def scout_js(script: str) -> str:
"""Execute JavaScript on the current page and return the result.