Touchpoint 标志

Touchpoint

组织
Touchpoint-Labs

Give your AI agent eyes and hands on any desktop — cross-platform accessibility API with MCP server

发布者Touchpoint-Labs
代码仓库Touchpoint
语言Python
复刻数
5
星标数
47
可用工具
0
传输类型stdio
分类
许可协议MIT
链接
  • 将工具接入 AI 工作流

    Touchpoint 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 47 个 Star 和 5 个 Fork。


Touchpoint is a cross-platform Python library for reading and interacting with desktop UI through native accessibility APIs. One import, one API — works on Linux, macOS, and Windows, with built-in support for Chromium and Electron apps via CDP (Chrome DevTools Protocol).

Instead of scraping pixels or running vision models, Touchpoint reads the real accessibility tree — structured names, roles, states, and positions for every element on screen. Fast and reliable, with no vision model required. Ships with an MCP server so LLM agents like Claude, Cursor, or any local model can control any desktop app out of the box.

python
import touchpoint as tp

elements = tp.find("Send", role=tp.Role.BUTTON, app="Slack")
tp.click(elements[0])

Why Touchpoint?

Screenshot / visionBrowser automationTouchpoint
Native desktop apps⚠️ inaccurate or slow❌✅
Browsers⚠️ inaccurate or slow✅✅ via CDP
Electron apps (Slack, VS Code, ...)⚠️ inaccurate or slow⚠️ web content only✅ native + web
Structured element data❌ needs OCR/vision model✅ web only✅ names, roles, states, positions
Works with local / non-vision models❌✅ web only✅ all apps
Works across Linux, macOS, Windows✅✅✅

Table of Contents


Install

Requires Python 3.10+.

bash
pip install touchpoint-py

Everything is included: your platform's native backend, CDP support for browsers and Electron apps, the MCP server, and screenshot capabilities. Platform-specific dependencies are installed automatically via pip environment markers.

Platform requirements

PlatformBackendRequirement
LinuxAT-SPI2Install xdotool (required for input + minimize_window) and wmctrl (required for all window management — used for AT-SPI → X11 id mapping). Most desktops include python3-gi and gir1.2-atspi-2.0 — install them if missing.
WindowsUI AutomationNone — uses built-in COM APIs
macOSAccessibility (AX)Grant permission: System Settings → Privacy & Security → Accessibility

Quick Start

python
import touchpoint as tp

# Discover
apps = tp.apps()                            # ["Firefox", "Slack", "Terminal", ...]
windows = tp.windows()                      # Window objects with title, position, size
all_els = tp.elements(app="Firefox", named_only=True)  # only elements with text labels

# Find
results = tp.find("Search", role=tp.Role.TEXT_FIELD, app="Firefox")

# Act
tp.set_value(results[0], "touchpoint python", replace=True)
tp.press_key("enter")
tp.hotkey("ctrl", "s")                      # keyboard shortcuts

# Wait for UI changes
tp.wait_for("results", app="Firefox", timeout=10)

# Screenshot
img = tp.screenshot()                       # full desktop → PIL.Image
img = tp.screenshot(app="Firefox")           # cropped to app window

Element IDs

Every element has a unique ID like atspi:1234:1:2.0 or cdp:9222:TID:4. Action functions accept either an Element object or a bare ID string — useful for storing references across steps:

python
results = tp.find("Send", max_results=1)
element_id = results[0].id                  # "atspi:1234:1:5.2"

# later...
tp.click(element_id)                        # works with just the string

Output formats

Control how results are returned:

python
tp.elements(app="Slack", format="flat")     # one compact line per element (best for LLMs)
tp.elements(app="Slack", format="tree")     # indented parent/child hierarchy
tp.elements(app="Slack", format="json")     # full JSON with all fields

MCP Server

Touchpoint ships an MCP (Model Context Protocol) server ready for any MCP-compatible client. Use it to let LLM agents like Claude, Cursor, local models, or any tool that supports MCP control your desktop.

Two modes — vision and no-vision

Set TOUCHPOINT_MODE=no-vision (default: vision) to switch modes:

  • Vision mode — agents use screenshot() to see the screen and interact by element ID or coordinates. Best for frontier models with strong vision capabilities.
  • No-vision mode — agents use snapshot() to get a compact structured text tree of the active window, then act on element IDs directly. Works with any model including local ones that have no vision capability. Most action tools append auto-verify flags ((new window: ...), (focus moved), (no change detected)) so the agent can detect state changes without taking a screenshot.

Tools

CategoryVision modeNo-vision mode
Orientscreenshot, snapshot, apps, windowssnapshot, diff_snapshot, apps, windows
Findfind, get_elementfind
Readread_textread_text
Actionsclick (element or coordinates), set_value, set_numeric_value, select_text, focus, actionclick (element only), set_value, set_numeric_value, select_text, focus, action
Keyboardtype_text, press_keytype_text, press_key
Mousemouse_move, scrollscroll
Windowactivate_window, minimize_window, fullscreen_window, close_window, move_window, resize_windowactivate_window, minimize_window, fullscreen_window, close_window
Waitingwait_for, wait_for_app, wait_for_windowwait_for, wait_for_app, wait_for_window
Healthdiagnosticsdiagnostics

The MCP server includes built-in instructions that teach agents the correct workflow for each mode — including the orient → act → verify loop, when to use read_text vs find, and how to recover from errors.

         ┌──────────┐
    ┌───▶│  ORIENT  │  screenshot · apps · windows
    │    └────┬─────┘
    │         ▼
    │    ┌──────────┐
    │    │  LOCATE  │  find · snapshot · get_element
    │    └────┬─────┘
    │         ▼
    │    ┌──────────┐
    │    │   ACT    │  click · set_value · type_text · press_key
    │    └────┬─────┘
    │         ▼
    │    ┌──────────┐
    │    │  VERIFY  │───▶ Done ✅
    │    └────┬─────┘
    │         │ not yet
    └─────────┘

Client setup

Config file location:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
json
{
  "mcpServers": {
    "touchpoint": {
      "command": "touchpoint-mcp"
    }
  }
}

If using a virtualenv, use the full path: "/path/to/venv/bin/touchpoint-mcp"

Add to .vscode/mcp.json in your workspace:

json
{
  "servers": {
    "touchpoint": {
      "command": "touchpoint-mcp"
    }
  }
}

Create or edit ~/.cursor/mcp.json:

json
{
  "mcpServers": {
    "touchpoint": {
      "command": "touchpoint-mcp"
    }
  }
}

Edit ~/.codeium/windsurf/mcp_config.json:

json
{
  "mcpServers": {
    "touchpoint": {
      "command": "touchpoint-mcp"
    }
  }
}
bash
claude mcp add touchpoint -- touchpoint-mcp

Add to mcpServers in ~/.openclaw/openclaw.json:

json
{
  "mcpServers": {
    "touchpoint": {
      "command": "touchpoint-mcp"
    }
  }
}

Environment variables

VariableExampleDescription
TOUCHPOINT_CDP_DISCOVERtrueAuto-discover CDP ports from running processes
TOUCHPOINT_CDP_PORTS{"Chrome": 9222}Explicit app-to-port mapping (JSON)
TOUCHPOINT_CDP_APPGoogle ChromeSingle app name (pair with _PORT)
TOUCHPOINT_CDP_PORT9222Single port (pair with _APP)
TOUCHPOINT_CDP_REFRESH_INTERVAL5.0Seconds between CDP port scans
TOUCHPOINT_SCALE_FACTOR1.25Display scale override
TOUCHPOINT_FUZZY_THRESHOLD0.6Minimum match score for find() (0.0–1.0)
TOUCHPOINT_FALLBACK_INPUTtrueUse coordinate fallback when native actions fail
TOUCHPOINT_MAX_ELEMENTS5000Maximum elements per query
TOUCHPOINT_MAX_DEPTH20Default tree depth limit
TOUCHPOINT_AX_MESSAGING_TIMEOUT1.0Max seconds to wait for a macOS AX app reply

Browser & Electron Apps (CDP)

Native accessibility APIs return limited data for Electron and Chromium apps (Slack, Discord, VS Code, etc.). Touchpoint's CDP backend connects via Chrome DevTools Protocol to get the full web content.

Auto-discovery is enabled by default — Touchpoint automatically finds running browsers and Electron apps that were launched with a debug port. No manual configuration needed beyond launching the app with the flag.

Setup

  1. Launch the app with a debug port:
bash
# Linux
google-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/tp-chrome

# macOS
open -na "Google Chrome" --args --remote-debugging-port=9222 --user-data-dir=/tmp/tp-chrome

# Windows
start chrome --remote-debugging-port=9222 --user-data-dir=%TEMP%\tp-chrome
  1. Configure Touchpoint:
python
import touchpoint as tp

tp.configure(cdp_discover=True)             # auto-discover from running processes
# or
tp.configure(cdp_ports={"Google Chrome": 9222})  # explicit mapping
  1. Control what you get with the source parameter:
python
tp.elements(app="Google Chrome", source="full")     # native chrome + web content (default)
tp.elements(app="Google Chrome", source="cdp_ax")   # web content only (CDP accessibility tree)
tp.elements(app="Google Chrome", source="native")   # native UI only (toolbar, tabs, menus)
tp.elements(app="Google Chrome", source="dom")      # DOM walker (catches what AX misses)

CDP results are merged with native backend results — you get the toolbar and window controls from AT-SPI2/UIA/AX, combined with the full web page content from CDP, in a single elements() call.

source="ax" remains accepted as a compatibility alias for source="cdp_ax". Prefer cdp_ax in new code so it is not confused with the native macOS AX backend.


API Reference

Discovery

FunctionDescription
tp.apps()List application names in the accessibility tree
tp.windows()All windows with id, title, app, position, size, active state
tp.elements(app, role, states, ...)UI elements, with filtering, tree mode, and formatting
tp.element_at(x, y)Deepest element at screen coordinates
tp.get_element(id)Fresh snapshot of a single element by ID

Search & Wait

FunctionDescription
tp.find(query, app, role, ...)Search by name — 4-stage matching: exact → contains → word → fuzzy
tp.wait_for(query, ...)Poll until elements appear (or disappear with gone=True)
tp.wait_for_app(app, ...)Poll until an app appears or disappears
tp.wait_for_window(title, ...)Poll until a window appears or disappears

Actions

FunctionDescription
tp.click(element)Click via accessibility action, with coordinate fallback
tp.double_click(element)Double-click
tp.right_click(element)Right-click / context menu
tp.set_value(element, text)Set text content (replace=True to clear first)
tp.set_numeric_value(element, n)Set slider or spinbox value
tp.select_text(element, text)Select a substring within text content across Linux, Windows, macOS, and web/CDP
tp.select_text_range(element, start, end)Select a character range when you already know the offsets
tp.focus(element)Move keyboard focus
tp.action(element, name)Execute a raw accessibility action by name
tp.activate_window(window)Bring a window to the foreground (restores from minimized)
tp.minimize_window(window)Minimize a window. Use activate_window to restore.
tp.fullscreen_window(window, fullscreen=True)Enter or exit fullscreen for a window
tp.close_window(window)Politely close a window
tp.move_window(window, x, y)Move a window to a new screen position
tp.resize_window(window, width, height)Resize a window to width × height pixels

Input

FunctionDescription
tp.type_text(text)Type into the currently focused element
tp.press_key(key)Press and release a key ("enter", "tab", "escape")
tp.hotkey(*keys)Key combination (tp.hotkey("ctrl", "s"))
tp.click_at(x, y)Click at screen coordinates
tp.double_click_at(x, y)Double-click at coordinates
tp.right_click_at(x, y)Right-click at coordinates
tp.mouse_move(x, y)Move the cursor
tp.scroll(direction, amount)Scroll at current cursor position

Screenshot & Config

FunctionDescription
tp.screenshot(app, element, ...)Full desktop or cropped to app/window/element/monitor
tp.monitor_count()Number of connected monitors
tp.configure(...)Set runtime options (see Configuration)
tp.diagnostics()Report backend, input, CDP, timeout, and dependency health

All action functions accept an Element object or a string ID. elements(), find(), and get_element() support format="flat", format="json", or format="tree" (elements only) to return pre-formatted strings instead of objects. Window management is implemented across Linux AT-SPI2, Windows UIA, and macOS AX backends.


Architecture

┌───────────────────────────────────────────────────────┐
│               import touchpoint as tp                 │
│  tp.find() · tp.click() · tp.screenshot() · ...       │
│                    (Public API)                       │
├─────────────────────────┬─────────────────────────────┤
│     Backend (ABC)       │    InputProvider (ABC)      │
├─────────────────────────┼─────────────────────────────┤
│  AT-SPI2     (Linux)    │  Xdotool       (X11)        │
│  UIA         (Windows)  │  SendInput     (Win32)      │
│  AX          (macOS)    │  CGEvent       (macOS)      │
│  CDP         (browsers) │                             │
├─────────────────────────┴─────────────────────────────┤
│  Utilities: formatter · matcher · screenshot · scale  │
└───────────────────────────────────────────────────────┘

Two-layer design:

  • Backend reads the accessibility tree and runs structured actions (click, set_value, focus). Element-aware and reliable.
  • InputProvider simulates raw keyboard and mouse input. Coordinate-based and element-blind. Used as an automatic fallback when a native accessibility action isn't available.

CDP runs alongside the platform backend. Their results are merged: native window chrome (toolbar, tabs, menus) from AT-SPI2/UIA/AX, plus full web content from CDP, unified under one API.

For detailed internals, see ARCHITECTURE.md.


Configuration

python
tp.configure(
    fuzzy_threshold=0.6,          # minimum match score for find() (0.0–1.0)
    fallback_input=True,          # use InputProvider when native actions fail
    type_chunk_size=40,           # split long text into chunks for typing (0 = disable)
    max_elements=5000,            # max elements per query
    max_depth=20,                 # default tree depth limit
    scale_factor=None,            # display scale override (None = auto-detect)
    cdp_ports={"Chrome": 9222},   # explicit CDP port mapping
    cdp_discover=True,            # auto-discover CDP ports from running processes
    cdp_refresh_interval=5.0,     # seconds between CDP target scans
    ax_messaging_timeout=1.0,     # max seconds to wait for a macOS AX app reply
)

tp.diagnostics() returns a JSON-friendly health report. It includes the active backend, input provider, CDP targets, optional platform tools, configured timeouts, and macOS apps recently skipped after an AX messaging timeout.


Development

bash
git clone https://github.com/Touchpoint-Labs/touchpoint.git
cd touchpoint
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest

Status

Alpha — fully functional and tested on all three platforms. The API may change before 1.0 based on user feedback.

PlatformBackendInputCDPTests
Linux (X11)✅ AT-SPI2✅ xdotool✅✅
Windows✅ UIA✅ SendInput✅✅
macOS✅ AX✅ CGEvent✅✅

Known limitations

  • Wayland input — The Linux InputProvider uses xdotool, which requires X11. On pure Wayland (no XWayland), keyboard/mouse simulation is unavailable. The accessibility tree and native actions still work.

  • Synchronous CDP — CDP calls block on WebSocket responses. JavaScript dialogs (alert, confirm, prompt) are auto-dismissed to prevent deadlocks. An async rewrite is planned.

  • No browser navigation API — Touchpoint doesn't have built-in URL navigation. Agents can navigate by interacting with UI elements directly: find the address bar, type a URL, press Enter.

  • CDP windows are page targets, not OS windows — but window management still works: tp.activate_window() brings the target forward via CDP, and minimize/fullscreen/close/move/resize on a surfaced cdp: window are routed to the underlying native OS window (resolved by owning PID) and handled by the platform backend. They raise ActionFailedError only if no native OS window for that target can be found (e.g. it has been closed).

  • Backend role/state parity is still uneven — macOS AX and Windows UIA both improved significantly in 0.3.0, but Windows still relies on more heuristics and has more unmapped long-tail roles than the other backends.


Roadmap

High Priority

  • Async CDP architecture — non-blocking WebSocket, proper dialog queuing, concurrent multi-tab queries

Medium Priority

  • Backend role/state parity — close remaining role mapping gaps, especially UIA long-tail roles on Windows
  • Wayland input backend — libei / xdg-desktop-portal RemoteDesktop when X11 isn't available

Lower Priority

  • Tooltip and notification visibility
  • Element caching

License

MIT

将 Touchpoint MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 Touchpoint 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请保持终端窗口及其中的进程运行。
3

将 Touchpoint 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 Touchpoint MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "touchpoint": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 Touchpoint MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 Touchpoint MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 Touchpoint 帮我完成这项任务吗?
Touchpoint
当然。我已阅读。
以下是我使用 Touchpoint 得到的结果。

常见问题

Touchpoint MCP 服务器有什么用途?

Touchpoint 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 Touchpoint MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您可以让 Claude、ChatGPT、Gemini 等不同 AI 模型,或您在 TypingMind 中配置的其他模型使用 Touchpoint,而无需为每个模型单独配置 MCP 服务器。

为什么在 TypingMind 中使用 Touchpoint MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是优秀的大语言模型聊天前端之一。连接 Touchpoint 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 Touchpoint MCP 连接到 TypingMind?

Touchpoint 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

Touchpoint MCP 在 TypingMind 中提供哪些工具?

Touchpoint 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 Touchpoint MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行掌控模型提供商、API 密钥、提示词和 MCP 配置。如果 Touchpoint 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇