web-speed-agent
web-speed-agent
認証済みWeb抽出のためのローカルブラウザ自動化 + Web Speed API 統合。
AIエージェントを任意のWebサイト(ログインが必要なサイトを含む)に向けるだけで、クリーンで構造化されたデータを取得できます。認証情報はマシン内に留まります。抽出されたHTMLのみがサーバーに送信されます。
pip install web-speed-agent
playwright install chromiumClaude、Gemini、その他のAIクライアントでこれを使用したいですか?
MCPサーバーインストールガイド を確認してください。AIエージェントが自然言語を通じてログインし、データを抽出できるようにする最も簡単な方法です。
仕組み
Your machine Web Speed server
───────────────────────────────── ──────────────────────────
Playwright browser (local)
↓ navigates, logs in, clicks
↓ gets page HTML
↓ (no passwords sent)
agent.extract(html) ────────→ Advanced extraction engine
←──────── Structured JSON認証情報がマシンから出ることはありません。サーバーはHTMLのみを参照します。
Related MCP server: Agent Identity MCP Server
クイックスタート
import asyncio
from web_speed_agent import Agent
async def main():
agent = Agent(api_key="wsp_...") # or set WEBSPEED_API_KEY env var
# Public pages — no browser needed
result = await agent.map("https://techcrunch.com/some-article/")
print(result["article"]["sections"])
# Authenticated pages — browser runs locally
agent.store_credential("mysite", "me@example.com", "mypassword")
async with agent.browser(session_name="mysite") as browser:
page = await browser.new_page()
await page.goto("https://mysite.com/login")
username, password = agent.get_credential("mysite")
await page.fill('[name="email"]', username)
await page.fill('[name="password"]', password)
await page.click('button[type="submit"]')
await page.wait_for_load_state("networkidle")
# Now on a logged-in page — extract it
html = await page.content()
result = await agent.extract(html, page_type="listing")
print(result["listing"]["items"])
asyncio.run(main())getwebspeed.io でAPIキーを取得してください。
インストール
要件: Python 3.10+、Web Speed APIキー
pip install web-speed-agent
playwright install chromium
export WEBSPEED_API_KEY="wsp_..."基本概念
Agent
メインクラス。認証情報、ブラウザセッション、API呼び出しを管理します。
from web_speed_agent import Agent
# API key from argument
agent = Agent(api_key="wsp_...")
# API key from environment variable (recommended)
# export WEBSPEED_API_KEY="wsp_..."
agent = Agent()
# Use as async context manager (auto-closes HTTP client)
async with Agent() as agent:
...公開ページの抽出
ログイン不要のページにはブラウザは不要です:
# Fetch + extract in one call
result = await agent.map("https://example.com/article")
# With JavaScript rendering (for heavy SPAs)
result = await agent.map("https://example.com/spa", js=True)認証済みページの抽出
ローカルブラウザセッションを使用します。ブラウザはマシン上で実行されます:
async with agent.browser(session_name="mysite") as browser:
page = await browser.new_page()
await page.goto("https://mysite.com/dashboard")
html = await page.content()
result = await agent.extract(html)session_name はCookieを ~/.webspeed/sessions/<name>/ に永続化するため、以降の実行ではログイン手順をスキップできます。
認証情報の管理
認証情報はシステムのキーチェーン(macOS Keychain、Windows Credential Manager、Linux secret-tool)に保存されます。これらが Web Speedサーバーに送信されることは決してありません。
# Store once
agent.store_credential("mysite", "me@example.com", "mypassword")
# Retrieve anywhere
username, password = agent.get_credential("mysite")
# Remove
agent.delete_credential("mysite")抽出出力
サーバーはページタイプを認識した構造化データを返します:
# Article
result = await agent.extract(html, page_type="article")
# result["page_type"] → "article"
# result["title"] → "Article Title"
# result["author"] → "Jane Smith"
# result["published_date"] → "2026-05-06"
# result["article"]["sections"] → [{"heading": "...", "paragraphs": [...]}]
# result["article"]["links"] → [{"text": "...", "url": "..."}]
# Product
result = await agent.extract(html, page_type="product")
# result["product"]["name"] → "Wireless Headphones"
# result["product"]["price"] → "$99.99"
# result["product"]["availability"] → "In Stock"
# result["product"]["rating"] → "4.5"
# result["product"]["specs"] → {"Battery": "30h", ...}
# Listing (search results, category pages)
result = await agent.extract(html, page_type="listing")
# result["listing"]["items"] → [{"title": "...", "url": "...", "price": "..."}]
# Auto-detect (default)
result = await agent.extract(html)
# result["page_type"] → "article" | "product" | "listing" | "other"すべての結果には engine: "advanced" が含まれており、生のHTMLよりも60〜85%トークン効率が高くなっています。
例
価格モニター
import asyncio
from web_speed_agent import Agent
async def check_price(url: str, site_name: str) -> str:
async with Agent() as agent:
agent.store_credential(site_name, "me@example.com", "password", overwrite=True)
async with agent.browser(session_name=site_name) as browser:
page = await browser.new_page()
# Login
await page.goto(f"https://{site_name}.com/login")
user, pwd = agent.get_credential(site_name)
await page.fill('[name="email"]', user)
await page.fill('[name="password"]', pwd)
await page.click('button[type="submit"]')
await page.wait_for_load_state("networkidle")
# Check product
await page.goto(url)
await page.wait_for_load_state("networkidle")
html = await page.content()
result = await agent.extract(html, page_type="product")
return result.get("product", {}).get("price", "unknown")
price = asyncio.run(check_price("https://example.com/product/123", "example"))
print(f"Current price: {price}")プライベートダッシュボードの読み取り
import asyncio
from web_speed_agent import Agent
async def get_dashboard_data():
async with Agent() as agent:
async with agent.browser(session_name="analytics") as browser:
page = await browser.new_page()
# Login (first run only — session persists after)
creds = agent.get_credential("analytics")
if not creds:
agent.store_credential("analytics", "me@company.com", "password")
creds = agent.get_credential("analytics")
await page.goto("https://analytics.company.com/login")
await page.fill('[name="email"]', creds[0])
await page.fill('[name="password"]', creds[1])
await page.click('button[type="submit"]')
await page.wait_for_load_state("networkidle")
# Navigate to dashboard
await page.goto("https://analytics.company.com/dashboard")
await page.wait_for_selector(".metrics-table", timeout=10000)
html = await page.content()
result = await agent.extract(html)
return result
asyncio.run(get_dashboard_data())ログイン中の複数ページスクレイピング
import asyncio
from web_speed_agent import Agent
async def scrape_inbox():
async with Agent() as agent:
async with agent.browser(session_name="webmail") as browser:
page = await browser.new_page()
# Login
await page.goto("https://mail.example.com/login")
user, pwd = agent.get_credential("webmail")
await page.fill('[name="username"]', user)
await page.fill('[name="password"]', pwd)
await page.click('[type="submit"]')
await page.wait_for_load_state("networkidle")
# Scrape multiple pages
emails = []
for page_num in range(1, 4):
await page.goto(f"https://mail.example.com/inbox?page={page_num}")
await page.wait_for_load_state("networkidle")
html = await page.content()
result = await agent.extract(html, page_type="listing")
emails.extend(result.get("listing", {}).get("items", []))
return emails
asyncio.run(scrape_inbox())AIエージェント統合 (MCP)
付属のMCPサーバーを使用すると、Claude Desktop、Gemini CLI、およびMCP互換エージェントがSDKを直接使用できます。エージェントは、自然言語を通じてログイン、ナビゲート、クリック、抽出を行うことができます。
MCPサーバーの起動:
WEBSPEED_API_KEY="wsp_..." python3 agent_mcp_server.pyClaude Desktopに追加 (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"web-speed-agent": {
"command": "python3",
"args": ["/path/to/agent_mcp_server.py"],
"env": {
"WEBSPEED_API_KEY": "wsp_..."
}
}
}
}Gemini CLIに追加 (~/.gemini/settings.json):
{
"mcpServers": {
"web-speed-agent": {
"command": "python3.11",
"args": ["/path/to/agent_mcp_server.py"],
"env": {
"WEBSPEED_API_KEY": "wsp_...",
"PYTHONPATH": "/path/to/web-speed-agent"
}
}
}
}次に、エージェントに指示します:
"unitedの認証情報を保存して — ユーザー名は me@example.com、パスワードは mypassword"
"united.comにログインして、来週の金曜日のSFOからJFKへの最安値のフライトを見つけて"
利用可能なMCPツール:
ツール | 説明 |
| システムキーチェーンにログイン情報を保存 |
| ブラウザを開いてサインイン |
| アクティブなセッションでURLに移動 |
| 現在のページから構造化データを取得 |
| ボタンやリンクをクリック |
| フォームフィールドに入力 |
| フォームを送信 |
| ブラウザセッションを終了 |
| APIクレジット残高を確認 |
APIリファレンス
Agent
Agent(
api_key: str | None = None,
server_url: str | None = None,
config_dir: str = "~/.webspeed",
headless: bool = True,
)パラメータ | 説明 |
| Web Speed APIキー。 |
| APIサーバーURLを上書きします。デフォルト: |
| 設定、セッション、ログ用のディレクトリ。デフォルト: |
| ブラウザをヘッドレスで実行します。デフォルト: |
agent.browser()
agent.browser(
session_name: str | None = None,
headless: bool | None = None,
proxy: str | None = None,
) -> ManagedBrowser非同期コンテキストマネージャーを返します。ブロック内で .new_page() を呼び出してPlaywrightの Page を取得します。
パラメータ | 説明 |
| Cookieを |
| このセッションのインスタンスの |
| プロキシURL(例: |
セッション名は英数字とハイフン/アンダースコアで構成し、最大64文字である必要があります。
agent.extract()
await agent.extract(
html: str,
page_type: str = "auto",
) -> dictHTMLをWeb Speed APIに送信します。1クレジットを消費します。
パラメータ | 説明 |
| 生のHTML文字列(例: |
|
|
agent.map()
await agent.map(
url: str,
js: bool = False,
) -> dictサーバー経由で公開URLを取得および抽出します。ローカルブラウザは不要です。1クレジットを消費します。
パラメータ | 説明 |
| ページのURL。 |
| 抽出前にJavaScriptをレンダリングします。 |
agent.account()
await agent.account() -> dictcredits、tier、status、lifetime(合計/成功/失敗)を返します。
agent.store_credential()
agent.store_credential(
site: str,
username: str,
password: str,
overwrite: bool = False,
) -> Noneシステムキーチェーンに保存します。認証情報が存在し、overwrite=False の場合に CredentialError を発生させます。
agent.get_credential()
agent.get_credential(site: str) -> tuple[str, str] | None(username, password) を返します。見つからない場合は None を返します。
agent.delete_credential()
agent.delete_credential(site: str) -> Noneキーチェーンから認証情報を削除します。
例外
from web_speed_agent import (
WebSpeedError, # Base exception
AuthenticationError, # Invalid/missing API key
InsufficientCreditsError, # No credits remaining
APIError, # API returned 4xx/5xx
RateLimitError, # 429 Too Many Requests
CredentialError, # Keychain error
BrowserError, # Playwright error
NetworkError, # Timeout or DNS failure
PlaywrightNotInstalledError, # Run: playwright install chromium
)from web_speed_agent import Agent, InsufficientCreditsError, NetworkError
try:
result = await agent.extract(html)
except InsufficientCreditsError:
print("Out of credits — top up at getwebspeed.io")
except NetworkError as e:
print(f"Connection failed: {e}")設定
環境変数
変数 | 説明 |
| APIキー(設定ファイルよりも推奨) |
| サーバーURLを上書き( |
設定ファイル
~/.webspeed/config.yaml — 初回実行時に自動的に作成されます。権限は 0o600(所有者のみ)に設定されます。
api:
server_url: https://api.getwebspeed.io
timeout: 30
browser:
headless: trueセッションファイル
永続化されたブラウザセッションは ~/.webspeed/sessions/<name>/storage.json に保存されます。
権限:
0o600(所有者のみ)内容: Cookie、localStorage、sessionStorage
削除しても安全: 次回実行時にエージェントが再認証します
セキュリティ
マシンから出るもの
agent.extract(html) を呼び出すと、ページHTMLが処理のためにWeb Speed APIに送信されます。それ以外はすべてローカルに留まります。
データ | 送信先 |
ログイン認証情報 | マシンから出ることはありません(システムキーチェーンのみ) |
ブラウザCookie / セッション | マシンから出ることはありません(ローカルPlaywright) |
ページHTML | 抽出のためにHTTPS経由でWeb Speed APIに送信 |
抽出されたJSON | あなたに返されます |
HTMLスクラビング(デフォルトで有効)
HTMLが送信される前に、SDKはローカルで自動的にスクラビングを行います:
インラインの
<script>および<style>ブロックを削除認証関連の名前(
csrf、token、nonce、sessionなど)を持つ非表示のフォームフィールドの値を空白化機密性の高い
<meta>コンテンツ属性をクリアHTMLコメントを削除
表示コンテンツ(テキスト、リンク、テーブル、見出し、製品データ)は変更されません。
# Default: scrubbing is on
result = await agent.extract(html)
# Turn off only if the page has no sensitive data
result = await agent.extract(html, scrub=False)
# Or scrub manually and inspect before sending
from web_speed_agent import scrub
clean_html = scrub(raw_html)
print(clean_html) # inspect what will be sent
result = await agent.extract(clean_html, scrub=False)サーバー側のデータ処理
HTMLはメモリ内でのみ処理 — ディスクへの書き込み、ログ記録、キャッシュは一切行われません
認証が必要なページはキャッシュされません — ログインが必要なページは共有レジストリから明示的に除外されます
使用ログには以下のみを保存: APIキーのハッシュ、URLのハッシュ(または
"sdk-extract")、タイムスタンプ、検出されたページタイプ — コンテンツは保存されませんエラー応答に生のHTMLは含まれません — 例外はエラーが返される前にサニタイズされます
その他の保護
認証情報はシステムキーチェーンに保存され、ファイルに保存されたり、サーバーに送信されたりすることはありません
セッションファイルは
0o600権限(所有者のみ読み取り/書き込み)で書き込まれます設定ディレクトリは
0o700権限で作成されますTLSは常に検証 — すべてのHTTP呼び出しで
verify=Trueが設定され、無効にすることはできませんHTTPSを強制 —
server_urlはhttps://で始まる必要があり、プレーンなHTTPは拒否されますパストラバーサル防止 — セッション名は
[a-zA-Z0-9_-]の許可リストに対して検証されます認証情報のログ記録なし — パスワードがログやエラーメッセージに表示されることはありません
ライセンス
GNU General Public License v3.0 — LICENSE を参照してください。
Web Speed APIの使用には Web Speed利用規約 が適用されます。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceReducing token usage by 70% with a deterministic mapping engine. Also links in with the Web Speed Agent SDK and MCP for post-auth agents.10GPL 3.0
- AlicenseNot gradedqualityDmaintenanceMCP Server for AI agent identity and authorization. Create, verify, and manage agent identities with trust scores and scoped authorization tokens.MIT
- AlicenseAqualityAmaintenanceProvides an MCP-native agent browser that enables autonomous agents to perceive and interact with web pages through stealth browsing, identity borrowing, and WAAP detection.9MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP-capable runtimes to read agent message rooms, sign and post public messages, and create or verify Ed25519 contribution proofs for Technocore.MIT
Related MCP Connectors
Agent-first web hosting: deploy sites, apps, databases and domains over MCP.
Hosted AgentLux MCP server for marketplace, identity, creator, services, and social flows.
MCP Server for agents to onboard, pay, and provision services autonomously with InFlow
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Dominic-Pi-Sunyer/web-speed-agent'
If you have feedback or need assistance with the MCP directory API, please join our Discord server