Skip to main content
Glama

screenshot-mcp

一个 MCP 服务器,用于捕获全屏截图并以内联(base64)或保存为文件的形式返回。支持 macOS、原生 Linux(X11 和 Wayland)、原生 Windows 以及 WSL2。

工具

list_monitors

列出所有已连接的显示器及其索引、分辨率和主显示器状态。请先调用此工具以查找显示器索引。

take_screenshot

捕获单个显示器的截图。

参数

类型

默认值

描述

monitor

integer

0

来自 list_monitors 的显示器索引

return

"inline"

"path"

"inline"

inline = 在响应中返回 base64 PNG(Claude 可见);path = 保存到磁盘并返回文件路径

path

string

临时文件

输出路径。仅在 return="path" 时使用

提示: 超高分辨率显示器(4K、5K)会产生巨大的 base64 数据块。如果遇到上下文限制,请切换到 return="path" 并使用 Read 工具查看文件。

Related MCP server: GetScreen MCP Server

安装

git clone https://github.com/you/screenshot-mcp
cd screenshot-mcp
npm install
npm run build

平台要求

平台

要求

macOS

无需额外配置 — 使用 screencapture 和 system_profiler(内置)

原生 Linux / X11

scrot 或 imagemagick:sudo apt install scrot

原生 Linux / Wayland

grim + wlr-randr:sudo apt install grim wlr-randr

原生 Windows

无需额外配置 — 使用 PowerShell + System.Drawing

WSL2

无需额外配置 — 在 Windows 端调用 powershell.exe

在 Claude Code 中配置

claude mcp add screenshot node /absolute/path/to/screenshot-mcp/dist/index.js

在 Claude Desktop 中配置

添加到 claude_desktop_config.json:

{
  "mcpServers": {
    "screenshot": {
      "command": "node",
      "args": ["/absolute/path/to/screenshot-mcp/dist/index.js"]
    }
  }
}

WSL2 的工作原理

WSL2 无法直接访问 Windows 显示器。此服务器会检测 WSL(通过 /proc/version 或 WSL_DISTRO_NAME),并调用 Windows 端的 powershell.exe,使用 System.Windows.Forms.Screen 和 System.Drawing 运行捕获脚本。PNG 文件通过 \wsl.localhost... UNC 路径写入 Linux /tmp 文件系统,然后被读取。

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables capturing screenshots of all connected monitors with automatic JPEG compression and multi-platform support including WSL environments. Supports quality adjustment and image resizing through simple natural language commands.
    1 npm
    ISC
  • A
    license
    B
    quality
    F
    maintenance
    Enables AI assistants running in WSL to capture Windows screenshots of full desktops, specific monitors, or individual windows by title or process name. It features DPI awareness, automatic path conversion between WSL and Windows, and customizable storage options.
    1
    3
    MIT