Shell
omni.vu Enhanced MCP Server - Implementation Plan
Overview
Build an enhanced screen capture and GUI automation MCP server for macOS, combining the best features from competitors (Peekaboo, ACS Screenshot, Groundlight) into a Python-based solution.
Location: /Users/eddiebelaval/Development/id8/mcp-servers/omni-vu/
Platform: macOS only (simplifies development significantly)
Language: Python with FastMCP
Target Use Cases: Development feedback loop, automated testing/QA, agent automation, documentation
Project Structure
mcp-servers/omni-vu/
├── pyproject.toml
├── README.md
├── .env.example
├── src/
│ └── omni_vu/
│ ├── __init__.py
│ ├── server.py # FastMCP entry point
│ ├── config.py # Pydantic Settings configuration
│ │
│ ├── capture/ # Phase 1: Screen capture
│ │ ├── __init__.py
│ │ ├── base.py # Abstract capturer
│ │ ├── full_screen.py # Full screen (mss)
│ │ ├── window.py # Window capture (CGWindowListCreateImage)
│ │ ├── region.py # Region capture
│ │ ├── monitors.py # Display enumeration
│ │ └── utils.py # HiDPI, image processing
│ │
│ ├── vision/ # Phase 2: Multi-provider AI
│ │ ├── __init__.py
│ │ ├── base.py # VisionProvider ABC
│ │ ├── claude.py # Claude provider
│ │ ├── openai.py # OpenAI GPT-4o
│ │ ├── gemini.py # Google Gemini
│ │ ├── ollama.py # Local Ollama
│ │ ├── factory.py # Provider factory + fallback
│ │ └── optimization.py # Image optimization per provider
│ │
│ ├── automation/ # Phase 3: GUI automation
│ │ ├── __init__.py
│ │ ├── mouse.py # Click, move, drag, scroll
│ │ ├── keyboard.py # Type, hotkey, press
│ │ ├── coordinates.py # Retina/multi-monitor handling
│ │ ├── safety.py # Rate limiting, dangerous action blocking
│ │ └── models.py # Pydantic models
│ │
│ ├── tools/ # MCP tool definitions
│ │ ├── __init__.py
│ │ ├── capture_tools.py # vu, vu_window, vu_region
│ │ ├── query_tools.py # vu_list_windows, vu_list_monitors
│ │ ├── vision_tools.py # vu_describe
│ │ ├── automation_tools.py # vu_click, vu_type, etc.
│ │ └── utility_tools.py # vu_diff, vu_history, vu_last, vu_status
│ │
│ ├── models/ # Shared Pydantic models
│ │ ├── __init__.py
│ │ ├── capture.py
│ │ ├── monitors.py
│ │ └── vision.py
│ │
│ └── history/ # Capture history
│ ├── __init__.py
│ └── manager.py
│
└── tests/
├── test_capture/
├── test_vision/
└── test_automation/
Phase 1: Vision+ (Window & Region Capture)
New Tools
| Tool | Description |
|---|---|
vu_window |
Capture specific window by title/ID |
vu_region |
Capture specific screen region (x, y, w, h) |
vu_list_windows |
List all windows with metadata |
vu_list_monitors |
List all connected displays |
Preserved Tools (from original)
vu- Full screen capturevu_diff- Change detectionvu_history- Capture historyvu_last- Last capturevu_status- System info
Key Implementation: Window Capture (PyObjC/CoreGraphics)
# capture/window.py - Core pattern
import Quartz
from Quartz import CGWindowListCopyWindowInfo, CGWindowListCreateImage
def capture_window(window_id: int) -> Image:
cg_image = CGWindowListCreateImage(
Quartz.CGRectNull,
Quartz.kCGWindowListOptionIncludingWindow,
window_id,
Quartz.kCGWindowImageDefault
)
return cgimage_to_pil(cg_image)
Retina Support
- Use
NSScreen.mainScreen().backingScaleFactor()for scale detection - Provide both native (full pixels) and logical (scaled) output modes
Phase 2: Multi-Provider AI Vision
Enhanced vu_describe Tool
- Supports: Claude, OpenAI GPT-4o, Gemini, Ollama (local)
- Environment-based configuration
- Automatic fallback chain
- Image optimization per provider
Provider Abstraction Pattern
# vision/base.py
class VisionProvider(ABC):
@abstractmethod
async def analyze(self, image_base64: str, prompt: str) -> str:
pass
@abstractmethod
async def is_available(self) -> bool:
pass
# vision/factory.py
class VisionProviderFactory:
fallback_chain = ["claude", "openai", "gemini", "ollama"]
async def analyze_with_fallback(self, image: str, prompt: str) -> tuple[str, str]:
for provider_name in self.fallback_chain:
if await provider.is_available():
try:
return await provider.analyze(image, prompt), provider_name
except:
continue
raise RuntimeError("All providers failed")
Configuration
# .env
OMNI_VU_ANTHROPIC_API_KEY=sk-ant-...
OMNI_VU_OPENAI_API_KEY=sk-...
OMNI_VU_GOOGLE_API_KEY=...
OMNI_VU_DEFAULT_PROVIDER=claude
OMNI_VU_FALLBACK_CHAIN=["claude","openai","gemini","ollama"]
Phase 3: GUI Automation
New Tools
| Tool | Description |
|---|---|
vu_click |
Click at coordinates or element |
vu_type |
Type text (with optional target) |
vu_scroll |
Scroll up/down/left/right |
vu_hotkey |
Press keyboard shortcuts |
vu_drag |
Drag from point A to B |
vu_move |
Move cursor without clicking |
Backend: PyObjC + Quartz CGEvents
# automation/mouse.py - Core pattern
import Quartz
def click(point: tuple, button: str = "left", click_count: int = 1):
event = Quartz.CGEventCreateMouseEvent(
None,
Quartz.kCGEventLeftMouseDown,
point,
Quartz.kCGMouseButtonLeft
)
Quartz.CGEventPost(Quartz.kCGHIDEventTap, event)
Safety Controls
- Rate limiting (min 50ms between actions, max 20/sec)
- Dangerous hotkey blocking (cmd+q, cmd+shift+q, etc.)
- Restricted area protection (menu bar)
- Max drag distance validation
Coordinate Handling
- Logical (points) vs Physical (pixels) conversion for Retina
- Multi-monitor coordinate validation
- Screen bounds checking
Phase 4: Object Detection (Optional Enhancement)
Integration with Groundlight/mcp-vision Pattern
- Add
vu_detecttool for object detection - Use OwlViT or YOLO for specialized detection
- Crop and zoom capabilities
Phase 5: Enterprise Features (Optional)
- PII masking (OCR-based detection)
- Audit logging
- Rate limiting per client
- Security policy configuration
Dependencies
# pyproject.toml
[project]
dependencies = [
# Core MCP
"fastmcp>=2.10.0",
# Screen capture
"mss>=9.0.0",
"Pillow>=10.0.0",
# macOS (PyObjC)
"pyobjc-core>=10.0",
"pyobjc-framework-Cocoa>=10.0",
"pyobjc-framework-Quartz>=10.0",
# AI Providers
"anthropic>=0.30.0",
"openai>=1.30.0",
"google-generativeai>=0.5.0",
"httpx>=0.27.0",
# Configuration
"pydantic>=2.5.0",
"pydantic-settings>=2.1.0",
"python-dotenv>=1.0.0",
]
Implementation Sequence
Week 1: Foundation + Phase 1
- Create project structure and pyproject.toml
- Implement config.py with Pydantic Settings
- Port existing omni.vu tools (vu, vu_diff, vu_history, vu_last, vu_status)
- Implement MonitorEnumerator (vu_list_monitors)
- Implement WindowCapturer (vu_window, vu_list_windows)
- Implement RegionCapturer (vu_region)
- Add Retina/HiDPI support
Week 2: Phase 2
- Implement VisionProvider ABC
- Implement ClaudeProvider (port from original)
- Implement OpenAIProvider
- Implement GeminiProvider
- Implement OllamaProvider
- Implement VisionProviderFactory with fallback
- Image optimization per provider
- Update vu_describe with provider selection
Week 3: Phase 3
- Implement coordinates.py (Retina handling)
- Implement safety.py (rate limiting, dangerous action blocking)
- Implement mouse.py (click, move, drag, scroll)
- Implement keyboard.py (type, hotkey, press)
- Create automation Pydantic models
- Add automation tools to server
- Integration testing
Week 4: Polish + Optional Phases
- Error handling refinement
- Documentation
- Claude Desktop integration testing
- Phase 4-5 if time permits
Critical Files to Create/Modify
| Priority | File | Purpose |
|---|---|---|
| 1 | pyproject.toml |
Project config and dependencies |
| 2 | src/omni_vu/config.py |
Pydantic Settings configuration |
| 3 | src/omni_vu/server.py |
FastMCP server entry point |
| 4 | src/omni_vu/capture/window.py |
Window capture with PyObjC |
| 5 | src/omni_vu/capture/monitors.py |
Display enumeration |
| 6 | src/omni_vu/vision/factory.py |
Multi-provider factory |
| 7 | src/omni_vu/automation/mouse.py |
Mouse operations |
| 8 | src/omni_vu/automation/keyboard.py |
Keyboard operations |
| 9 | src/omni_vu/automation/safety.py |
Safety controls |
macOS Requirements
- Screen Recording Permission: System Settings > Privacy & Security > Screen Recording
- Accessibility Permission: System Settings > Privacy & Security > Accessibility
- Python 3.10+ with PyObjC
MCP Configuration
// ~/.claude/mcp.json
{
"mcpServers": {
"omni.vu": {
"command": "python",
"args": ["/path/to/id8/mcp-servers/omni-vu/src/omni_vu/server.py"],
"env": {
"OMNI_VU_ANTHROPIC_API_KEY": "sk-ant-...",
"OMNI_VU_DEFAULT_PROVIDER": "claude"
}
}
}
}
Success Criteria
- All original omni.vu tools working
- Window and region capture functional
- Multi-provider vision with fallback
- Full GUI automation (click, type, scroll, hotkey, drag, move)
- Retina/HiDPI support
- Safety controls preventing dangerous actions
- Integration with Claude Desktop verified