Skip to main content

Page Vision MCP

Structured visual analysis pipeline for coding agents — give your AI agent the ability to see.

PyPI Python License: MIT

What It Does

Page Vision MCP turns visual analysis from a prompt into a tool. Instead of asking an LLM to "look at this image," your coding agent calls a structured API that returns consistent, machine-readable results with coordinates.

5 Tools:

Tool What It Does VLM Playwright
capture_page Screenshot a webpage (fallback) - Yes
analyze_ui Structured UI analysis with region-level localization Yes -
compare_ui Screenshot diff with mode constraints Yes -
extract_text Block-level OCR with coordinates Yes -
crop_analyze Progressive crop refinement with depth guards Yes -

3 Resources: vision://health | vision://version | vision://models

Pipeline

Screenshot ──> analyze_ui ──> Structured JSON
                  │
                  ├── Need detail? ──> crop_analyze (depth +1)
                  ├── Need text?   ──> extract_text
                  └── Need diff?   ──> compare_ui

Quick Start

Install

pip install page-vision-mcp

# Optional: Playwright for screenshot fallback
pip install "page-vision-mcp[playwright]"
playwright install chromium

Configure

Set environment variables (or create a .env file, see .env.example):

VISION_API_KEY=your-api-key
VISION_BASE_URL=https://api.openai.com/v1
VISION_MODEL_ID=gpt-4o

Works with any OpenAI-compatible VLM: GPT-4o, GLM-4V, Qwen-VL, etc.

MCP Client Config

Add to your MCP client configuration (Claude Code, Trae, Cursor, etc.):

{
  "mcpServers": {
    "page-vision-mcp": {
      "command": "page-vision-mcp",
      "env": {
        "VISION_API_KEY": "your-api-key",
        "VISION_BASE_URL": "https://api.openai.com/v1",
        "VISION_MODEL_ID": "gpt-4o"
      }
    }
  }
}

See examples/mcp_config.json for the full configuration with all options.

Tool Details

analyze_ui — UI Analysis

analyze_ui(
    image_source="screenshot.png",  # URL/path/base64/data_url
    prompt="",                       # optional focus
    task="ui",                       # ui/screenshot/qa/general
    detail="high"                    # low/auto/high
)

Returns structured observations with region-level localization (page → section → component → text), inferences, uncertainties, and suggested regions for further analysis.

compare_ui — Screenshot Diff

compare_ui(
    image_before="before.png",
    image_after="after.png",
    mode="viewport",     # viewport/fullpage/component
    focus="changes"      # changes/layout/text/colors/general
)

Returns structured differences (added/removed/modified/moved) with coordinates.

extract_text — OCR

extract_text(
    image_source="screenshot.png",
    language="auto",        # auto/chinese/english/japanese/korean
    preserve_layout=True
)

Returns text blocks with type, confidence, and bounding box coordinates.

crop_analyze — Progressive Refinement

crop_analyze(
    image_source="screenshot.png",
    x=0.15, y=0.02, width=0.6, height=0.07,  # normalized 0.0-1.0
    depth=1,       # agent-managed, max 3
    task="ui"
)

Use coordinates from analyze_ui's suggested_regions. Max depth 3 prevents infinite recursion.

capture_page — Screenshot Fallback

capture_page(
    url="http://localhost:3000",
    viewport_width=1280,
    viewport_height=720,
    full_page=False,
    wait_for="networkidle"  # networkidle/domcontentload/load/none
)

Note: If your agent has built-in browser capability (Computer Use, Trae browser, Playwright MCP), use that instead and pass the screenshot path to analyze_ui.

Response Format

All tools return a structured JSON envelope:

{
  "status": "success",
  "tool": "analyze_ui",
  "result": { ... },
  "warnings": []
}

Status can be: success | partial | error | unavailable | unsupported | completed

Configuration

Variable Default Description
VISION_API_KEY - VLM API key (required)
VISION_BASE_URL https://api.openai.com/v1 VLM API endpoint
VISION_MODEL_ID gpt-4o Model to use
VISION_TIMEOUT 60 Request timeout (seconds)
VISION_MAX_RETRIES 3 Max retry attempts
VISION_ALLOW_LOCAL_FILES true Allow local file paths
VISION_ALLOWED_PATHS - Allowed directories (comma-separated)
VISION_BLOCK_PRIVATE_IPS true Block SSRF to private IPs
VISION_MAX_IMAGE_SIZE_MB 10 Max image size
VISION_MAX_IMAGE_PIXELS 40000000 Max pixel count

Development

pip install -e ".[dev]"
pytest tests/

License

MIT

Metadata

Release files for page-vision-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for page-vision-mcp 0.1.0
File Size Uploaded Provenance Actions
page_vision_mcp-0.1.0.tar.gz 33.4 kB Without provenance Details for page_vision_mcp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for page-vision-mcp 0.1.0
File Interpreter ABI Platform Actions
page_vision_mcp-0.1.0-py3-none-any.whl Python 3 none any Details for page_vision_mcp-0.1.0-py3-none-any.whl

Total release size: 69.8 kB

Release files / page_vision_mcp-0.1.0.tar.gz

Download URL page_vision_mcp-0.1.0.tar.gz
Size 33.4 kB
Tags Source
SHA-256 checksum
How to use checksums
93f99d496e467721b5073acd4615c4c3fb99341a7ac4feb4ebea2eb8be205a33
BLAKE2b-256 checksum
How to use checksums
4e79d2e1ad5d0c8ead87537694ec9ad03e286cc1da5854b14c9648f022f020b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.5

Release files / page_vision_mcp-0.1.0-py3-none-any.whl

Download URL page_vision_mcp-0.1.0-py3-none-any.whl
Size 36.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cfb84814fdf80e96339b03bafefea97b25cd7fa28884ca7542fa981e6a43d301
BLAKE2b-256 checksum
How to use checksums
3cf51e5036cc5153c4db99e62f5d4760a96eb9815bc4fc4474e492cadd14ce24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.5

Security for page-vision-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page