pywebview-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| PYWEBVIEW_MCP_PORT | No | HTTP bridge port (default 7891) | 7891 |
| PYWEBVIEW_MCP_CDP_PORT | No | Chrome DevTools port for screenshots (default 9222) | 9222 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| logging | {} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| extensions | {
"io.modelcontextprotocol/ui": {}
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| screenshotA | Capture a screenshot of the webview page (or a specific element by ID). Uses CDP (edgechromium/qt renderer). Call this first to orient yourself. |
| get_dom_treeA | Get the DOM tree of the page as JSON. Each element has: id, tag, html_id, class, role, text, visible, bounds, children. Use element IDs from this tree in other tools. |
| get_element_infoA | Get detailed properties of a specific DOM element by MCP id. |
| get_app_stateA | Get app-level state: page title, URL, focus element, pywebview platform. |
| find_elementB | Search DOM elements by CSS selector, tag, html id, ARIA role, text, or visibility. Examples: find_element(selector="#launch-btn") find_element(text="Launch") find_element(role="button") |
| clickA | Click an element or page coordinate.
|
| double_clickC | Double-click an element. |
| type_textB | Type text into an input element (focuses it first). |
| press_keyA | Press a key on the focused element. Named keys: enter, escape, tab, backspace, delete, arrows, space, home, end, f1–f6. |
| scrollB | Scroll the page or an element. dy > 0 scrolls down. |
| get_logsB | Get the last n Python logging records from the app. |
| get_app_outputA | Get the last n lines of the launched app's stdout/stderr. Only works for apps started via launch_app on this server. |
| eval_pythonA | Evaluate Python in the app process. Context: window, webview, api (js_api object). WARNING: debugging only. |
| eval_jsC | Execute JavaScript in the webview page and return the result. |
| call_apiB | Call a js_api method directly on the Python object exposed to the page. Example: call_api("get_state") when the app exposes state via js_api. |
| get_launch_helpA | Return how to call launch_app — especially the script parameter. Call this before launch_app when you are unsure which entry .py to use or whether script should include a subfolder path. |
| launch_appA | Launch a pywebview app with the MCP bridge injected, then wait until the UI is ready. |
| wait_until_readyC | Wait until DOM is ready and pywebview API is available. |
| wait_for_idleA | Wait until the page has been quiet (no DOM mutations) for quiet_ms. |
| get_app_statusB | Report process + bridge health; detect likely native dialog blocks. |
| list_actionsA | List clickable buttons, links, and role=button elements. |
| trigger_actionA | Click a button/link by html id (name) or visible text without DOM traversal. |
| stop_appB | Stop a previously launched app (started via launch_app). |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 23 tools
Most tools have distinct purposes, but there is notable overlap between get_app_status, get_app_state, get_app_output, and get_logs — all retrieve different kinds of app information. Also, trigger_action, click, and double_click all perform clicking actions, though their contexts differ.
Tool names generally follow a verb_noun pattern (get_app_status, find_element, type_text), but a few deviate: wait_until_ready/wait_for_idle use different prepositional forms, screenshot is a noun-as-verb, and eval_python/eval_js break the get_* pattern. Overall still recognizable.
23 tools is on the heavier side but appropriate for a pywebview automation server that needs to cover app lifecycle, DOM inspection, interaction, and evaluation. Each tool addresses a distinct aspect of webview control, so the count is justified.
The toolset covers the full lifecycle: launch, wait, interact (click, type, press, scroll), inspect (DOM, elements, state), evaluate (JS, Python, API), log retrieval, and stop. Minor gaps like explicit navigation or window resizing exist, but these may be unnecessary for pywebview's fixed-window model.