qt-commander
This MCP server enables AI agents to introspect and automate native Qt applications (both QWidget and QML/Qt Quick) without requiring source code changes — like Playwright for desktop Qt apps.
Process & Session Management: Discover running Qt processes (qt_list_processes), attach to a process to inject the helper library (qt_attach), manage active sessions (qt_list_sessions), and detach (qt_detach).
Build & Environment Setup: Automatically detect MSVC, MinGW, and Qt installations (qt_detect_msvc_and_qt), then build the injection library on demand with your chosen toolchain and Qt version (qt_build).
UI Introspection: Capture the full widget/QML tree as a snapshot with geometry, visibility, z-order, and properties at configurable detail levels (qt_snapshot), occlusion-prune to see what's actually visible (qt_prune_snapshot), find elements by class, text, object name, properties, and depth (qt_find_element), read/write QObject properties (qt_get_property, qt_set_property), invoke methods (qt_call_method), and take screenshots of elements or windows (qt_screenshot).
Mouse Interaction: Simulate real mouse events: click directly on elements (qt_mouse_click), double-click (qt_mouse_dbl_click), click at exact window coordinates with hit-testing (qt_mouse_click_at), click element region centers (qt_mouse_click_region), press/release for drags (qt_mouse_press, qt_mouse_release), move the pointer (qt_mouse_move), scroll (qt_mouse_wheel), and open context menus (qt_mouse_context_menu).
Keyboard Interaction: Type text into elements with optional modifiers (qt_keyboard_input), send key combos like Ctrl+C (qt_key_combo), and programmatically focus elements (qt_focus).
Everything uses real input through Qt's native event pipeline, so applications behave exactly as if a human were interacting.
Click on "Install 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-commanderAttach to the running Qt app and show its UI snapshot"
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-commander
MCP server for Qt application introspection and automation — the Playwright for native Qt, covering both QWidget and QML interfaces.
Why qt-commander
AI agents (Claude, Cursor, …) can drive native Qt applications the way Playwright drives web pages:
No source changes — the library is injected into a running process; you control any Qt app (yours or a third party's) as-is.
Both UI stacks — QWidget and QML/Qt Quick, Qt 5.15 and Qt 6.8, MSVC and MinGW.
What the agent gets — full UI snapshots with geometry, z-order, visibility, opacity and properties; occlusion-pruned views of what a human actually sees; element lookup by text / type / property; real input pipeline clicks, typing, keyboard shortcuts, drags.
Easy to try —
uv run --project <path/to/qt-commander> qt-commander-mcp; the injector and library compile on demand against any detected Qt kit.
Related MCP server: cua-plugin
Quick Start
# Launch MCP server via uv (no global Python install needed — uv resolves
# pyproject.toml / uv.lock and manages an isolated environment; the first
# run auto-syncs the project venv and installs the qt-commander-mcp script)
uv run --project /absolute/path/to/qt-commander qt-commander-mcpRequires uv and Python 3.10+.
MCP client configuration
Claude Code — add to .mcp.json / user-scope MCP config:
{
"mcpServers": {
"qt-commander": {
"command": "uv",
"args": ["run", "--project", "/absolute/path/to/qt-commander", "qt-commander-mcp"]
}
}
}The --project flag pins the project location, so no cwd is needed —
the server starts from any working directory. (A cwd-dependent launch is a
common cause of "MCP connection failed": if the client does not honor cwd,
uv run falls back to the ambient Python and the module is not found.)
Cursor / other MCP clients — same command shape; the server speaks stdio MCP and needs no other setup. See llms-install.md for the full install guide (including removing legacy pip installs).
MCP Tools
Tool | Description |
| List running Qt processes (cross-platform via psutil) |
| Inject library into a target process and open a session |
| Disconnect from a session, optionally eject the library |
| List active sessions |
| Auto-detect MSVC, MinGW toolchains, and Qt installations available for building |
| Compile injector + library on demand — |
| Capture the UI element tree — |
| Occlusion-prune a snapshot: remove elements fully covered by higher-z opaque elements (equal z ordered by creation, later covers earlier; children paint above their parent), mark partially covered ones with |
| Find elements by type, text, or property query |
| Read a QObject property |
| Write a QObject property |
| Invoke a QObject method |
| Capture a screenshot of a specific element or window |
| Send a mouse click to a UI element (direct delivery) |
| Click at an exact window coordinate — routed through the real Qt input pipeline (QPA), with real scene-graph/widget hit testing, identical to a human click |
| Click at the center of an element's on-screen region — real hit testing decides the actual target (e.g. a QML Rectangle's MouseArea) |
| Press a mouse button on an element without releasing it |
| Release a previously pressed mouse button (completes a click or a drag) |
| Move the pointer to an element-local position (drag = press → move → release) |
| Send keyboard input (typed text, optionally with held modifiers) |
| Send a shortcut such as |
| Set focus on a specific element |
Architecture
┌──────────┐ stdio ┌──────────────┐ subprocess ┌──────────────┐
│ AI Agent │ ◄────────────► │ MCP Server │ ──────────────► │ qt-injector │
└──────────┘ │ (Python) │ │ (C++) │
└──────────────┘ └──────┬───────┘
│
CreateRemoteThread
│
┌────────▼───────┐
│ libqt-commander│
│ (C++/Qt) │
└────────────────┘Component | Path | Language | Role |
MCP Server |
| Python | Protocol bridge, session management, on-demand build |
Injector CLI |
| C++ | Standalone binary that loads the library into a target process |
Injection Library |
| C++/Qt | In-process engine for UI introspection, manipulation, capture |
Shared |
| C++ | Frame protocol, TCP socket utilities |
How it works
AI Agent sends an MCP tool call (e.g.
qt_snapshot) via stdio.MCP Server spawns
qt-injector.exeas a subprocess with the target PID.qt-injector loads
libqt-commander.dllinto the target Qt process viaCreateRemoteThread+LoadLibraryW. Before injecting the library it preloads the library's transitive dependency closure (Qt DLLs the target app does not link, e.g. Qt5Widgets for a pure QML app) from the library's own directory — no manual Qt DLL copies next to the target executable are needed. It then performs a token-authenticated handshake and prints the library's TCP port to stdout.MCP Server connects to the library over TCP and relays RPC calls (snapshot, click, input, etc.) using a 4-byte length-prefix frame protocol.
Testing
Everything (C++ unit + E2E suites, pytest, and the deployment-level preload verification) runs from one CMake build tree:
# Single build tree (injector + library + test apps + all tests).
# Both Qt5 and Qt6 are supported; pick the Qt you want to validate:
# Qt5 MSVC: -DQT_MAJOR_VERSION=5 -DQt5_DIR=C:/Qt/5.15.2/msvc2019_64/lib/cmake/Qt5
# Qt6 MSVC: -DQT_MAJOR_VERSION=6 -DQt6_DIR=C:/Qt/6.8.3/msvc2022_64/lib/cmake/Qt6
# Qt6 MinGW: same, but Qt6_DIR=C:/Qt/6.8.3/mingw_64/lib/cmake/Qt6
# with the MinGW toolchain on PATH (see "MinGW" below)
cmake -S . -B build/msvc -G Ninja ^
-DBUILD_INJECTOR=ON -DBUILD_TESTS=ON -DWITH_QML=ON ^
-DCMAKE_BUILD_TYPE=Release -DQT_MAJOR_VERSION=6 ^
-DQt6_DIR=C:/Qt/6.8.3/msvc2022_64/lib/cmake/Qt6
# Build everything, then run ALL tests in one command:
cmake --build build/msvc
ctest --test-dir build/msvc --output-on-failureverify_preload (E2E deployment checks) auto-detects the Qt major AND
toolchain kit (msvc/mingw) of the deployed libqt-commander.dll and
verifies the matching DLL set — even windeployqt follows the deployment's
kit — so the same script validates Qt5/Qt6 × msvc/mingw deployments from
either build tree.
MinGW
MinGW builds are fully supported (Qt5 and Qt6 MinGW kits). Use
qt_build with toolchain="mingw": pass the MinGW toolchain's bin dir
as vcvars_path and the kit's qtenv2.bat as qt_env (MinGW Qt kits
ship qtenv2.bat just like MSVC kits). qt_detect_msvc_and_qt reports
MinGW toolchains (mingw_toolchains) and tags each Qt kit with its
kit ("msvc"/"mingw").
Notes:
Compiler version: Qt 5's official MinGW kit ships GCC 8.1, whose libstdc++ cannot compile
std::filesystemheaders (fixed in 8.3); use a GCC ≥ 9 toolchain (e.g. Qt's bundledmingw1310_64) for Qt 5 too.qt_buildpins the compiler explicitly (-DCMAKE_C/CXX_COMPILER), so other gcc builds on PATH (e.g. a Strawberry Perl toolchain) never get picked up.Runtime DLLs: MinGW executables need
libgcc_s_seh-1.dll,libstdc++-6.dll,libwinpthread-1.dllnext to them. The build deploys the compiler's own runtime (a Qt kit's older runtime lacks newer symbols), andverify_preloadmatches the deployed app's runtime to the library's.Kit matching: the injector library, its deployment, and the target application must share the same Qt kit (all MSVC or all MinGW) — mixing kits loads two Qt module sets into one process and breaks the preload closure.
ctest runs 19 suites: 14 injector C++ suites (including three real E2E
injection suites against the widget test app), 3 library C++ suites, the
full pytest suite (python_unit_tests), and the E2E preload verification
(verify_preload, labeled e2e, which needs the qt_build artifacts in
.qt-commander/bin).
The E2E suites auto-anchor their working directory to their own build
tree (test_util.h::chdir_to_exe_dir), so they produce identical results
when launched directly from the repo root or through ctest.
Quick subsets:
pytest tests/ -q # Python only
ctest --test-dir build/msvc -LE e2e # skip slow E2E
ctest --test-dir build/msvc -R "test_selector" # one suiteTest matrix (verified state, 2026-08)
Suite | Location | Language | Tests | Requires |
Server unit |
| Python | 254 | Python 3.10+ |
Injector unit |
| C++ | 326 | MSVC |
Library unit |
| C++ | 43 | MSVC + Qt |
E2E injection |
| C++ | 48 | MSVC + Qt + test app |
E2E preload |
| Python | 3 scenarios | qt_build artifacts |
Project Structure
qt-commander/
├── qt_commander/ Python MCP server
│ ├── server.py FastMCP app, 22 tools + 2 resources
│ ├── session.py Session/SessionManager with RPC lock
│ ├── rpc_client.py Subprocess injector launcher
│ ├── builder.py On-demand MSVC build orchestrator
│ ├── process_detector.py Cross-platform Qt process discovery
│ ├── environment_detector.py MSVC/Qt build environment auto-detection
│ ├── framing.py 4-byte BE length-prefix frame protocol
│ ├── occlusion.py Snapshot occlusion solving (drop covered
│ │ elements, mark visible ratio)
│ └── errors.py MCP error code registry
│
├── src/
│ ├── common/ Shared C++ utilities
│ │ ├── framing.h Frame protocol (header-only)
│ │ ├── socket_utils.h TCP abstraction
│ │ └── socket_utils.cpp
│ ├── injector/ Standalone injection CLI
│ │ ├── main.cpp Entry point, argument parsing, --list-deps, exit codes 1-6
│ │ ├── injector.h Public API declarations
│ │ ├── injector_win.cpp Win32 implementation (CreateRemoteThread, PE
│ │ │ import parser, dependency-closure preload)
│ │ ├── injector_di.cpp DI variants (IProcessOps-driven, fully testable)
│ │ └── os_ops.h IProcessOps / MockProcessOps / Win32ProcessOps
│ └── library/ Injected DLL
│ ├── entry_win.cpp DllMain / Windows entry
│ ├── api.h InitParams handshake layout (1024 bytes)
│ ├── compat_qt.h Qt5/Qt6 compatibility macros
│ ├── core/ UI scanner, event injector, screenshot, element map
│ ├── rpc/ TCP RPC server (JSON-RPC handler)
│ └── selector/ Element query engine
│
├── tests/
│ ├── unit_server/ Python unit tests (254)
│ ├── unit_injector/ C++ unit + E2E tests (326)
│ ├── unit_library/ C++ library component tests (43)
│ ├── verify_preload.py E2E: dependency preload scenarios A/B/C
│ └── test-apps/ Minimal Qt test applications
│
└── CMakeLists.txtLicense
MIT — free to use, modify, distribute, and integrate into commercial projects, with attribution.
Author
Developed and maintained by TieFeiyu.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceAn 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.221Apache 2.0
- FlicenseNot gradedqualityBmaintenanceMCP server that enables agents to control native GUI apps by snapshotting accessibility trees and performing actions like click, type, and scroll without bringing the app to the foreground.
- AlicenseNot gradedqualityAmaintenanceGives AI agents and MCP clients direct control over native desktop apps, Chrome/Electron browsers, and Android devices with screenshots, OCR, accessibility-based element lookup, input simulation, window management, CDP, and ADB in one local server.126MIT
- AlicenseAqualityCmaintenanceAn MCP server for capturing screenshots of Qt/desktop windows and performing filesystem operations, enabling AI clients to inspect and modify project files.15MIT
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/tiefeiyu/qt-commander'
If you have feedback or need assistance with the MCP directory API, please join our Discord server