Screen Agent

Screen Agent

Enables AI assistants to capture screenshots and control desktop input (mouse, keyboard) to see and interact with your screen. Features user-first safety controls including automatic pause on user activity and app allowlists to restrict interactions to approved applications only.

Category
访问服务器

README

Screen Agent

Give AI agents eyes and hands on the desktop.

An MCP server that lets AI tools (Claude Code, Cursor, etc.) see your screen and interact with any application — with a multi-backend input system that works where others fail.

Why?

AI coding assistants are powerful but blind. Screen Agent fixes that with:

  • Multi-Backend Input Chain — three input methods (Accessibility API → CGEvent → pyautogui) tried in priority order with automatic fallback. Works with native apps, Electron apps, and game engines.
  • Input Guardian — real-time safety system that pauses all agent actions when you touch your mouse or keyboard. No other tool provides this.
  • Apple Vision OCR — zero-dependency text recognition on macOS (no 2GB PaddleOCR install needed).
  • Retina-Aware Coordinates — unified logical coordinate system that handles display scaling correctly.

Architecture

┌──────────────────────────────────┐
│          MCP Layer               │  19 tools via Model Context Protocol
├──────────────────────────────────┤
│          Engine Layer            │  InputChain (fallback) + Guardian (safety)
├──────────────────────────────────┤
│        Platform Layer            │  Protocol-based backends
│  AX → CGEvent → pyautogui       │  macOS / Linux
└──────────────────────────────────┘

Input Backend Chain

The core design challenge: pyautogui works for ~80% of apps but fails for game engines and many Electron apps. Screen Agent solves this with a Chain of Responsibility pattern:

Priority Backend Method Best For
1 AX AXPerformAction Native macOS apps — semantic, no coordinates needed
2 CGEvent CGEventPost Games, Electron — native OS event injection
3 pyautogui Python wrapper Cross-platform fallback

Each backend implements the same InputBackend protocol. If one fails, the chain automatically tries the next. All attempts are logged with telemetry for observability.

Install

pip install screen-agent

# Recommended: install macOS native backends
pip install screen-agent[macos]

Quick Start

With Claude Code

claude mcp add screen -- screen-agent serve

With Cursor / other MCP clients

Add to your MCP config:

{
  "mcpServers": {
    "screen": {
      "command": "screen-agent",
      "args": ["serve"]
    }
  }
}

Check system capabilities

screen-agent check

Tools

Perception

Tool Description
capture_screen Screenshot (full or region), returns image for vision analysis
list_windows List all visible windows with positions
get_active_window Currently focused window
get_cursor_position Current mouse position

Input (all support verify: true for post-action screenshots)

Tool Description
click Click at coordinates (left/right/middle, multi-click)
type_text Type text at cursor (Unicode via clipboard on macOS)
press_key Key press with modifiers (e.g., Cmd+C)
scroll Scroll wheel at optional position
move_mouse Move cursor without clicking
drag Click-drag between two points
focus_window Bring window to front by partial title match

OCR (requires macOS with Vision framework)

Tool Description
ocr Extract all text with bounding boxes
find_text Find text and return location
click_text Find text and click its center

Safety (Input Guardian)

Tool Description
add_app Add app to allowlist — agent can ONLY interact with listed apps
remove_app Remove from allowlist
set_region Restrict to pixel region
clear_scope Remove all restrictions
get_agent_status Guardian state, backend stats, scope info

Input Guardian

Screen Agent's unique safety system with two guarantees:

  1. User Priority — any keyboard/mouse activity instantly pauses the agent. It resumes only after you've been idle for 1.5s (configurable).
  2. Scope Lock — restrict the agent to specific apps and/or screen regions.
# Agent can only interact with Chrome and Figma
add_app("Chrome")
add_app("Figma")

# Or restrict to a region
set_region(x=0, y=0, width=800, height=600)

Configuration

All parameters are configurable via environment variables:

Variable Default Description
SCREEN_AGENT_COOLDOWN 1.5 Guardian cooldown seconds
SCREEN_AGENT_GUARDIAN_DISABLED 0 Set to "1" to disable
SCREEN_AGENT_INPUT_BACKENDS ax,cgevent,pyautogui Backend priority order
SCREEN_AGENT_MAX_DIMENSION 2000 Max screenshot dimension
SCREEN_AGENT_LOG_LEVEL INFO Logging level

Platform Support

Feature macOS Linux
Screenshot ✅ mss ✅ mss
AX Input
CGEvent Input
pyautogui Input
Window Management ✅ AppleScript ✅ wmctrl
OCR ✅ Vision Framework
Retina Scaling

Development

git clone https://github.com/chriswu727/screen-agent
cd screen-agent
pip install -e ".[dev,macos]"
pytest tests/unit/ -v
ruff check src/ 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 多个工具。

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

官方
精选