Skip to main content
Glama
GOWTHAM2036

Screen-Aware MCP Server

by GOWTHAM2036

Screen-Aware MCP Server & Antigravity Skill

License: MIT Python: 3.10+ MCP: 2.x

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.


Related MCP server: Screen Agent

πŸ›οΈ Core Architecture

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

cd screen-aware-mcp
pip install -r requirements.txt

2. Configure Environment (Optional)

cp .env.example .env

3. Run MCP Server

python -m server.server

πŸ§ͺ Running Tests

Run the full automated test suite:

pytest tests/ -v

πŸ—ΊοΈ Roadmap & Milestones

  • 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.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to capture and analyze screen content across multi-monitor setups with smart image optimization. Provides screenshot capabilities and detailed monitor information for visual debugging, UI analysis, and desktop assistance.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to capture screenshots and control desktop input (mouse, keyboard) to see and interact with your screen. Features user-first safety controls including automatic pause on user activity and app allowlists to restrict interactions to approved applications only.
    1
    MIT