Screenshot MCP Server

Screenshot MCP Server

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.

Category
访问服务器

README

This repo is in Read Only mode and has been replaced

Use the WSLSnapIt-MCP repo instead (works better, more features!)

Screenshot MCP Server

A Model Context Protocol (MCP) server that enables AI assistants running in WSL to capture Windows screenshots with advanced features like monitor selection and window-specific capture.

Features

  • 📸 Full Desktop Capture - Capture all monitors (default behavior)
  • 🖥️ Monitor Selection - Capture specific monitors (primary, 1, 2, etc.)
  • 🪟 Window Capture - Capture specific windows by title match with DPI awareness
  • 🚀 Process Capture - Capture windows by process name (e.g., notepad.exe)
  • 📂 Custom Save Locations - Save to any folder using WSL or Windows paths
  • 🔄 Automatic Path Conversion - Converts WSL paths to Windows paths
  • 📁 Organized Storage - Screenshots saved to workspace/screenshots/ by default
  • 🎯 DPI Aware - Proper scaling for high-DPI displays
  • 🖼️ Full Window Capture - Includes window shadows and borders without clipping

Prerequisites

  • Windows with WSL (Windows Subsystem for Linux)
  • Node.js installed in WSL
  • Claude Desktop or Claude Code with MCP support

Installation

  1. Clone this repository:
git clone https://github.com/peterparker57/screenshot-mcp.git
cd screenshot-mcp
  1. Install dependencies:
npm install
# or with bun:
bun install
  1. Add to your Claude configuration (~/.claude.json or ~/.claude/claude_desktop_config.json):
{
  "mcpServers": {
    "screenshot": {
      "command": "node",
      "args": [
        "/path/to/screenshot-mcp/index.js"
      ],
      "disabled": false,
      "alwaysAllow": [
        "take_screenshot"
      ]
    }
  }
}
  1. Restart Claude Desktop/Code

Usage

Once installed, you can ask Claude to take screenshots:

Basic Usage

Take a screenshot

Capture Specific Monitor

Take a screenshot of monitor 1
Take a screenshot of the primary monitor

Capture Specific Window by Title

Take a screenshot of the "Chrome" window
Take a screenshot of window titled "Visual Studio Code"

Capture Specific Window by Process Name

Take a screenshot of notepad.exe
Take a screenshot of the chrome process
Take a screenshot of process "Code"

Custom Filename

Take a screenshot and save it as "test.png"

Save to Custom Folder

Take a screenshot and save it to /mnt/c/Users/username/Pictures/
Take a screenshot and save to C:\Users\username\Desktop\
Take a screenshot of monitor 1 and save to folder "../docs/images"

API Reference

The MCP server provides a single tool:

take_screenshot

Parameters:

  • filename (optional): Name for the screenshot file (default: "screenshot.png")
  • monitor (optional): Which monitor to capture
    • "all" - Capture all monitors (default)
    • "primary" - Capture primary monitor only
    • 1, 2, etc. - Capture specific monitor by index
  • windowTitle (optional): Capture a specific window by its title (partial match supported)
  • processName (optional): Capture a specific window by process name (e.g., "notepad.exe" or "notepad")
  • folder (optional): Custom folder path to save the screenshot
    • Supports WSL paths: /mnt/c/Users/...
    • Supports Windows paths: C:\Users\...
    • Supports relative paths: ../images
    • Default: workspace/screenshots/

Returns:

  • Success message with the file path
  • Error message if capture fails

Notes:

  • If both windowTitle and processName are provided, windowTitle takes precedence
  • Custom folders are created automatically if they don't exist
  • Path formats are automatically converted between WSL and Windows as needed

Technical Details

Architecture

  • MCP Server: Node.js with @modelcontextprotocol/sdk
  • Screenshot Capture: PowerShell with .NET Windows Forms
  • Communication: Executes PowerShell commands from WSL
  • Encoding: Base64 encoding for reliable command execution

Window Capture Features

  • DPI Awareness: Automatically handles high-DPI displays for crisp captures
  • Window Padding: Adds 10px padding to capture window shadows and borders
  • Render Wait: Waits 200ms after focusing window to ensure complete rendering
  • Bounds Checking: Prevents negative coordinates when windows are near screen edges
  • Process Matching: Intelligent process name matching (strips .exe extension automatically)

How It Works

  1. MCP server receives screenshot request from Claude
  2. Determines save location (custom folder or default)
  3. Converts paths between WSL and Windows formats as needed
  4. Constructs appropriate PowerShell script based on parameters
  5. Encodes script in base64 to avoid escaping issues
  6. Executes PowerShell command from WSL
  7. PowerShell captures screenshot using Windows Forms APIs
  8. Image is saved to the specified location

Error Handling

  • Filters PowerShell CLIXML output (verbose logging, not errors)
  • Validates monitor indices
  • Provides clear error messages for missing windows or processes
  • Lists available windows when capture fails
  • Automatically creates directories if needed
  • Handles both WSL and Windows path formats

Troubleshooting

Screenshots folder not created

The server automatically creates folders as needed. Ensure you have write permissions to the target location.

PowerShell execution errors

Check your PowerShell execution policy:

Get-ExecutionPolicy

Window not found errors

  • Ensure the window is open and not minimized
  • The title match is case-insensitive and supports partial matches
  • Try using a more specific window title
  • When searching by process, the tool will list all available windows to help you identify the correct one

Window capture is clipped

The latest version includes automatic padding and DPI awareness. If you still experience clipping:

  • Ensure you're using the latest version
  • Try maximizing the window before capture
  • Check if the window has unusual rendering (some apps use custom chrome)

Path conversion issues

The server automatically converts between WSL and Windows path formats:

  • WSL paths like /mnt/c/... are converted to C:\... for PowerShell
  • Windows paths like C:\... are converted to /mnt/c/... for file verification
  • Ensure your paths are accessible from both WSL and Windows

Recent Updates

v1.2.0

  • Added custom folder support with the folder parameter
  • Supports both WSL paths (/mnt/...) and Windows paths (C:\...)
  • Automatic path conversion between WSL and Windows formats
  • Creates custom directories automatically if they don't exist
  • Maintains backward compatibility with default screenshots folder

v1.1.0

  • Added process name capture support
  • Can now capture windows by process name (e.g., "notepad.exe")
  • Intelligent .exe extension handling
  • Enhanced error messages showing available windows

v1.0.1

  • Fixed window capture clipping issues
  • Added DPI awareness for high-DPI displays
  • Added padding to capture window shadows
  • Improved window rendering wait time
  • Added bounds checking for edge cases

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details

Acknowledgments

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选