Captures screenshots and saves them to file paths specified by client applications, primarily designed to facilitate screenshot analysis by AI assistants running in WSL environments.
This project provides an MCP (Modular Communication Protocol) server designed to capture screenshots and facilitate their use by other processes or AI assistants, primarily by saving the screenshot to a file path specified by the client (Host).
Directly interpreting screenshot image data sent via MCP by AI assistants proved unreliable in testing. This server adopts more robust workflows focused on file paths:
Recommended Workflow (WSL Host -> Windows Server):
save_screenshot_to_host_workspace
tool, providing its WSL workspace path as an argument.\\wsl$\Distro\path
)."success"
or "failed:..."
.Alternative Workflow (General):
take_screenshot_and_return_path
, optionally specifying a filename.images/
directory.This server provides the following tools, ordered by recommended usage:
save_screenshot_to_host_workspace(host_workspace_path: str, name: str = "workspace_screenshot.jpg")
host_workspace_path
(str): The absolute WSL path of the Host's workspace (e.g., /home/user/project
).name
(str, optional): Filename. Defaults to workspace_screenshot.jpg
.str
- "success"
or "failed: [error message]"
.take_screenshot_and_return_path(name: str = "latest_screenshot.jpg")
images/
directory relative to the server's location and returns the absolute path (typically a Windows path). Useful if the caller needs the path for external processing.name
(str, optional): Filename. Defaults to latest_screenshot.jpg
.str
- Absolute path or "failed: [error message]"
.take_screenshot_path(path: str = "./", name: str = "screenshot.jpg")
path
(str, optional): Target directory (Windows or UNC path). Defaults to server's working directory.name
(str, optional): Filename. Defaults to screenshot.jpg
.str
- "success"
or "failed: [error message]"
.uv
:
Required libraries includeuv sync
mcp[cli]>=1.4.1
, pyautogui
, and Pillow
.This server is typically launched by an MCP Host based on its configuration.
Crucial Point: To capture the Windows screen, this screenshot.py
server must run directly on Windows.
Recommended WSL2 Host -> Windows Server Setup:
Project Location: Place this screenshot-server
project folder on your Windows filesystem (e.g., C:\Users\YourUser\projects\screenshot-server
).
Windows Dependencies: Install Python, uv
, and project dependencies (uv sync ...
) directly on Windows within the project folder.
MCP Host Configuration (in WSL): Configure your MCP Host (running in WSL) to launch the server on Windows using PowerShell. Update mcp_settings.json
(or equivalent):
{ "mcpServers": { "Screenshot-server": { "command": "powershell.exe", "args": [ "-Command", "Invoke-Command -ScriptBlock { cd ''; & '' run screenshot.py }" ] } // ... other servers ... } }
/home/user/current_project
).use_mcp_tool
to call save_screenshot_to_host_workspace
on Screenshot-server
, passing host_workspace_path="/home/user/current_project"
and optionally a name
."success"
./home/user/current_project/workspace_screenshot.jpg
(or the specified name).use_mcp_tool
to call an image analysis server/tool (also running in WSL), passing the WSL path /home/user/current_project/workspace_screenshot.jpg
.screenshot.py
: The core MCP server script.README.md
: This documentation file.pyproject.toml
: Project definition and dependencies for uv
.uv.lock
: Dependency lock file..gitignore
: Git ignore configuration..python-version
: (Optional) Python version specifier.server.log
: Log file generated by the server.images/
: Default directory for take_screenshot_and_return_path
.Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!