Open a terminal/PowerShell and run:
# Install Playwright Python package
pip install playwright
# Install Chromium browser (required for snapshots)
playwright install chromiumNote: If playwright command doesn't work, try:
py -m playwright install chromiumOpen a new terminal/PowerShell window and run:
# Navigate to project directory (if not already there)
cd "C:\Users\senti\OneDrive\Desktop\mcp SERVERS\Langchain MCP\restful-data-gateway-main"
# Start the backend server
py run_server.pyExpected output:
INFO: Started server process
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8000
Keep this terminal open! The server needs to stay running.
Open another new terminal/PowerShell window and run:
# Navigate to project directory
cd "C:\Users\senti\OneDrive\Desktop\mcp SERVERS\Langchain MCP\restful-data-gateway-main"
# Install frontend dependencies (if not already done)
npm install
# Start the frontend dev server
npm run devExpected output:
VITE v5.x.x ready in xxx ms
➜ Local: http://localhost:8080/
➜ Network: use --host to expose
Keep this terminal open too!
-
Open your browser and go to:
http://localhost:8080/sandbox -
Or go to the home page first:
http://localhost:8080Then click the "Try Playwright Sandbox" button
-
Enter a URL in the input field:
- Try:
google.com - Or:
github.com - Or:
amazon.com
- Try:
-
Click "Generate Snapshot"
-
Wait for the snapshot (may take 10-30 seconds on first load)
-
You should see:
- Left side: Live website in iframe
- Right side: Structured accessibility snapshot (AI view)
- Token count displayed
-
Test the "Try a Prompt" feature:
- Enter a prompt like:
"Find the login button"or"Where is the search field?" - Click "Test"
- See highlighted matches in the snapshot
- Enter a prompt like:
Try these popular sites (they're cached for faster results):
google.comgithub.comamazon.comstackoverflow.com
Solution:
pip install playwright
playwright install chromiumPossible causes:
- Website took too long to load (30s timeout)
- Website blocks automated access
- Invalid URL
Solution: Try a different URL or check the backend terminal for error details
Check:
- Backend is running on port 8000 (check terminal)
- Frontend is running on port 8080
- No firewall blocking connections
Test backend directly:
# Test health endpoint
curl http://localhost:8000/health
# Or in PowerShell
Invoke-WebRequest -Uri http://localhost:8000/healthIf port 8000 is busy:
# Change port in .env file or set environment variable
$env:PORT="8001"
py run_server.pyThen update the frontend API URL (see below)
If your backend is on a different port, create a .env file in the project root:
VITE_API_BASE_URL=http://localhost:8000Or if backend is on port 8001:
VITE_API_BASE_URL=http://localhost:8001✅ First time loading a URL:
- Takes 10-30 seconds
- Shows loading spinner
- Generates fresh snapshot
✅ Loading cached sites (google.com, github.com, etc.):
- Returns instantly
- Shows "✓ Using cached snapshot" message
✅ Testing prompts:
- Highlights matching lines in yellow
- Shows match count
- Displays context for each match
- Dual-view works: You see the website on the left, snapshot on the right
- Snapshot format: Structured text showing
[role]elements with names and descriptions - Token count: Shows estimated tokens (demonstrates efficiency vs screenshots)
- Prompt matching: Highlights relevant elements when you test prompts
- Caching: Popular sites load instantly on second visit
Once you've verified it works:
- Try different URLs to see various snapshot formats
- Test different prompts to see element matching
- Check the token counts to understand efficiency
- Review the snapshot structure to see how AI "views" websites
For production:
- Install Playwright browsers in your Docker container
- Set up proper caching (Redis recommended)
- Add rate limiting
- Configure CORS properly for your domain