屏幕截图mcp
用于捕获屏幕截图的跨平台MCP(模型上下文协议)服务器。专为基于代理的本地应用程序测试而设计。
也可作为 Claude代码插件 带有屏幕截图测试指导。
特性
- 列出窗口:获取所有带有ID、标题和边界的可见窗口
- 列表显示:获取所有可用的监视器/显示器
- 屏幕截图窗口:按ID或标题捕获特定窗口
- 屏幕截图:捕获整个显示器
- 屏幕截图区域:捕获特定屏幕区域
安装
无需安装-直接与 npx 或 bunx.
用法
在Claude代码中配置
添加到MCP设置(~/.claude/settings.json):
{
"mcpServers": {
"screenshot": {
"command": "bunx",
"args": ["screenshot-mcp"]
}
}
}或者使用npx:
{
"mcpServers": {
"screenshot": {
"command": "npx",
"args": ["-y", "screenshot-mcp"]
}
}
}独立运行
# Using bunx (recommended)
bunx screenshot-mcp
# Using npx
npx -y screenshot-mcpMCP工具
list_windows
列出所有可见的窗口。
// Response
[
{ "id": "1234", "title": "VS Code", "app": "Code", "bounds": { "x": 0, "y": 25, "width": 1920, "height": 1055 } }
]list_displays
列出所有可用的显示器。
// Response
[
{ "id": 1, "name": "Built-in Retina Display", "primary": true, "bounds": { "x": 0, "y": 0, "width": 2560, "height": 1600 } }
]screenshot_window
捕获特定窗口。
// Parameters
{ "window_id": "1234" }
// or
{ "window_title": "VS Code" }
// optional: save to file
{ "window_id": "1234", "save_dir": "/path/to/screenshots" }screenshot_screen
捕捉整个屏幕。
// Parameters (all optional)
{ "display_id": 1, "save_dir": "/path/to/screenshots" }screenshot_region
捕捉特定区域。
// Parameters
{ "x": 100, "y": 100, "width": 800, "height": 600 }
// optional: save to file
{ "x": 100, "y": 100, "width": 800, "height": 600, "save_dir": "/path/to/screenshots" }平台支持
| 平台 | 状态 | 要求 |
|---|---|---|
| macOS | ✅ 支持 | 屏幕录制权限 |
| Windows | ✅ 支持 | PowerShell(内置) |
| Linux(X11) | ✅ 支持 | xdotool 或 wmctrl 对于窗户, gnome-screenshot/scrot/import 为了捕获 |
| Linux(Wayland) | ⚠️ 部分 | 仅限GNOME Shell, grim 用于截图 |
配置(插件设置)
创建 .claude/screenshot.local.md 在项目中设置默认保存目录:
---
default_save_dir: /Users/yourname/Desktop/screenshots
---当此文件存在时,Claude将自动使用此目录保存屏幕截图。
注: 添加 .claude/*.local.md 给你的 .gitignore.
需求
- 运行时:Bun v1.0+或Node.js 18+
macOS
- 屏幕录制权限(系统设置>隐私和安全>屏幕录制)
视窗
- PowerShell(内置,无需额外安装)
Linux(X11)
- 窗口列表:
xdotool(推荐)或wmctrl - 屏幕截图:
gnome-screenshot,scrot,或import(ImageMagick) - 显示信息:
xrandr
# Ubuntu/Debian
sudo apt install xdotool scrot
# Fedora
sudo dnf install xdotool scrot
# Arch
sudo pacman -S xdotool scrotLinux(Wayland)
- 窗口列表:仅支持GNOME Shell(通过gdbus)
- 屏幕截图:
gnome-screenshot或grim - 显示信息:
wlr-randr或退回xrandr
作为Claude代码插件
作为插件安装以获取 screenshot-testing 技能:
# Install from npm
npm install -g screenshot-mcp
claude plugin add screenshot-mcp
# Or use local development
claude --plugin-dir /path/to/screenshot-mcp该技能提供以下指导:
- 有效的屏幕截图测试工作流程
- 比较测试策略
- 多显示器测试
- Electron应用程序测试示例
许可证
麻省理工学院
