电脑操作控制服务

Computer Use 是一个通过 MCP 协议为 Linux/X11 桌面提供鼠标、键盘、截图与屏幕录制等控制能力的服务,适用于 AI 助手(如 Claude Code)执行 GUI 自动化操作。

  • by PegasisForever
  • Rust
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 PegasisForever/computer-use

使用说明

computer-use

MCP server providing computer use capabilities (mouse, keyboard, screenshots, screen recording) on Linux/X11.

Communicates over stdio using the MCP protocol.

Requirements

  • Linux with X11 at 1920x1080 resolution
  • xdotool and ffmpeg installed
  • CPU with AVX2 support

Tools

Tool Description
left_click(x?, y?) Left click with 3-screenshot flow (pressed, loading, loaded)
left_double_click(x?, y?) Double-click the left mouse button
right_click(x?, y?) Right-click
middle_click(x?, y?) Middle-click
mouse_move(x, y) Smooth mouse move with ease-in-out interpolation
scroll(x?, y?, amount) Smooth scroll (positive = down, negative = up)
screenshot() Capture screenshot
key(keys) Press key combo (e.g. ctrl+c, Return, alt+Tab)
type(text) Type text string
start_recording() Begin screen recording with frame deduplication
stop_recording() Stop recording and return file path
add_recording_marker(title, description) Insert a 3-second marker scene into the recording

All coordinates are in 1456x819 space (scaled to 1920x1080 internally).

Usage with Claude Code

  1. Download the latest release binary:
mkdir -p ~/.local/bin
curl -L -o ~/.local/bin/computer-use \
  https://github.com/PegasisForever/computer-use/releases/latest/download/computer-use-linux-x86_64
chmod +x ~/.local/bin/computer-use
  1. Add the MCP server to your Claude Code settings (~/.claude/settings.json) (note: you need to use full path here):
{
  "mcpServers": {
    "computer-use": {
      "command": "/home/YOUR_USER/.local/bin/computer-use"
    }
  }
}
  1. Restart Claude Code. The computer use tools will be available automatically.

Testing locally with MCP Inspector

MCP Inspector lets you interact with MCP servers directly in the browser.

  1. Build the server:
cargo +nightly build --release
  1. Launch the inspector, pointing it at the binary:
npx @modelcontextprotocol/inspector target/release/computer-use
  1. Open the URL printed by the inspector (usually http://localhost:6274). You can browse the available tools, call them with parameters, and see the returned screenshots.

Building from source

# Requires Rust nightly (for std::simd)
cargo +nightly build --release

The binary is at target/release/computer-use.

Creating a release

./release.sh

This compiles a production binary, strips debug symbols, and creates a GitHub release tagged with the version from Cargo.toml.