使用说明
MCP Screenshot Server
A standalone Rust implementation of a Model Context Protocol (MCP) server that lets an agent
ask the local user for a screenshot. When the request_screenshot tool is invoked the server:
- Prompts the user to confirm the capture (macOS dialog).
- Launches the native interactive screenshot overlay (via
screencapture -i). - Returns the captured region as a base64-encoded PNG payload.
Building
cargo build --release
Note: The project depends on macOS-native tooling (
osascript,screencapture) and requires screen recording permission. Grant access via System Settings → Privacy & Security → Screen Recording when prompted.
Installation
You can run the compiled binary in-place from target/release, or install it into Cargo's bin
directory so it is available on your PATH.
# Option A: build in release mode (binary in target/release)
cargo build --release
# Option B: install into ~/.cargo/bin
cargo install --path .
After building, ensure the binary is codesigned with the necessary macOS permissions if your local policy requires it. The project does not ship with a signature by default.
Running
The server communicates over stdio using a lightweight JSON-RPC protocol:
./target/release/mcp-screenshot
Tools exposed to agents:
request_screenshot– No parameters. Returns:{ "content": [ { "type": "image", "description": "Screenshot captured via mcp-screenshot", "image": { "source": { "type": "base64", "media_type": "image/png", "data": "..." } } } ] }
Errors such as user cancellation, timeouts, permission denials, or platform support issues are surfaced as JSON-RPC error responses with descriptive messages.
Claude Desktop Integration
To expose the server to Claude Desktop, add an MCP entry pointing at the release binary. For example, with the binary built in this repository:
"mcp-screenshot": {
"command": "~/.cargo/bin/mcp-screenshot"
}
Add the snippet above inside the "mcpServers" map in the Claude config file, then restart Claude:
- Config path:
~/Library/Application Support/Claude/claude_desktop_config.json - Ensure the command path matches where the binary lives (e.g.,
~/.cargo/bin/mcp-screenshotif installed withcargo install --path .).
The next time Claude starts, the MCP Screenshot server will be available to tools that request interactive captures. If you relocate the binary, update the config path accordingly.