Skip to main content
Glama

winuse-mcp

在 Windows 上为 Claude Code 提供计算机使用能力。一个 MCP 服务器,让 Claude 能够看到你的屏幕并操控你的鼠标和键盘。

Claude Code 仅在 macOS 的 CLI 中内置了计算机使用功能,因此在 Windows 上,computer-use 服务器不会出现在 /mcp 中。本项目基于 Windows API 重建了相同的截图-点击循环:14 个工具、5 个依赖项、Python 3.12。

安装

需要 Windows 和 uv。将其添加到项目中的 .mcp.json 文件,或添加到 ~/.claude.json 以应用于所有项目:

{
  "mcpServers": {
    "winuse": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/ryanportfolio/winuse-mcp", "winuse-mcp"]
    }
  }
}

或者从本地克隆中安装:

{
  "mcpServers": {
    "winuse": {
      "command": "uv",
      "args": ["run", "--directory", "C:/path/to/winuse-mcp", "winuse-mcp"]
    }
  }
}

重启 Claude Code,然后让它查看你的屏幕或点击某个应用程序。

Related MCP server: Win:Computer Use

功能范围

工具

功能

screenshot()

主显示器的 PNG 截图,已缩小

left_click(x, y)

在指定点单击

double_click(x, y)

在指定点双击

triple_click(x, y)

三击,选中一行或一段

right_click(x, y)

右键菜单点击

middle_click(x, y)

中键点击

mouse_move(x, y)

移动光标而不点击

left_click_drag(start_x, start_y, end_x, end_y)

按下、拖动、释放

type(text)

在当前焦点处输入文本,非 ASCII 字符通过剪贴板传输

key(combo)

按键或组合键:enter、ctrl+s、alt+f4

scroll(x, y, direction, amount)

up、down、left、right;水平滚动通过 shift+滚轮发送

cursor_position()

当前鼠标位置

record(duration_seconds, max_frames)

最多采样 15 秒屏幕,最多 8 帧

wait(seconds)

暂停最多 10 秒后再执行下一个动作

坐标始终在截图空间内。请参见下文。

坐标工作原理

截图会被缩小,使得长边最多 1372 像素,与 Claude Code 在 macOS 上使用的目标相同。Claude 永远看不到原生像素,因此它会在缩小的图像中点击,服务器再转换回实际坐标。

一个 1920x1080 的显示器捕获为 1372x772,缩放因子为 0.715。在 686, 443 处的点击会落在实际屏幕的 960, 620 处。

服务器在启动时声明支持 DPI 感知,因此 Windows 以 125% 或 150% 显示缩放时不会导致点击位置偏移。

安全性

这将语言模型的控制权交给了你的桌面。Anthropic 自己的版本为相同的循环添加了此服务器不具备的安全护栏:每个应用程序的批准、隐藏 Claude 未经批准的应用程序、将终端排除在截图之外,以及模型端对每个操作的检查。

你获得的是:

  • Claude Code 会在每次工具调用前征求你的同意,除非你将其加入白名单。将输入工具保持为手动批准,仅将 screenshot 加入白名单。

  • 将鼠标移动到屏幕左上角可中止正在执行的动作。这是 pyautogui 的故障安全机制,它只监视那个角落。在拖动过程中中止会释放鼠标按钮,因此不会留下拖动的状态。

  • 所有可见内容都会到达模型,包括屏幕上显示的任何内容。屏幕上的文本是不可信的输入:将其中出现的指令视为提示注入风险。

局限性

  • 仅支持主显示器。

  • 你的终端不会从截图中排除,因此 Claude 会看到自己的会话。

  • record 采样静态帧,最多 8 帧。没有视频路径。

开发

uv sync
uv run winuse-mcp

scripts/client_test.py 是参考检查:它通过 stdio 与服务器进行 MCP 通信,列出工具,截图,移动鼠标并读取位置,录制帧,并断言错误的组合键会报错。

uv run python scripts/client_test.py

scripts/failsafe_test.py 覆盖了用户中止时可能遇到的路径,其间 pyautogui 被模拟,因此不需要实际中止:拖动中断仍会释放按钮,水平滚动中断仍会释放 shift,和弦解析处理字面 +,并且没有点击能落在故障安全像素上。

uv run python scripts/failsafe_test.py

本 README 是构建生成的。页面上的每个数字在构建时都会从源重新计算,如果出现偏差则构建失败。

node scripts/readme/build.mjs

许可证

MIT

Maintenance

ActivityActive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    An MCP server that lets Claude Desktop and Claude Code control your PC — take screenshots, click, type, manage windows, and more.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP server that gives Claude human-like control of a Windows PC with its own virtual cursor, an emergency stop, and a manager UI.
    1
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    MCP server that enables Claude to control your computer, similar to Anthropic's computer use but easy to set up locally.
    2,132 npm
    392
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    An MCP server that lets Claude operate your real computer by moving the actual mouse, clicking, typing, and reading the actual screen, working with your own logged-in sessions in any application.
    50 PyPI
    1
    MIT