mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2026-05-01 21:20:19 +00:00
Add QA discoverability to MCP instructions and localhost guard for cloud browsers (#4984)
This commit is contained in:
parent
9811ce6e3d
commit
bdd1a26361
4 changed files with 240 additions and 0 deletions
25
skyvern/cli/mcp_tools/_localhost.py
Normal file
25
skyvern/cli/mcp_tools/_localhost.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
"""Localhost URL detection for cloud browser sessions."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from urllib.parse import urlparse
|
||||
|
||||
_LOCALHOST_HOSTNAMES = frozenset(
|
||||
{
|
||||
"localhost",
|
||||
"127.0.0.1",
|
||||
"0.0.0.0", # noqa: S104 — detection, not binding
|
||||
"::1",
|
||||
"[::1]",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def is_localhost_url(url: str) -> bool:
|
||||
"""Return True if *url* points to a loopback address."""
|
||||
try:
|
||||
parsed = urlparse(url)
|
||||
hostname = (parsed.hostname or "").lower()
|
||||
return hostname in _LOCALHOST_HOSTNAMES
|
||||
except Exception:
|
||||
return False
|
||||
Loading…
Add table
Add a link
Reference in a new issue