qt-mcp

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.

Category
访问服务器

README

qt-mcp

PyPI Python CI Security License

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_probe in QApplication.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:

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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选