screen-mcp
Captures screen, detects text regions, and runs OCR to return a compact JSON with text content, saving tokens compared to full screenshots.
README
screen-mcp
Screen-aware MCP (Model Context Protocol) server. Captures the user's screen, finds text-worthy regions via heuristic analysis, runs OCR, and returns a compact JSON (~500 tokens) instead of a full screenshot (~500,000 tokens).
Architecture
| Module | Description |
|---|---|
| screenshot.py | Fast screen capture via mss |
| detection.py | Heuristic text-region finder (edge density + contrast scoring) |
| ocr.py | Tesseract OCR wrapper |
| main.py | MCP stdio server + HTTP debug server + ScreenWatcher background monitor |
Three Modes
1. MCP stdio (for Codex / Claude Desktop / Cursor)
Add to your MCP config (mcp.json):
json { "mcpServers": { "screen": { "command": "python", "args": ["-m", "src.main"], "cwd": "/path/to/screen-mcp" } } }
Three tools are exposed:
- screen_analyze - Full analysis: capture -> detect regions -> OCR
- screen_watch - Background monitoring: start / stop / status / force_check
- screen_diff - One-shot change detection
2. Demo Mode
ash python -m src.main --demo
Outputs a JSON analysis of the current screen to stdout.
3. HTTP Debug Server
ash python -m src.main --http-port 8000
- GET /health returns {"status": "ok"}
- POST /analyze returns full screen analysis JSON
Installation
`ash pip install mss Pillow pytesseract numpy fastapi uvicorn
Install Tesseract OCR separately
Windows: winget install UB-Mannheim.TesseractOCR
macOS: brew install tesseract
Linux: sudo apt install tesseract-ocr
`
Output Example
json { "monitors": [{"left": 0, "top": 0, "width": 1920, "height": 1080}], "regions": [{"x1": 420, "y1": 140, "x2": 1160, "y2": 460, "confidence": 0.76}], "texts": [ {"text": "New chat", "confidence": 0.96, "bbox": [43, 54, 100, 64]}, {"text": "Search", "confidence": 0.96, "bbox": [43, 84, 82, 94]} ], "summary": "Found 5 text regions | Text (118): New chat, Search, Plugins..." }
Token Savings
| Method | Tokens |
|---|---|
| Raw screenshot (1920x1080 PNG) | ~500,000+ |
| screen-mcp JSON | ~500-2,000 |
| Savings | 99.6% |
Configuration
| Parameter | Default | Description |
|---|---|---|
| --min-area | 3000 | Min pixel area for text region detection |
| --ocr-conf | 0.4 | Minimum OCR confidence threshold |
| --monitor | 1 | Monitor index (1=primary) |
Notes
- OCR uses Tesseract with English language pack by default
- Chinese OCR requires installing chi_sim.traineddata
- The ScreenWatcher background monitor uses MSE-based frame differencing with configurable interval and threshold
- Tesseract auto-detects common installation paths; falls back to PATH lookup
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.