Playwright JEV
Enables autonomous browser navigation and interaction with the Orange.pl portal, including configuring products, adding items to the cart, and proceeding through checkout steps, with automatic handling of consent overlays.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Playwright JEV add the newest iPhone with the cheapest plan on Orange.pl to cart and go to checkout"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Playwright MCP + JEV (Browser Intent Layer)
Semantyczny wrapper nad Playwright MCP z autonomicznym modelem decyzyjnym JEV (Decisions API).
Redukuje zużycie tokenów w kontekście głównego LLM o 94% – 99.8%, ukrywa niskopoziomowe drzewo DOM i pozwala na autonomiczną nawigację w stronę celu biznesowego.
📑 Spis Treści
Related MCP server: Navigator MCP
💡 Jak to działa?
Problem z klasycznym Playwright MCP:
Tradycyjne integracje MCP z przeglądarką zrzucają całe drzewo dostępności (DOM/A11y) bezpośrednio do promptu głównego LLM przy każdym pojedynczym kroku:
Na portalach takich jak Orange.pl czy Empik.com pojedynczy snapshot ma od 36 KB do aż 245 KB (ponad 65 000 tokenów!).
Kilkukrokowa sesja potrafi zużyć 100 000 – 200 000 tokenów, kosztując kilkadziesiąt centów i błyskawicznie zapychając okno kontekstowe modelu.
Ponadto klasyczny MCP eksponuje ponad 20 niskopoziomowych narzędzi mikrozarządzania (
browser_click,browser_fill_form,browser_snapshot), których same opisy w promptcie systemowym zajmują ponad 2 500 tokenów i prowokują halucynacje refów selektorów.
Rozwiązanie: Browser Intent Layer (BIL + JEV):
Główny LLM staje się czystym orkiestratorem — wysyła wyłącznie zwięzłą intencję:
{ "goal": "dodaj do koszyka telefon iphone najnowszy z abonamentem najmniejszym i przejdź na dane zamawiającego" }Drzewo DOM nigdy nie trafia do głównego LLM — zużycie tokenów orchestratora spada z ~65 000 do zaledwie ~150 tokenów (98–99.8% oszczędności).
Lokalny model decyzyjny JEV (Decisions API) — tani, wyspecjalizowany model micro-decyzji analizuje kandydatów i ocenia ich przydatność w skali 0–100% (
noul), kosztując ułamki promila grosza per krok.Wbudowana autonomia i bezpieczeństwo:
Automatyczny Consent Bypass neutralizuje blokujące nakładki RODO/cookies (Didomi, OneTrust, CookieBot).
LoopDetector chroni przed wpadnięciem w pętle decyzyjne.
Safety Escalation Policy eskaluje do głównego LLM tylko wtedy, gdy pewność wyboru spadnie poniżej progu bezpieczeństwa (< 0.60).
🏛️ Architektura Systemu
┌─────────────────────────────────────────────────────────────┐
│ Główny LLM (Orchestrator) │
│ Claude 3.5 Sonnet / GPT-4o / Gemini Pro │
└──────────────────────────────┬──────────────────────────────┘
│ { goal: "..." } (~150 tokenów)
▼
┌─────────────────────────────────────────────────────────────┐
│ BROWSER INTENT LAYER (JEV Proxy Server) │
│ │
│ 1. Snapshot Adapter → pobiera drzewo A11y │
│ 2. Normalizer → kompresuje i deduplikuje elementy│
│ 3. Stop-Words Filter → eliminuje szum językowy (PL/EN) │
│ 4. Candidate Retriever → wyłuskuje top 30 kandydatów │
│ 5. JEV Resolver → model 'noul' (skala 0.0–1.0) │
│ 6. Loop Detector → wykrywa cykle i limity kroków │
│ 7. Playwright Executor → zarządza akcjami w Playwright │
└──────────────────────────────┬──────────────────────────────┘
│ Wewnętrzne JSON-RPC (ref / target)
▼
┌─────────────────────────────────────────────────────────────┐
│ Playwright MCP Child + Przeglądarka │
│ │
│ • Consent Bypass Script (Didomi / OneTrust auto-bypass) │
│ • 25 000 ms Action Timeout (odporność na ciężkie portale) │
│ • Silnik Chromium (Headed lub Headless) │
└─────────────────────────────────────────────────────────────┘Kluczowe komponenty (src/jev-proxy/):
bil-controller.js— serce pętli decyzyjnej: pobranie snapshotu ➡️ normalizacja ➡️ wybór kandydatów ➡️ rezolucja JEV ➡️ wykonanie akcji lub eskalacja.jev-resolver.js— integracja z OpenRouter Decisions API z niezależnym ocenianiem prawdopodobieństwa w skali 0–100% (noul).candidate-retriever.js— leksykalno-semantyczny filtr kandydatów z mechanizmem eliminacji słów posiłkowych (stop-words).consent-bypass.js— wstrzykiwany do przeglądarki skrypt neutralizujący nakładki cookies/RODO przechwytujące zdarzenia wskaźnika myszy.loop-detector.js— detektor cykli oparty na hashowaniu stanu stron (fingerprinting).playwright-executor.js— jedyny moduł w systemie znający selektory i refy, odpowiedzialny za klikanie, wypełnianie formularzy i obsługę timeoutów.
🧰 Narzędzia MCP (Intent-Only Mode)
Domyślnie serwer działa w trybie Intent-Only Mode, eksponując dla zewnętrznego klienta wyłącznie 7 narzędzi semantycznych:
Narzędzie | Typ | Opis |
| Semantyczne | Główne narzędzie. Przyjmuje intencję użytkownika ( |
| Kontekst | Ustawienie biznesowego kontekstu sesji (intencji pomocniczej). |
| Nawigacja | Bezpośrednie przejście pod podany adres URL. |
| Nawigacja | Cofnięcie do poprzedniej strony w historii przeglądarki. |
| Inspekcja | Wykonanie zrzutu ekranu w razie potrzeby weryfikacji wizualnej przez człowieka. |
| Zakładki | Zarządzanie kartami przeglądarki ( |
| Cykl życia | Bezpieczne zamknięcie sesji przeglądarki. |
🔒 Dlaczego ukryliśmy niskopoziomowe narzędzia DOM?
W klasycznym MCP narzędzia takie jakbrowser_click,browser_fill_form,browser_snapshotzaśmiecają prompt klienta (+2 500 tokenów na każde zapytanie) i zmuszają go do mikrozarządzania refami. Ukrycie ich wymusza czystą komunikację intencyjną. W razie potrzeby można je przywrócić flagą--full-tools.
🚀 Jak Odpalić?
Krok 1: Wymagania wstępne
Node.js w wersji >= 18
Klucz API serwisu OpenRouter z dostępem do modelu Decisions API (domyślnie
typesafe/jev-1.13)
Krok 2: Instalacja i konfiguracja .env
# Sklonuj repozytorium i zainstaluj zależności
git clone https://github.com/rossik86/playwright-mcp-jev.git
cd playwright-mcp-jev
npm install
# Utwórz plik .env na podstawie szablonu
cp .env.example .envWypełnij plik .env:
JEV_API_KEY=sk-or-v1-twoj_klucz_openrouter
JEV_MODEL=typesafe/jev-1.13
JEV_BASE_URL=https://openrouter.ai/api
INTENT_ONLY=trueKrok 3: Konfiguracja w klientach MCP
Dodaj serwer do konfiguracji swojego klienta MCP (np. mcp.json w Cursor / VS Code / Claude Desktop / Antigravity):
{
"mcpServers": {
"playwright-jev": {
"command": "node",
"args": [
"c:/workspace/playwright/src/jev-proxy/cli.js",
"--headless"
],
"env": {
"JEV_API_KEY": "sk-or-v1-twoj_klucz_openrouter"
}
}
}
}Krok 4: Uruchomienie bezpośrednio z linii poleceń (CLI)
# 1. Tryb z widocznym oknem przeglądarki (headed)
node src/jev-proxy/cli.js
# 2. Tryb bezgłowy w tle (headless)
node src/jev-proxy/cli.js --headless
# 3. Uruchomienie z jawnymi parametrami
node src/jev-proxy/cli.js --headless --jev-api-key sk-or-v1-... --jev-model typesafe/jev-1.13⚙️ Opcje i Flagi Uruchomieniowe
Flaga CLI | Zmienna | Domyślnie | Opis |
| — |
| Uruchamia przeglądarkę Chromium w tle (bez GUI) |
|
|
| Domyślny tryb semantyczny — eksponuje tylko 7 narzędzi intencji, ukrywając narzędzia DOM |
| — |
| Wyłącza |
|
|
| Klucz API do OpenRouter Decisions API |
|
|
| Model używany do podejmowania decyzji |
|
|
| Adres bazowy API OpenRouter |
| — |
| Czas oczekiwania na akcje kliknięć w ms (odporność na ciężkie SPA) |
| — | — | Opcjonalny port HTTP dla transportu SSE |
📊 Wyniki Benchmarków na Żywych Portalach
Przetestowano działanie systemu na realnych, złożonych portalach e-commerce i serwisach transakcyjnych w Polsce:
Portal / Scenariusz | Vanilla Playwright MCP (DOM) | Browser Intent Layer (BIL + JEV) | Oszczędność tokenów | Wynik i Zachowanie BIL |
GrandBazaar.pl„zamów kebaba aż do danych adresowych” | ~2 244 tokenów(7.3 KB drzewa DOM) | ~125 tokenów(JEV: 4 979 tok, koszt $0.00017) | 94.4% mniej tokenów 🚀 | ✅ 100% Sukces (3 autonomiczne kroki: strona główna ➡️ menu ➡️ dodanie kebaba ➡️ kasa) |
Orange.pl„dodaj telefon iphone z abonamentem i przejdź na dane” | ~10 015 – 60 000+ tokenów(36.3 KB – 73 KB na krok) | ~201 tokenów(JEV: 12 077 tok, koszt $0.00043) | 98.0% mniej tokenów 🚀 | 🔄 4 autonomiczne kroki przez konfigurator z automatycznym ominięciem Didomi CMP |
Empik.com„dodaj książkę Stephen King Misery i przejdź na dane” | ~65 766 tokenów!(245.1 KB gigantyczny DOM) | ~147 tokenów(JEV: 2 980 tok, koszt $0.00010) | 99.8% mniej tokenów! 🚀 | 🛡️ Safety Escalation (ochrona: model nie kliknął w pusty koszyk przy braku książki na głównej) |
📈 Podsumowanie Zysków:
Redukcja tokenów kontekstu: o 94.4% – 99.8% w porównaniu z klasycznym zrzucaniem snapshota A11y.
Czysty kontekst roboczy: Główny model nie jest zaśmiecany dziesiątkami kilobajtów kodu HTML/DOM.
Koszty wykonania: Pojedynczy wieloetapowy proces kosztuje w JEV Decisions API od $0.0001 do $0.0004 (mniej niż pół promila centa), podczas gdy w klasycznym podejściu wysłanie 65 000 tokenów do Claude 3.5 Sonnet / GPT-4o kosztuje $0.20 – $0.50 za pojedynczy krok.
🧪 Uruchamianie Benchmarków i Testów
W projekcie przygotowano dedykowane skrypty npm ułatwiające uruchamianie benchmarków i testów jednostkowych:
# 1. Uruchomienie benchmarku dla konkretnych portali:
npm run bil:benchmark:grandbazaar # GrandBazaar.pl (kebab kraftowy - 100% sukces)
npm run bil:benchmark:orange # Orange.pl (iPhone + konfigurator planu)
npm run bil:benchmark:empik # Empik.com (Stephen King Misery - 99.8% redukcji)
# 2. Uruchomienie pełnego benchmarku porównawczego dla wszystkich scenariuszy
npm run bil:benchmark:both
# 3. Uruchomienie tylko silnika BIL (z tokenami i kosztami)
npm run bil:benchmark
# 4. Uruchomienie tylko silnika klasycznego Playwright MCP
npm run bil:benchmark:classic
# 5. Uruchomienie zestawu testów jednostkowych (55 testów, 100% pass)
npm run bil:testAvailable Tools
25 toolsbrowser_clickBDestructive
Perform click on a web page
Inputs: target (required), button, element, modifiers, +1 more.
browser_closeBDestructive
Close the page
Inputs: no named parameters.
browser_console_messagesCRead-only
Returns all console messages
Inputs: level (required), all, filename.
browser_dragADestructive
Perform drag and drop between two elements
Inputs: endTarget (required), startTarget (required), endElement, startElement.
browser_dropADestructive
Drop files or MIME-typed data onto an element, as if dragged from outside the page. At least one of "paths" or "data" must be provided.
Inputs: target (required), data, paths, element.
browser_emulate_mediaADestructive
Emulate CSS media features for the page, for example switch between the light and dark color scheme. Omitted parameters are left unchanged; null clears an override.
Inputs: media, contrast, colorScheme, forcedColors, +1 more.
browser_evaluateCDestructive
Evaluate JavaScript expression on page or element
Inputs: function (required), target, element, filename.
browser_file_uploadBDestructive
Upload one or multiple files
Inputs: paths.
browser_fill_formBDestructive
Fill multiple form fields
Inputs: fields (required).
browser_findARead-only
Search the accessibility snapshot of the current page for text or a regular expression. Returns matching snapshot nodes with a few lines of surrounding context (like search snippets), each shown under its path from the root of the tree, which is cheaper than capturing the whole snapshot when you only need to locate an element and its ref.
Inputs: text, regex.
browser_handle_dialogCDestructive
Handle a dialog
Inputs: accept (required), promptText.
browser_hoverADestructive
Hover over element on page
Inputs: target (required), element.
browser_network_requestARead-only
Returns full details (headers and body) of a single network request, or a single part if part is set. Use the number from browser_network_requests.
Inputs: index (required), part, filename.
browser_network_requestsARead-only
Returns a numbered list of network requests since loading the page. Use browser_network_request with the number to get full details.
Inputs: static (required), filter, filename.
browser_press_keyBDestructive
Press a key on the keyboard
Inputs: key (required).
browser_resizeBDestructive
Resize the browser window
Inputs: width (required), height (required).
browser_run_code_unsafeADestructive
Run a Playwright code snippet. Unsafe: executes arbitrary JavaScript in the Playwright server process and is RCE-equivalent.
Inputs: code, filename.
browser_select_optionBDestructive
Select an option in a dropdown
Inputs: target (required), values (required), element.
browser_snapshotARead-only
Capture accessibility snapshot of the current page, this is better than screenshot
Inputs: boxes, depth, target, filename.
browser_tabsADestructive
List, create, close, or select a browser tab.
Inputs: action (required), url, index.
browser_take_screenshotARead-only
Take a screenshot of the current page. You can't perform actions based on the screenshot, use browser_snapshot for actions.
Inputs: scale (required), type, target, element, +2 more.
browser_typeBDestructive
Type text into editable element
Inputs: text (required), target (required), slowly, submit, +1 more.
browser_wait_forARead-only
Wait for text to appear or disappear or a specified time to pass
Inputs: text, time, textGone.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 25 tools
Most tools target distinct browser actions (click, hover, type, navigate, snapshot, screenshot). A few pairs overlap somewhat — browser_drop vs browser_drag, and browser_evaluate vs browser_run_code_unsafe — but descriptions clarify their boundaries well enough to select correctly.
Every tool uses the browser_ prefix with consistent snake_case verb/noun phrasing (browser_navigate, browser_take_screenshot, browser_select_option). The pattern is uniform and predictable across all 25 tools.
25 tools is on the heavy side, but browser automation is a genuinely broad domain and nearly every tool covers a distinct capability (dialogs, network, console, tabs, media emulation). Slightly over-scoped but each tool earns its place.
The surface covers the full interaction lifecycle: navigation, interaction, forms, dialogs, file upload, network/console inspection, and screenshots. Minor gaps like explicit cookie/localStorage management exist, but agents can work around them via browser_evaluate.
Maintenance
Related MCP Connectors
AI-powered web automation. Navigate websites using AI agents for one page or a thousand
AI-powered web automation. Navigate websites using AI agents for one page or a thousand
Control a real browser from AI agents: navigate, click, type, screenshot, read the page.
AI-powered browser automation — navigate, click, fill forms, and extract data from any website.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables LLM agents to automate a live Chrome browser with compact DOM serialization, authenticated session continuity, and human-like input trajectories.6 npmMIT
- AlicenseBqualityCmaintenanceEnables LLM agents to automate web browsers with token-efficient perception, stealth anti-detection, captcha solving, network interception, and isolated persistent sessions.51MIT
- FlicenseNot gradedqualityNot gradedmaintenanceEnables AI agents to browse and interact with web pages through a persistent headless Chromium session, serving compact structured orientations, targeted element queries, and full detail only when explicitly requested. It supports navigation, observation, form filling, monitoring, and session management while cutting token overhead by up to ~140x versus raw accessibility-tree dumps.4 npm-
- AlicenseNot gradedqualityAmaintenanceEnables AI agents to browse the web through a persistent headless Chromium session that returns compact, structured page summaries and targeted queries instead of full accessibility-tree dumps. Agents can navigate, observe, search, and interact with pages using configurable detail levels and tool profiles, cutting token costs by up to ~140x on content-heavy sites.4 npmMIT