aegis402/deploy/inspect_glama.py

29 lines
1.2 KiB
Python

"""Inspect glama.ai Add Server flow."""
from playwright.sync_api import sync_playwright
from pathlib import Path
with sync_playwright() as p:
b = p.chromium.launch(headless=True)
ctx = b.new_context(user_agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0 Safari/537.36")
page = ctx.new_page()
page.goto("https://glama.ai/mcp/servers", wait_until="domcontentloaded", timeout=30000)
# find Add Server link
link = page.query_selector('a:has-text("Add Server")')
if link:
href = link.get_attribute("href")
print("ADD SERVER HREF:", href)
if href.startswith("/"):
href = "https://glama.ai" + href
page.goto(href, wait_until="domcontentloaded", timeout=30000)
print("--- ADD PAGE ---")
print("URL:", page.url)
print("TITLE:", page.title())
print(page.inner_text("body")[:1500])
Path("data/glama_add.html").write_text(page.content())
# any forms?
for inp in page.query_selector_all("input"):
print(" INPUT:", inp.get_attribute("name"), inp.get_attribute("type"), inp.get_attribute("placeholder"))
else:
print("No Add Server link found")
b.close()