This MCP server is designed to capture screenshots from Windows systems and make them available to other processes, particularly for AI assistants running in WSL. It specializes in saving screenshots to specified file paths, enabling seamless interaction between different environments.
Install the required dependencies using UV:
uv sync
This will install the necessary packages including mcp[cli]>=1.4.1
, pyautogui
, and Pillow
.
For the most common use case (AI Assistant running in WSL that needs to capture Windows screenshots):
C:\Users\YourUser\projects\screenshot-server
)mcp_settings.json
:{
"mcpServers": {
"Screenshot-server": {
"command": "powershell.exe",
"args": [
"-Command",
"Invoke-Command -ScriptBlock { cd 'C:\\Users\\YourUser\\projects\\screenshot-server'; & 'C:\\path\\to\\uv.exe' run screenshot.py }"
]
}
}
}
save_screenshot_to_host_workspace(host_workspace_path: str, name: str = "workspace_screenshot.jpg")
Parameters:
host_workspace_path
: The absolute WSL path of the Host's workspace (e.g., /home/user/project
)name
: Filename (optional, defaults to "workspace_screenshot.jpg")Returns: String - "success" or "failed: [error message]"
take_screenshot_and_return_path(name: str = "latest_screenshot.jpg")
Parameters:
name
: Filename (optional, defaults to "latest_screenshot.jpg")Returns: String - Absolute path to the saved screenshot or "failed: [error message]"
take_screenshot_path(path: str = "./", name: str = "screenshot.jpg")
Parameters:
path
: Target directory (Windows or UNC path, defaults to server's working directory)name
: Filename (optional, defaults to "screenshot.jpg")Returns: String - "success" or "failed: [error message]"
For an AI Assistant running in WSL:
/home/user/current_project
)result = use_mcp_tool("Screenshot-server", "save_screenshot_to_host_workspace", {
"host_workspace_path": "/home/user/current_project",
"name": "my_screenshot.jpg"
})
/home/user/current_project/my_screenshot.jpg
server.log
file for detailed error informationThere are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.