qt-mcp
An MCP server for inspecting, debugging, and interacting with PySide6 desktop applications. It enables AI agents to capture UI snapshots, read widget properties, and perform actions like clicking buttons or typing text.
README
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
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 dev
Quick 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 created
2. 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 |
|---|---|
qt_snapshot |
Capture the full widget tree as a structured snapshot |
qt_screenshot |
Take a screenshot of a widget or full window |
qt_widget_details |
Get detailed properties of a specific widget |
qt_click |
Click a widget (left/right/middle button, modifiers) |
qt_type |
Type text into a widget |
qt_key_press |
Send a key event (Return, Escape, Ctrl+S, etc.) |
qt_set_property |
Set a Qt property on a widget |
qt_invoke_slot |
Invoke a slot/method on a QObject |
qt_list_windows |
List all top-level windows |
qt_object_tree |
Get the full QObject parent-child tree |
qt_scene_snapshot |
Get all items in a QGraphicsScene |
qt_vtk_scene_info |
Get VTK scene state (camera, actors) |
qt_vtk_screenshot |
Capture a VTK render window |
Environment Variables
| Variable | Default | Description |
|---|---|---|
QT_MCP_PROBE |
unset | Set to 1 to auto-activate the probe |
QT_MCP_PORT |
9142 |
Probe TCP listen port |
QT_MCP_HOST |
localhost |
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.toml
Troubleshooting
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 Wayland- External 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.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.