Screen-Aware MCP Server
by GOWTHAM2036
README.md
# Screen-Aware MCP Server & Antigravity Skill
[](LICENSE)
[](https://www.python.org/)
[](https://modelcontextprotocol.io/)
An open-source Model Context Protocol (MCP) server and Antigravity Skill that provides AI coding assistants with high-fidelity, privacy-first computer screen context, cursor position awareness, active window metadata, and visual verification.
---
## π Overview
When building and debugging graphical interfaces or web applications, verbal references like:
> *"Make this button blue and increase padding."* (while pointing cursor at the button)
require the AI agent to know:
1. What the screen looks like.
2. Exactly where the user is pointing.
3. Which application window and UI component is focused.
**Screen-Aware MCP** solves this by providing structured, synchronized screen context directly to multimodal AI coding agents (such as Google Antigravity) without relying on permanent disk writes, third-party cloud uploads, or invasive screen-recording daemons.
---
## ποΈ Core Architecture
```mermaid
flowchart TD
User([User + Screen + Mouse])
User -->|Voice / Text Prompt| Agent[Antigravity Agent]
Agent -->|Skill Guidance| Skill[Antigravity Skill]
Skill -->|Tool Invocations| MCP[Screen-Aware MCP Server]
MCP -->|Win32 / OS APIs| OS[Local OS / Screen / Cursor / Window]
OS -->|Raw Frames & Coordinates| MCP
MCP -->|ImageContent + JSON Metadata| Model[Multimodal AI Model]
Model -->|Visual UI Identification| Agent
Agent -->|Code Changes & Verification| Codebase[(Source Code)]
```
### Separation of Responsibilities
* **Antigravity Skill**: Guides the agent on *behavior* (when to capture screen context, how to correlate cursor coordinates with visual UI elements, how to locate source components, and verify results).
* **MCP Server**: Provides *capabilities* (capturing screen frames, measuring cursor coordinates, detecting foreground window, packaging multimodal content).
* **OS Platform Layer**: Interfaces directly with native OS APIs (`GetCursorPos`, `GetForegroundWindow`, `mss` frame buffer) with full DPI awareness.
* **Multimodal Model**: Performs visual reasoning over the synchronized screenshot and cursor coordinates.
---
## π Features (Milestone 1 β Read-Only Foundation)
- πΈ **High-Speed Screen Capture**: Native in-memory screen capture via `mss` & Pillow.
- π― **Sub-Pixel Cursor Tracking**: Exact cursor coordinates + normalized `[0, 1]` positions matching hardware pixels (DPI-aware).
- πͺ **Active Window Detection**: Detects focused window title, PID, process executable name, and bounding box.
- β‘ **Synchronized Screen Context**: Captures cursor, window, and screen snapshot in a single sub-millisecond call to eliminate coordinate drift.
- π **Privacy-First**: Zero disk persistence by default, local execution, no background surveillance.
---
## π¦ Project Structure
```
screen-aware-mcp/
βββ server/
β βββ __init__.py
β βββ server.py # MCP Server definition & tool registration
β βββ config.py # Server configuration & environment variables
β βββ tools/
β β βββ __init__.py
β β βββ screen.py # capture_screen implementation
β β βββ cursor.py # get_cursor_position implementation
β β βββ window.py # get_active_window implementation
β β βββ context.py # capture_screen_context synchronized tool
β βββ platform/
β βββ __init__.py # Platform provider selector
β βββ base.py # Abstract OS platform interface
β βββ windows.py # Windows Win32 / ctypes implementation
βββ skill/
β βββ SKILL.md # Antigravity Skill specification
βββ voice/
β βββ README.md # Voice architecture & roadmap
βββ tests/
β βββ test_cursor.py # Cursor tracking tests
β βββ test_screen.py # Screen capture tests
β βββ test_window.py # Window detection tests
β βββ test_context.py # Context synchronization tests
β βββ test_server.py # End-to-end MCP tool tests
βββ docs/
β βββ architecture.md # Detailed architectural design
β βββ installation.md # Setup and integration guide
β βββ antigravity.md # Antigravity IDE & CLI configuration
β βββ privacy.md # Privacy policies & data handling
β βββ security.md # Security model & tool permissions
βββ examples/
β βββ client_example.py # Example MCP client script
βββ .env.example # Sample environment configuration
βββ .gitignore
βββ LICENSE # MIT License
βββ pyproject.toml
βββ requirements.txt
```
---
## π οΈ Installation & Setup
### Prerequisites
- Python 3.10 or higher
- Windows 10/11 (macOS / Linux support on roadmap)
### 1. Install Dependencies
```bash
cd screen-aware-mcp
pip install -r requirements.txt
```
### 2. Configure Environment (Optional)
```bash
cp .env.example .env
```
### 3. Run MCP Server
```bash
python -m server.server
```
---
## π§ͺ Running Tests
Run the full automated test suite:
```bash
pytest tests/ -v
```
---
## πΊοΈ Roadmap & Milestones
- [x] **Milestone 1 β MCP Foundation**: Read-only MCP tools (`capture_screen`, `get_cursor_position`, `get_active_window`, `capture_screen_context`), DPI-aware Win32 integration, comprehensive test suite.
- [ ] **Milestone 2 β Antigravity Skill**: Integrate with Antigravity agent workflows for prompt-driven UI element identification.
- [ ] **Milestone 3 β Visual UI Targeting**: Windows UI Automation (UIA) & accessibility tree integration.
- [ ] **Milestone 4 β Voice Input**: Audio / microphone input bridge.
- [ ] **Milestone 5 β Controlled UI Interaction**: Permission-controlled click, drag, scroll, keyboard input.
- [ ] **Milestone 6 β Screen Watching**: Intelligent frame-diff change detection.
---
## π License
This project is licensed under the [MIT License](LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues