qt-mcp

qt-mcp

An MCP server for capturing screenshots of Qt/desktop windows and performing filesystem operations, enabling AI clients to inspect and modify project files.

Category
访问服务器

README

Qt MCP

An MCP (Model Context Protocol) server for inspecting Qt applications through screenshots and performing basic filesystem operations.

qt-mcp 0.3.0 lets an MCP-capable AI client see a Qt or desktop application, inspect complete windows, selected regions, or named widgets, and read or update nearby project files. It uses the MCP Python SDK v1.28.1 high-level FastMCP API and stdio transport. The architecture is inspired by VibeUE, adapted for Qt and general desktop windows.

Features at a glance

Screenshot tools

  • Enumerate visible top-level windows and their geometry.
  • Capture a whole window by exact or partial title.
  • Capture an absolute screen rectangle or a rectangle relative to a window.
  • Capture a named QWidget precisely through the standalone proxy/agent or the embedded server.
  • Let the standalone server wait for an agent-enabled Qt app to attach over a Unix domain socket.
  • Return screenshots directly as PNG image content to the MCP client.

Filesystem tools

  • Read and write text files.
  • List and create directories.
  • Move, rename, and delete files or directory trees.
  • Inspect file metadata.
  • Search recursively by glob or regular-expression content.

See the complete tool reference for exact signatures and return shapes.

Platform support

Platform Window enumeration Screen grab Extra system dependency
Linux/X11 wmctrl -lG, with xwininfo fallback mss wmctrl or x11-utils
Windows Win32 EnumWindows through stdlib ctypes mss None

Wayland and macOS are not currently supported by the OS-level window-discovery path. Linux also has an optional ImageMagick import fallback if mss cannot grab the display.

Requirements

  • Python 3.10 or newer.
  • An active desktop session.
  • Linux: an X11 session with DISPLAY set, plus wmctrl or xwininfo from x11-utils.
  • Windows: no additional system package.

On Debian or Ubuntu:

sudo apt install wmctrl
# Alternatively: sudo apt install x11-utils

Quick start

From the repository root:

python3 -m venv .venv
.venv/bin/pip install -e .
.venv/bin/python -m qt_mcp.server

On Windows PowerShell:

py -m venv .venv
.venv\Scripts\python.exe -m pip install -e .
.venv\Scripts\python.exe -m qt_mcp.server

The installed console script is also available as .venv/bin/qt-mcp on Linux or .venv\Scripts\qt-mcp.exe on Windows. The server uses stdin and stdout for MCP JSON-RPC, so it normally should be launched by an MCP client rather than an interactive terminal.

Proxy mode

A Qt app can remain a normal application and opt into exact widget capture with one call:

from qt_mcp.agent import start_agent
agent = start_agent(window)

The MCP client launches standalone qt_mcp.server, which listens on /tmp/qt-mcp-<uid>.sock on Linux/macOS or the qt-mcp-<username> named pipe on Windows, then proxies capture_widget(widget_name) to the attached app's GUI thread. See the complete proxy/agent integration recipe.

Connect an MCP client

Claude Code, Cursor, Antigravity, and other stdio MCP clients use the same command-and-arguments pattern. Put the server entry in the client's MCP configuration file; the exact configuration-file location varies by client.

Use the absolute path to the virtual environment's Python executable. GUI clients often start with a restricted PATH, so relying on python or qt-mcp being globally discoverable is fragile.

Linux

{
  "mcpServers": {
    "qt-mcp": {
      "command": "/home/you/projects/Gui Editor MCP/.venv/bin/python",
      "args": ["-m", "qt_mcp.server"]
    }
  }
}

Windows

{
  "mcpServers": {
    "qt-mcp": {
      "command": "C:/Users/you/projects/Gui Editor MCP/.venv/Scripts/python.exe",
      "args": ["-m", "qt_mcp.server"]
    }
  }
}

Forward slashes avoid JSON backslash escaping on Windows. A Linux template is also available in mcp-config.example.json.

Three operating modes

Mode Process model Tools Widget capture Best for
Standalone OS capture, qt_mcp.server Separate stdio server observes desktop windows 15 OS-level windows and regions Zero-change setup and quick inspection
Standalone proxy + Qt agent The same standalone server proxies to one attached Qt app 15 Real QWidget.grab() through capture_widget(widget_name) Reusable server plus a normal independently launched Qt app
In-process example, examples/qt_editor/ Qt app embeds FastMCP in a background thread 14 Real QWidget.grab() through its own tool signature Tight coupling where the app itself is the MCP server

The standalone server always advertises 15 tools; its three proxy tools start the platform transport lazily and require an attached agent for widget operations. OS-level mode requires no target-app changes. Proxy and in-process modes both capture occluded or off-screen widgets precisely. Follow the integration guide, and see the implementations in src/qt_mcp/agent.py and examples/qt_editor/.

Example workflow

# 1. Find the Qt app window
list_windows()
# -> {"windows": [{"id": "0x038...", "title": "My Qt App — main.cpp", ...}], ...}

# 2. Capture the whole window (the vision model receives the PNG)
capture_window(title="My Qt App")

# 3. Capture a panel relative to that window
capture_region(title="My Qt App", x=10, y=40, width=400, height=300)

# 4. Save inspection notes through the filesystem tools
write_file(path="/tmp/notes.md", content="Top panel shows the toolbar...")

This screenshot-to-inspection-to-filesystem loop lets the client correlate the rendered interface with the files that produce it.

Project layout

.
├── docs/
│   ├── ARCHITECTURE.md
│   ├── DEVELOPMENT.md
│   ├── INTEGRATION.md
│   └── TOOLS.md
├── examples/
│   ├── qt_editor/
│   │   ├── __init__.py
│   │   ├── editor_window.py
│   │   ├── main.py
│   │   └── mcp_server.py
│   └── qt-editor.mcp-config.example.json
├── src/qt_mcp/
│   ├── __init__.py
│   ├── agent.py
│   ├── agent_proxy.py
│   ├── filesystem.py
│   ├── protocol.py
│   ├── screenshots.py
│   └── server.py
├── tests/
├── mcp-config.example.json
├── pyproject.toml
└── README.md

Documentation

  • Tool reference — exact signatures, parameters, return shapes, and calls for all standalone and in-process tools.
  • Integration guide — how to use OS-level capture, attach an agent to the standalone proxy, or embed a server in your Qt app.
  • Architecture — capture pipeline, module responsibilities, concurrency model, dependencies, and errors.
  • Development — contributor setup, manual stdio testing, adding tools, platform checks, and releases.

Roadmap

  • Add Wayland OS-level capture through platform-appropriate tools or portals.
  • Add macOS window discovery and capture.
  • Generalize CaptureBridge into a reusable package component.
  • Add configurable screenshot persistence.
  • Expand automated platform and protocol tests.

License

MIT

推荐服务器

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 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

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

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

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

官方
精选
TypeScript
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 模型以安全和受控的方式获取实时的网络信息。

官方
精选