qt-mcp
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., "@qt-mcp Take a snapshot of the UI and click the 'Submit' button"
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.
qt-mcp
MCP (Model Context Protocol) server for inspecting, debugging, and interacting with Qt/PySide6 desktop applications — like Playwright MCP, but for desktop Qt apps.
Overview
qt-mcp gives AI coding agents full visibility into running PySide6 applications:
Widget tree snapshots — structured accessibility-like view of the entire UI
Property inspection — read all Qt properties on any widget
Interaction — click buttons, type text, press keys
Screenshots — capture any widget or full window as PNG
QGraphicsScene inspection — enumerate and inspect scene items
VTK/PyVista support — inspect 3D scenes and capture renders
Related MCP server: tkinter-mcp-server
Architecture
┌─────────────────────────────────────────────┐
│ Target PySide6 Application │
│ ┌───────────────────────────────────────┐ │
│ │ qt-mcp Probe (in-process) │ │
│ │ • QObject tree traversal │ │
│ │ • Property read/write │ │
│ │ • Widget.grab() screenshots │ │
│ │ • Event injection (click/type) │ │
│ │ Listens on: localhost:9142 │ │
│ └───────────────────────────────────────┘ │
└──────────────────┬──────────────────────────┘
│ JSON-RPC over TCP
┌──────────────────┴──────────────────────────┐
│ qt-mcp MCP Server (separate process) │
│ • Speaks MCP protocol (stdio) to Claude │
│ • Translates tool calls → probe RPCs │
└─────────────────────────────────────────────┘Installation
# Install with uv
uv add qt-mcp
# Or install from source
git clone https://github.com/0xCarbon/qt-mcp.git
cd qt-mcp
uv sync --extra devQuick Start
1. Instrument your app
Add the probe to your PySide6 application:
# Option A: Environment variable (preferred)
# QT_MCP_PROBE=1 python -m your_app
# Option B: Explicit init
from qt_mcp.probe import install
install() # call after QApplication is created2. Configure Claude Code
Add to your MCP settings:
{
"mcpServers": {
"qt-mcp": {
"command": "uvx",
"args": ["qt-mcp"]
}
}
}3. Use from Claude
Claude can now see and interact with your Qt app:
"Take a snapshot of the running application" "Click the 'Apply' button" "Type 'hello' into the search field" "Show me a screenshot of the 3D view"
MCP Tools
Tool | Description |
| Capture the full widget tree as a structured snapshot |
| Take a screenshot of a widget or full window |
| Get detailed properties of a specific widget |
| Click a widget (left/right/middle button, modifiers) |
| Type text into a widget |
| Send a key event (Return, Escape, Ctrl+S, etc.) |
| Set a Qt property on a widget |
| Invoke a slot/method on a QObject |
| List all top-level windows |
| Get the full QObject parent-child tree |
| Get all items in a QGraphicsScene |
| Get VTK scene state (camera, actors) |
| Capture a VTK render window |
Environment Variables
Variable | Default | Description |
| unset | Set to |
|
| Probe TCP listen port |
|
| Probe TCP host (MCP server side) |
Development
# Install dev dependencies
uv sync --extra dev
# Run tests
uv run pytest -v
# Format
uv run ruff format src/ tests/
# Lint
uv run ruff check src/ tests/
# Security audit
uv run pip-audit --progress-spinner off
gitleaks detect --source . --config .gitleaks.tomlTroubleshooting
Probe not connecting
Ensure the probe is installed in the target app (check for
qt_mcp_probeinQApplication.children())Verify the port matches between probe and MCP server (
QT_MCP_PORT)Check that nothing else is using port 9142
Wayland issues
QWidget.grab()works from inside the process on both X11 and WaylandExternal screenshot tools may require portal authorization on Wayland
OpenGL widgets
QOpenGLWidget.grab()requires a real display server (X11/Wayland)With offscreen platform, grab() returns a valid pixmap but without GL content
Standard widgets and QGraphicsView work fine offscreen
License
Licensed under either of:
Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
Contributing
See CONTRIBUTING.md for development workflow and contribution requirements.
Code of Conduct
See CODE_OF_CONDUCT.md.
Security
See SECURITY.md to report vulnerabilities.
Available Tools
22 toolsqt_active_popupB
Check for active popup or modal dialog widgets.
Inputs: no named parameters. Returns: result
qt_clickB
Click a widget.
Args:
ref: Widget ref from qt_snapshot.
button: Mouse button - 'left', 'right', or 'middle'.
modifiers: Keyboard modifiers - 'shift', 'ctrl', 'alt', 'meta'.
position: [x, y] relative to widget top-left. Default: center.
Inputs: ref (required), button, modifiers, position. Returns: result
qt_get_textA
Extract text content from a text editor or input widget.
Args:
ref: Widget ref from qt_snapshot (e.g., 'w5').
Works with QPlainTextEdit, QTextEdit, QLineEdit, QLabel, QComboBox,
and any widget with a text() or toPlainText() method.
Inputs: ref (required). Returns: result
qt_invoke_slotB
Invoke a slot or method on a QObject.
Args:
ref: Widget ref from qt_snapshot.
method_name: Slot/method name to invoke.
Inputs: ref (required), method_name (required). Returns: result
qt_key_pressA
Send a key event to a widget or the focused widget.
Args:
key: Key name (e.g., 'Return', 'Escape', 'Ctrl+S', 'a').
ref: Widget ref. If omitted, sends to the currently focused widget.
Inputs: key (required), ref. Returns: result
qt_layout_checkA
Detect layout issues in the visible widget tree.
Scans all visible widgets and reports problems like:
- zero_size: Visible widget with 0x0 geometry (collapsed)
- no_layout: Container with visible children but no layout manager
- smaller_than_hint: Widget smaller than its sizeHint (content likely clipped)
- text_truncated: Text content wider than widget width
- overlapping_siblings: Sibling widgets with intersecting geometries
Inputs: no named parameters. Returns: result
qt_list_windowsB
List all top-level windows and their types.
Inputs: skip_hidden. Returns: result
qt_messagesB
Returns all console messages
Args:
level: Level of the console messages to return. Each level includes the messages
of more severe levels. Defaults to "info".
Inputs: level. Returns: result
qt_object_treeB
Get the full QObject parent-child tree (not just visible widgets).
Args:
root_ref: Starting ref. Defaults to QApplication root.
max_depth: Maximum traversal depth.
Inputs: root_ref, max_depth. Returns: result
qt_scene_snapshotC
Get all items in a QGraphicsScene.
Args:
ref: Ref to a QGraphicsView widget.
Inputs: ref (required). Returns: result
qt_screenshotA
Take a screenshot of the entire window or a specific widget.
Args:
ref: Widget ref from qt_snapshot (e.g., 'w5'). If omitted, captures active window.
full_window: If True, captures the first visible top-level window.
max_width: Max width before downscaling (default 1920).
max_height: Max height before downscaling (default 1080).
format: Image format - 'png' or 'jpeg' (default 'png').
quality: JPEG quality 1-100 (default 80, ignored for PNG).
Returns a base64-encoded PNG image.
Inputs: ref, full_window, max_width, max_height, +2 more.
qt_set_propertyB
Set a Qt property on a widget.
Args:
ref: Widget ref from qt_snapshot.
property_name: Qt property name.
value: New value for the property.
Inputs: ref (required), property_name (required), value (required). Returns: result
qt_signalsA
Inspect signal connections on a QObject.
For a given widget/object, enumerates all signals and reports which are
connected and how many receivers each has. Useful for debugging "nothing
happens when I click" problems.
Args:
ref: Widget ref from qt_snapshot (e.g., 'w5').
Inputs: ref (required). Returns: result
qt_snapshotA
Capture the full Qt widget tree as a structured accessibility-like snapshot.
Returns a YAML-like text tree with widget types, object names, text content, geometry, visibility, enabled state, and interaction refs (w1, w2, ...). Use the refs to interact with specific widgets via other tools.
Inputs: max_depth, root_ref, skip_hidden. Returns: result
qt_thread_checkA
Check thread affinity of all QObjects to detect threading issues.
Reports which threads own QObjects, flags QWidget subclasses on non-GUI threads (the #1 cause of GUI freezes), and lists QThread instances.
Inputs: no named parameters. Returns: result
qt_trigger_actionA
Trigger a menu action or toolbar action by text or index.
Args:
ref: Ref to a QMenu, QMenuBar, QToolBar, or any widget with actions.
action_text: The action's display text (e.g., 'Save', '&Open').
Ampersands are stripped for matching.
action_index: The 0-based index of the action
(matching qt_menu_items order).
Provide either action_text or action_index (not both).
Use qt_menu_items first to see available actions.
Inputs: ref (required), action_text, action_index. Returns: result
qt_typeB
Type text into a widget.
Args:
ref: Widget ref from qt_snapshot.
text: Text to type.
clear_first: If True, select all and delete before typing.
Inputs: ref (required), text (required), clear_first. Returns: result
qt_vtk_scene_infoB
Get VTK scene state from a PyVista/VTK widget.
Args:
ref: Ref to a widget containing a VTK render window.
Inputs: ref (required). Returns: result
qt_vtk_screenshotC
Capture a VTK render window to an image.
Args:
ref: Ref to a widget containing a VTK render window.
Inputs: ref (required).
qt_wait_forA
Wait for a UI state change.
Args:
condition: One of 'widget_visible', 'window_count_changed', 'property_equals'.
timeout_ms: Max time to wait in milliseconds (default 5000).
object_name: Widget objectName (for widget_visible).
ref: Widget ref (for property_equals).
property_name: Property name (for property_equals).
value: Expected value (for property_equals).
Inputs: condition (required), timeout_ms, object_name, ref, +2 more. Returns: result
qt_widget_detailsA
Get detailed properties of a specific widget.
Args:
ref: Widget ref from qt_snapshot (e.g., 'w5').
Returns all Qt properties, geometry, parent chain, and more.
Inputs: ref (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 22 tools
Most tools have distinct purposes, but some overlap exists: qt_screenshot and qt_vtk_screenshot both capture images, and qt_snapshot and qt_object_tree both provide widget tree information, though they differ in scope (visible vs. full tree). The descriptions help clarify these distinctions, but an agent might occasionally confuse them.
All tools follow a consistent 'qt_' prefix with snake_case naming, using clear verb_noun patterns (e.g., qt_click, qt_get_text, qt_list_windows). This predictability makes it easy for agents to understand and navigate the toolset.
With 22 tools, the count feels heavy for a UI testing/automation server, potentially overwhelming for agents. While the tools cover various aspects (interaction, inspection, debugging), it might benefit from consolidation or better categorization to reduce cognitive load.
The toolset comprehensively covers the domain of Qt application testing and debugging, including widget interaction (click, type), inspection (snapshot, details), debugging (signals, threads), and specialized features (VTK, screenshots). No obvious gaps are present; agents can perform full workflows from discovery to validation.
Maintenance
Related MCP Connectors
MCP server for building and testing AI agents with multi-model experimentation and insights.
Trading MCP server for AI agents, with live market data, account reads and controlled execution.
MCP server exposing the Backtest360 engine API as tools for AI agents.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server for headless Qt/PySide6 GUI testing that enables AI assistants to launch desktop applications via Xvfb and perform visual verification. It supports widget discovery, screenshot capture, and simulated user interactions like clicks, typing, and keyboard shortcuts.9MIT
- AlicenseAqualityDmaintenanceMCP server for launching, inspecting, and interacting with Tkinter GUI applications. Enables AI agents to automate Tkinter apps without code modifications.165MIT
- AlicenseBqualityDmaintenancePlaywright-style MCP server for pywebview apps that lets AI assistants see, control, and debug Python desktop web UIs without modifying source code.233MIT
- AlicenseAqualityDmaintenanceAn MCP server for capturing screenshots of Qt/desktop windows and performing filesystem operations, enabling AI clients to inspect and modify project files.15MIT