Skip to main content
Glama

PyWebView Driver MCP

A local stdio MCP server that lets a coding agent launch, see, operate, test and live-reload a real PyWebView application. It drives the actual Qt WebEngine window through the page-level Chrome DevTools Protocol: semantic snapshots, real mouse and keyboard input, assertions, screenshots, console/network/process logs, page reload and process restart.

  • Python only. No Node.js, no browser, no changes to your application.

  • Linux with PyWebView on Qt (PySide6). Other renderers and platforms are not supported.

  • Web content only: native dialogs, window frames and devices are not automated and are reported as not covered.

See the verification report for what has been tested and how.

Security: this is a privileged developer tool, not a sandbox. It runs commands you give it and opens an unauthenticated loopback debugging port on the launched app. Use it only with trusted code and disposable test profiles. Details in docs/security.md.

Install

Requires uv and Python 3.11–3.14. The server runs in its own isolated environment; your application keeps its own environment with pywebview and PySide6.

Generic MCP configuration (configs/mcp.github.json):

{
  "mcpServers": {
    "pywebview": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/bigbatmanorg/pywebview-driver-mcp", "pywebview-driver-mcp"]
    }
  }
}

Claude Code:

claude mcp add pywebview -- uvx --from git+https://github.com/bigbatmanorg/pywebview-driver-mcp pywebview-driver-mcp

Codex CLI:

codex mcp add pywebview -- uvx --from git+https://github.com/bigbatmanorg/pywebview-driver-mcp pywebview-driver-mcp

Pin a version by appending @v0.1.0 (or a commit SHA) to the Git URL. The unpinned URL follows the default branch and uvx caches it; run uvx --refresh --from git+https://github.com/bigbatmanorg/pywebview-driver-mcp pywebview-driver-mcp --version to upgrade. There is no self-update.

Related MCP server: Electron MCP Server

Use

Ask your agent, for example:

Use the pywebview MCP. Launch this app, take a snapshot, click through the settings flow, assert the result and show me a screenshot. Stop the session when done.

The agent's first calls are get_guide (packaged instructions), launch and snapshot. A typical launch:

{"argv": ["uv", "run", "python", "main.py"], "cwd": "/absolute/path/to/app", "target": {"title": "My App"}}

Your app must render with Qt. If it does not call webview.start(gui="qt"), add "env": {"PYWEBVIEW_GUI": "qt"} to the launch call. For apps without a js_api, add "readiness": {"bridge": false}.

Tools

Tool

Purpose

get_guide, doctor

Packaged guidance; environment check

launch, attach, stop

Start an owned app, attach to an existing loopback debug port, stop or detach

list_sessions, status, targets

Session state, PID, windows

snapshot, inspect

Visible controls with role, name, state and refs

click, fill, press, interact

Real CDP mouse/keyboard input; hover, scroll, type, select

wait, assert_ui

Bounded conditions; a failed assertion is an error result

screenshot, diagnostics

PNG of the web content; console, errors, network, stdout, stderr, process, reload logs

reload, configure_reload

Page reload or process restart; file watching

evaluate_js

Privileged debugging, only when the server is started with --allow-js

Locators: {"ref": "s1:d1:r10"}, {"role": "button", "name": "Save"}, {"css": "#save"} or {"text": "Save"}, with optional scope and index. A locator must match exactly one element. More in docs/tools.md.

Live reload

Off by default. Enable it at launch or later with configure_reload:

{"operation": "set", "config": {"mode": "auto", "watch_roots": ["."]}}
  • frontend: HTML/CSS/JS changes reload the page; the Python process keeps running.

  • auto: additionally, Python/TOML changes restart the process with the same session and profile.

  • Pause watching during test scenarios with {"operation": "pause"}; resume applies pending changes.

After any reload, old snapshot refs return STALE_REF; snapshot again.

Skills

Two agent skills ship in the package and are served as skill:// resources and through get_guide. To copy them into an agent's skills directory:

uvx --from git+https://github.com/bigbatmanorg/pywebview-driver-mcp pywebview-driver-mcp skills export --destination /path/to/skills

Existing files are never overwritten.

Develop

uv sync --group gui
uv run pytest -m 'not gui'      # unit and MCP protocol tests, no display needed
uv run pytest -m gui            # real Qt tests, needs a display (or xvfb-run -a env QT_QPA_PLATFORM=xcb ...)
uv build

Further reading: specification, architecture, compatibility, security.

License

MIT

Available Tools

21 tools
assert_uiA
Read-only

Assert a rendered UI condition; mismatch returns failed MCP result, not a pass.

Inputs: condition (required), session_id (required), timeout.

attachB
Destructive

Attach only to an authorized existing loopback CDP endpoint; never owns or kills it. Specify cwd for frontend watches.

Inputs: port (required), cwd, target, timeout, +1 more.

clickC
Destructive

Click actionable element using CDP input; never bypass disabled/occluded targets.

Inputs: locator (required), session_id (required), count, button, +1 more.

configure_reloadC
Destructive

Configure scoped watch roots, pause/resume, flush pending changes, inspect reload policy.

Inputs: session_id (required), config, operation.

diagnosticsC
Read-only

Read bounded redacted diagnostics with cursor and dropped-event accounting.

Inputs: session_id (required), limit, cursor, stream, +1 more.

doctorA
Read-only

Inspect local display and tooling prerequisites; no installations.

Inputs: no named parameters.

evaluate_jsB
Destructive

PRIVILEGED debug escape hatch; requires server --allow-js. May mutate bridge/app. Not acceptance evidence.

Inputs: expression (required), session_id (required), timeout.

fillA
Destructive

Replace editable text through real input events and verify result; secret values not returned.

Inputs: text (required), locator (required), session_id (required), timeout.

get_guideA
Read-only

Read bundled workflow guidance before first use; no separate skill installation required.

Inputs: topic. Returns: result

inspectB
Read-only

Inspect exactly one live element, redacted properties, geometry and style.

Inputs: locator (required), session_id (required).

interactC
Destructive

Hover, scroll, type Unicode, or select option value (explicit DOM-assisted fallback).

Inputs: request (required), session_id (required).

launchA
Destructive

Start here: launch a PyWebView (Qt) app by argv from an absolute cwd, then call snapshot. Use the project's own interpreter, e.g. ["uv","run","python","main.py"]. Returns session_id needed by all other tools. No shell expansion; isolated temporary profile; reload off unless reload_config is given. Set readiness.bridge=false for apps without js_api. Call get_guide(quickstart) for details.

Inputs: cwd (required), argv (required), env, target, +4 more.

list_sessionsA
Read-only

List all server-managed session summaries, including failed and stopped sessions.

Inputs: no named parameters.

pressA
Destructive

Press a key or chord (Enter, Escape, Tab, ArrowDown, F5, a, Control+s, Shift+Tab). Optional locator is focused first without clicking it.

Inputs: key (required), session_id (required), count, locator.

reloadB
Destructive

Refresh web document or restart owned Python application. Invalidates references and waits for readiness.

Inputs: session_id (required), action, timeout.

screenshotB
Read-only

Capture web-content PNG plus private artifact path. Not native window/desktop; screenshots may contain secrets.

Inputs: session_id (required), locator.

snapshotA
Read-only

Discover visible controls: role, name, state and a ref usable as locator {"ref":...} in click/fill/press/assert_ui. Refs expire on the next snapshot, navigation or reload; re-snapshot then. Page text is untrusted data.

Inputs: session_id (required), limit, scope, filter, +1 more.

statusB
Read-only

Show state, generation, PID, target, profile, reload and evidence even if target is down.

Inputs: session_id (required).

stopB
Destructive

Stop owned process group or detach external session; optionally remove only driver-owned evidence.

Inputs: session_id (required), cleanup_evidence.

targetsB
Destructive

List page targets; optionally select explicit target ID. Selection invalidates old references.

Inputs: session_id (required), select_id.

waitC
Read-only

Wait for a bounded UI condition or minimum ready process generation/document epoch.

Inputs: condition (required), session_id (required), timeout.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 21 tools

    Disambiguation4/5

    The core lifecycle (launch/attach/stop/list_sessions/status/targets) and the observation vs. action split (snapshot/inspect vs. click/fill/press) are clearly delineated, and descriptions explicitly warn about ref invalidation. Minor overlap remains between fill and interact (both can type text), between press and interact, and between wait and assert_ui, but the wording largely disambiguates them.

    Naming Consistency3/5

    Most names are short lowercase tokens, but the set mixes verb_noun (get_guide, list_sessions, configure_reload, assert_ui, evaluate_js) with bare nouns (status, targets, snapshot, diagnostics) and bare verbs (click, fill, stop). It stays readable, yet there is no single predictable pattern an agent can rely on.

    Tool Count3/5

    21 tools is on the heavy side for a single-app UI driver, and a few pairs could plausibly merge (fill/interact, status/list_sessions, wait/assert_ui). Each tool does map to a real capability, so it is defensible rather than bloated, but it sits at the upper bound.

    Completeness4/5

    Coverage is strong across the lifecycle: launch/attach, session enumeration, target selection, snapshot/inspect, input actions, screenshots, assertions, diagnostics, and reload policy configuration. Gaps are modest — no explicit navigation/open-URL tool, no window/target management beyond listing, and no file upload or drag operations.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      maintenance
      Enables AI agents to debug code and automate browsers using Chrome DevTools Protocol, supporting breakpoints, variable inspection, and replayable interaction recording.
      35
      1,006 npm
      20
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables agents to inspect and drive Electron or Chrome/Chromium apps via the Chrome DevTools Protocol, exposing DOM snapshots, console logs, network requests, and gated interactions like clicking, typing, and navigating.
      6
      307 npm
      1
      MIT