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: Webpage Screenshot MCP Server
要求
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
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseAqualityDmaintenanceA lightweight Model Context Protocol (MCP) server that enables your LLM to capture screenshots of any specified URL and return only the access URL for the captured image. This tool simplifies the process of generating and sharing webpage snapshots, making it perfect for integrating visual capture ca12
- AlicenseAqualityDmaintenanceCaptures screenshots of web pages using Puppeteer, allowing AI agents to visually verify web applications and see their progress when generating web apps.557MIT
- AlicenseAqualityDmaintenanceEnables browser automation using Puppeteer through the MCP interface. Allows launching browsers, creating pages, and executing arbitrary JavaScript for web scraping, testing, and debugging tasks.51502MIT
- 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.2,211,10449,751Apache 2.0
Related MCP Connectors
Screenshot and HTML render MCP server for AI agents
Screenshot, diff, audit and sitemap-capture any web page — 5 MCP tools for AI agents.
Generate images, GIFs, and PDFs from HTML, URLs, or templates — from your AI agent.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/sethbang/mcp-screenshot-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server