MCP Screenshot Server
通用截图 MCP
一个 MCP (Model Context Protocol) 服务器,为 AI 助手提供截图功能——既包括通过 Puppeteer 进行的网页截图,也包括使用原生操作系统工具进行的跨平台系统截图。
功能特性
网页截图 — 使用无头 Chromium 浏览器捕获任何公共 URL
跨平台系统截图 — 使用原生操作系统工具进行全屏、窗口或区域捕获(macOS
screencapture,Linuxmaim/scrot/gnome-screenshot/等,Windows PowerShell+.NET)安全优先设计 — 防范 SSRF、路径遍历、DNS 重绑定、命令注入及拒绝服务 (DoS) 限制
MCP 原生 — 直接与 Claude Desktop、Cursor 及任何兼容 MCP 的客户端集成
Related MCP server: Chrome DevTools MCP
要求
Node.js >= 18.0.0
Chromium 在首次运行时由 Puppeteer 自动下载
take_system_screenshot 的平台特定要求
平台 | 所需工具 | 备注 |
macOS |
| 无需额外安装 |
Linux | 以下之一: | 推荐使用 |
Windows |
| 使用 .NET |
Linux 安装示例
# Ubuntu/Debian (recommended)
sudo apt install maim xdotool
# Fedora
sudo dnf install maim xdotool
# Arch Linux
sudo pacman -S maim xdotool
# Wayland (Sway, etc.)
sudo apt install grim安装后,您可以使用以下命令验证您的设置:
npx universal-screenshot-mcp --doctor该命令会探测主机,并针对您检测到的发行版打印出缺失工具的复制粘贴安装命令。
快速入门
从 npm 安装
npm install -g universal-screenshot-mcp或者直接使用 npx 运行:
npx universal-screenshot-mcp从源码安装
git clone https://github.com/sethbang/mcp-screenshot-server.git
cd mcp-screenshot-server
npm install
npm run build配置您的 MCP 客户端
将服务器添加到您的 MCP 客户端配置中。对于 Claude Desktop,编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"screenshot-server": {
"command": "npx",
"args": ["-y", "universal-screenshot-mcp"]
}
}
}如果是从源码安装:
{
"mcpServers": {
"screenshot-server": {
"command": "node",
"args": ["/absolute/path/to/mcp-screenshot-server/build/index.js"]
}
}
}对于 Claude Code,使用 claude mcp add 命令注册服务器:
# Project scope (current directory only)
claude mcp add screenshot-server -- npx -y universal-screenshot-mcp
# User scope (available across all projects)
claude mcp add --scope user screenshot-server -- npx -y universal-screenshot-mcp如果是从源码安装:
claude mcp add screenshot-server -- node /absolute/path/to/mcp-screenshot-server/build/index.js使用 claude mcp list 验证服务器是否已注册,或在会话中使用 /mcp 查看实时状态。
对于 Cursor 或其他 MCP 客户端,请查阅其文档以获取相应的配置方法。
工具
该服务器公开了两个 MCP 工具:
take_screenshot
通过无头 Puppeteer 浏览器捕获网页(或特定元素)。
参数 | 类型 | 必需 | 描述 |
| string | ✅ | 要捕获的 URL (仅限 http/https) |
| number | — | 视口宽度 (1–3840) |
| number | — | 视口高度 (1–2160) |
| boolean | — | 捕获整个可滚动页面 |
| string | — | 用于捕获特定元素的 CSS 选择器 |
| string | — | 捕获前等待此选择器出现 |
| number | — | 延迟毫秒数 (0–30000) |
| string | — | 输出文件路径 (默认: |
示例提示词:
对 https://example.com 进行 1920x1080 的截图
take_system_screenshot
使用原生操作系统工具捕获桌面、特定应用程序窗口或屏幕区域。适用于 macOS、Linux 和 Windows。
参数 | 类型 | 必需 | 描述 |
| enum | ✅ |
|
| number | — | 窗口模式下的窗口 ID |
| string | — | 窗口模式下的应用名称 (例如 |
| object | — | 区域模式下的 |
| number | — | 多显示器设置下的显示器编号 |
| boolean | — | 在捕获中包含鼠标光标 |
| enum | — |
|
| number | — | 捕获延迟秒数 (0–10) |
| string | — | 输出文件路径 (默认: |
跨平台功能支持
功能 | macOS | Linux | Windows |
全屏 | ✅ | ✅ | ✅ |
区域 | ✅ | ✅ (maim, scrot, grim, import) | ✅ |
按名称窗口 | ✅ | ⚠️ X11 + xdotool | ⚠️ 尽力而为 |
按 ID 窗口 | ✅ | ✅ 仅限 X11 | ⚠️ HWND |
多显示器 | ✅ | ⚠️ 依赖工具 | ✅ |
包含光标 | ✅ | ⚠️ 依赖工具 | ⚠️ |
延迟 | ✅ | ✅ | ✅ |
示例提示词:
对 Safari 窗口进行系统截图
配置
环境变量
变量 | 默认值 | 描述 |
|
| 相对于 |
|
| 设置为 |
输出目录
截图默认保存到 ~/Documents/screenshots (可通过 SCREENSHOT_OUTPUT_DIR 配置)。自定义输出路径必须解析为以下允许的目录之一:
目录 | 描述 |
| 默认输出位置 (可配置) |
| 原始默认位置 |
| 用户下载文件夹 |
| 用户文档文件夹 |
| 系统临时目录 |
安全性
本服务器实现了多层安全加固:
ID | 威胁 | 缓解措施 |
SEC-001 | SSRF / DNS 重绑定 | URL 针对被阻止的 IP 范围进行验证;通过 |
SEC-003 | 命令注入 | 所有子进程均使用 |
SEC-004 | 路径遍历 | 输出路径使用 |
SEC-005 | 拒绝服务 | 并发的 Puppeteer 实例通过信号量限制为 3 个 |
详情请参阅 docs/security.md。
开发
脚本
命令 | 描述 |
| 将 TypeScript 编译为 |
| 文件更改时重新编译 |
| 单元测试 (快速,完全模拟) |
| 集成测试 (真实 DNS/文件系统) |
| 端到端测试 (真实 Puppeteer/原生工具) |
| 运行所有层级的测试 |
| 通过 Docker 进行 Linux 端到端测试 (需要 Docker) |
| 在监视模式下运行测试 |
| 运行测试并生成覆盖率报告 |
| 使用 ESLint 对源码进行 Lint 检查 |
| 启动 MCP Inspector 进行调试 |
项目结构
src/
├── index.ts # Entry point — stdio transport
├── server.ts # MCP server factory
├── config/
│ ├── index.ts # Static constants (limits, allowed dirs)
│ └── runtime.ts # Singleton semaphore, default directory
├── tools/
│ ├── take-screenshot.ts # Web page capture tool
│ └── take-system-screenshot.ts # macOS system capture tool
├── types/
│ └── index.ts # Shared TypeScript interfaces
├── utils/
│ ├── helpers.ts # Response builders, file utilities
│ ├── screenshot-provider.ts # Cross-platform provider interface + factory
│ ├── macos-provider.ts # macOS: screencapture wrapper
│ ├── linux-provider.ts # Linux: maim/scrot/gnome-screenshot/etc.
│ ├── windows-provider.ts # Windows: PowerShell + .NET System.Drawing
│ ├── macos.ts # Window ID lookup via CoreGraphics
│ └── semaphore.ts # Async concurrency limiter
└── validators/
├── path.ts # Output path validation (SEC-004)
└── url.ts # URL/SSRF validation (SEC-001)测试
测试使用 Vitest 分为三个层级:
单元测试 (
npm test) — 完全依赖注入,无真实 I/O。快速反馈循环。集成测试 (
npm run test:integration) — 真实 DNS 解析,带有临时目录的真实文件系统,针对本地 HTTP 服务器的真实 Puppeteer。端到端测试 (
npm run test:e2e) — 真实原生截图工具。macOS 测试在本地运行;Linux 测试通过npm run test:linux在 Docker 中运行。
npm test # Unit tests (~300ms)
npm run test:linux # Linux provider tests in Docker
npm run test:all # Everything使用 MCP Inspector 调试
npm run inspector这将启动连接到您已构建服务器的 MCP Inspector,允许您交互式地调用工具。
许可证
Apache-2.0 — 版权所有 2026 Seth Bang
Available Tools
2 toolstake_screenshotB
Capture web page or element via headless browser. Saves to ~/Documents/screenshots by default (configurable via SCREENSHOT_OUTPUT_DIR env var).
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to capture | |
| width | No | Viewport width | |
| height | No | Viewport height | |
| fullPage | No | Capture full page | |
| selector | No | CSS selector for element | |
| waitForSelector | No | Wait for selector | |
| waitForTimeout | No | Delay in ms | |
| outputPath | No | Absolute path, or relative to home dir |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden but only mentions method and save location; it omits critical behavioral traits like destructiveness, permission needs, or return value.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two concise sentences: first states purpose, second details save behavior. Front-loaded and no wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite 8 parameters and no output schema, the description omits return value, error handling, and other essential context, leaving significant gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema covers all 8 parameters with descriptions, so baseline is 3. The description adds the default save path and env var override, providing marginal extra context.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses specific verb 'capture' and resource 'web page or element' with method 'via headless browser', clearly distinguishing it from sibling 'take_system_screenshot' which captures system screens.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for web screenshots but does not explicitly state when to use versus alternatives, nor does it mention prerequisites or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
take_system_screenshotA
Capture desktop, window, or region screenshot. Cross-platform: macOS (screencapture), Linux (maim/scrot/gnome-screenshot/etc.), Windows (PowerShell+.NET). Saves to ~/Documents/screenshots by default (configurable via SCREENSHOT_OUTPUT_DIR env var). For window mode, provide windowName (app name like "Safari") or windowId.
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | fullscreen=entire screen, window=specific app (requires windowName or windowId), region=coordinates | |
| windowId | No | Window ID (for window mode) | |
| windowName | No | App name like "Safari", "Firefox" (for window mode) | |
| region | No | Region {x,y,width,height} | |
| display | No | Display number | |
| includeCursor | No | Include cursor | |
| format | No | Image format (png or jpg) | |
| delay | No | Delay seconds | |
| outputPath | No | Absolute path, or relative to home dir |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must carry the full burden. It discloses the default save location and cross-platform tool dependencies but does not mention return behavior (e.g., file path or binary), permission requirements, or failure modes.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise with 4 sentences, front-loading the main action. It effectively uses bullet-like information for cross-platform details and mode instructions, though it could be slightly more structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 9 parameters including a nested object and no output schema, the description covers default directory and platform support but omits return value, error handling, and comparison with the sibling tool. It is adequate but not fully complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the baseline is 3. The description adds minor value by specifying default output directory and that windowName is an app name, but the schema already describes all parameters adequately.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Capture desktop, window, or region screenshot' with specific verb and resource. It distinguishes from the sibling tool 'take_screenshot' by specifying cross-platform support and modes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context for when to use each mode (fullscreen, window, region) and gives examples for window mode. However, it lacks guidance on when not to use this tool versus the sibling 'take_screenshot', missing explicit exclusion or alternative differentiation.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v1.2.0- Changed
take_screenshot10 fields changed- added
Input schema / $schemaAdded value: +"http://json-schema.org/draft-07/schema#" - added
Input schema / additionalPropertiesAdded value: +false - changed
Input schema / properties / fullPage / descriptionPrevious value: -"Capture full scrollable page"New value: +"Capture full page" - changed
Input schema / properties / height / descriptionPrevious value: -"Viewport height in pixels"New value: +"Viewport height" - changed
Input schema / properties / outputPath / descriptionPrevious value: -"Custom output path (optional)"New value: +"Absolute path, or relative to home dir" - added
Input schema / properties / selectorAdded value: +{ + "description": "CSS selector for element", + "type": "string" +} - changed
Input schema / properties / url / descriptionPrevious value: -"URL to capture (can be http://, https://, or file:///)"New value: +"URL to capture" - added
Input schema / properties / waitForSelectorAdded value: +{ + "description": "Wait for selector", + "type": "string" +} - added
Input schema / properties / waitForTimeoutAdded value: +{ + "description": "Delay in ms", + "maximum": 30000, + "minimum": 0, + "type": "number" +} - changed
Input schema / properties / width / descriptionPrevious value: -"Viewport width in pixels"New value: +"Viewport width"
- Added
take_system_screenshot
1 tool update
- First observed
take_screenshot
TDQS
Scored across 2 tools
The two tools are clearly distinct: one captures web pages/elements via headless browser, the other captures desktop/system screenshots. There is no overlap in functionality.
Both tools follow a consistent verb_noun pattern with snake_case (take_screenshot, take_system_screenshot), using the same 'take_' prefix.
Only 2 tools for a screenshot server is minimal but still covers the core use cases. More tools might be expected for management or configuration, but the count is not severely inadequate.
The tool set covers the primary screenshot domains (web and system). Minor gaps exist, such as listing or deleting screenshots, but core functionality is well-covered.
Maintenance
Related MCP Connectors
Browserless MCP — wraps the Browserless headless-Chromium REST API (browserless.io)
Screenshot any URL/HTML as PNG/JPEG/WebP, or read it as clean Markdown/text for LLMs.
Clean PNG/JPEG screenshots via REST or MCP, with goal-driven multi-step navigation.
Screenshot, PDF, OG-image, and page extraction (markdown/JSON) over MCP. Bearer key or x402.
Related MCP Servers
- AlicenseAqualityDmaintenanceCaptures screenshots of web pages using Puppeteer, allowing AI agents to visually verify web applications and see their progress when generating web apps.557MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI coding assistants to control and inspect a live Chrome browser through Chrome DevTools. Provides browser automation, performance analysis, debugging capabilities, and network request monitoring.1,060,051 npm53,197Apache 2.0
- AlicenseCqualityDmaintenanceEnables taking screenshots of web pages with support for multiple devices (desktop, mobile, tablet), custom dimensions, full-page capture, and various image formats. Built with Playwright for reliable web page rendering and screenshot generation.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to capture any public URL as PNG, JPEG, or PDF via REST API or MCP tools, including screenshot capture, page description, and PDF rendering.10 npmMIT