Skip to main content
Glama
zoom-companion-mcp
by dzakyzahy
README.md
# `zoom-automation` — Autonomous AFK Zoom AI Bot, RAG Chat Bot, Web AI Companion & MCP Server

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Python 3.10+](https://img.shields.io/badge/Python-3.10%2B-3776AB.svg)](https://www.python.org/)
[![MCP Compatible](https://img.shields.io/badge/MCP-2024--11--05%20%7C%202025--03--26-00a67e.svg)](https://modelcontextprotocol.io/)
[![Zero Sabotage](https://img.shields.io/badge/Zoom%20Safety-Zero%20Focus%20Steal%20%7C%20Passive%20WASAPI-10b981.svg)](#1-zero-sabotage--non-intrusive-architecture)

**`zoom-automation`** (`zoom-companion-ai`) is an autonomous **AFK Zoom Meeting Watcher Bot**, **Hybrid BM25+Slide RAG Chat Bot**, **Real-Time Web AI Companion (`http://127.0.0.1:8765`)**, and **Model Context Protocol (MCP) Server** built to connect seamlessly with AI Agents (**Google Antigravity, Claude Desktop, Cursor, Windsurf**).

Designed for multi-hour lectures and meetings while the user is AFK, it captures every meaningful slide or screen-share update and transcribes spoken discussions until the Zoom meeting ends automatically — **using 0 API credits out of the box** and **never touching or hijacking the Zoom owner's controls**.

---

## Architecture

```mermaid
flowchart LR
    Z["Zoom Workplace<br/>(Active Meeting)"] -->|"Win32 DWM PrintWindow<br/>(Offscreen, 0 Focus Steal)"| V["5-Stage Zero-Credit<br/>Slide Detector"]
    Z -->|"WASAPI Loopback<br/>(Read-Only Speaker Tap)"| A["Adaptive VAD +<br/>Local faster-whisper INT8"]
    V --> S[("SQLite + Markdown<br/>Session Vault")]
    A --> N["Smart Annotation Engine<br/>(Mentions, Deadlines, Exam Hints)"]
    N --> S
    S <--> W["FastAPI + WebSocket<br/>Web AI Companion & RAG Chat Bot"]
    W <-->|"JSON-RPC 2.0 (stdio)"| M["zoom-companion-mcp<br/>(Antigravity / Claude / Cursor)"]
    S --> R["Auto Finalizer<br/>(SUMMARY.md + REPORT.html)"]
```

---

## Key Innovations

### 1. Zero-Sabotage / Non-Intrusive Architecture
Hard-locked safety flags in [`zoom_companion/config.py`](zoom_companion/config.py) guarantee zero interference with the meeting or host/participant controls:
- `ALLOW_WINDOW_FOCUS_CHANGE = False` — Uses Win32 offscreen DWM `PrintWindow(PW_RENDERFULLCONTENT)` to capture `ConfMultiTabContentWndClass` / `ZPContentViewWndClass` in the background even when covered by other apps.
- `ALLOW_INPUT_INJECTION = False` — Zero mouse movement, zero simulated keystrokes, zero UI button clicking.
- `ALLOW_ZOOM_MIC_ACCESS = False` — Taps Windows default audio output passively via **WASAPI Loopback** (`PyAudioWPatch`) without touching any microphone or installing virtual audio cables.

### 2. 5-Stage Zero-Credit Slide & Screen-Share Change Detector
Naive screen-watchers either burn thousands of vision tokens polling screenshots every few seconds or spam false captures whenever a speaker moves on webcam. [`zoom_companion/slide_detector.py`](zoom_companion/slide_detector.py) solves both locally in `< 2 ms` per frame (`0 API tokens`):
1. **Zoom Chrome Crop & `8x8` Spatial Webcam PiP Motion Filter:** Strips top/bottom Zoom overlays and ignores localized motion inside corner/sidebar speaker video thumbnails.
2. **Masked 64-bit Perceptual `dHash` + `aHash`:** Fast perceptual hashing over the core presentation canvas.
3. **Structural Gradient Edge-Grid Delta (`|dx| + |dy|`):** Detects subtle equation, code, or pen/ink annotation updates on white slides where mean pixel luminance barely shifts.
4. **Temporal Settle Debounce (*Anti-Scroll-Blur*):** Waits for PDF scrolling or slide fade transitions to stabilize before saving a crisp PNG.
5. **Session-Wide Perceptual Deduplication Vault:** Recognizes revisited slides and logs timeline pointers instead of saving duplicate PNGs.

### 3. Autonomous AFK Lifecycle, Smart Annotations & Hybrid RAG Chat Bot
- **Unattended Start-to-Finish Operation:** Waits in standby if the meeting hasn't started, begins capturing automatically once `in_meeting` is detected, survives brief Wi-Fi reconnects (`25s` grace window), and compiles `SUMMARY.md`, standalone visual `REPORT.html`, and `ANTIGRAVITY_HANDOFF.md` when the host ends the meeting.
- **Zero-Credit Smart Annotations:** Automatically flags `USER_MENTION` (roll-call / attendance keywords), `DEADLINE_TASK`, `EXAM_HINT`, `ACTION_ITEM`, and `SLIDE_CHANGE`.
- **Token-Frugal Hybrid RAG + Optional Gemini 4 Cloud Boost:** Local BM25 + slide-context retrieval answers questions instantly with `0` credits, or optionally pairs with `google-genai` (`gemini-4-hydrogen` / `gemini-3.5-flash-lite`) using **2x2 Tiled Slide Contact Sheets** (~75% fewer vision tokens).

---

## Exposed MCP Tools (`zoom-companion-mcp`)

| Tool Name | Description |
| :--- | :--- |
| `zoom_status` | Inspect live Zoom desktop state (`not_running`, `home_idle`, `waiting_room`, `in_meeting`), WASAPI loopback readiness, safety locks, and token-saving metrics. |
| `zoom_start_afk_session` | Launch autonomous AFK Zoom monitoring until the meeting ends automatically. |
| `zoom_stop_session` | Gracefully stop monitoring and compile `SUMMARY.md` + `REPORT.html`. |
| `zoom_capture_now` | Take an immediate silent offscreen Zoom screenshot with an optional bookmark note. |
| `zoom_list_sessions` | List recorded Zoom sessions with duration, slide count, and estimated vision tokens saved. |
| `zoom_get_transcript` | Retrieve or search timestamped spoken transcripts for a session. |
| `zoom_get_slides` | List unique captured slide PNG paths (directly inspectable by multimodal AI agents) and spoken context. |
| `zoom_annotations` | List or add structured annotations (`BOOKMARK`, `EXAM_HINT`, `DEADLINE_TASK`, `USER_MENTION`). |
| `zoom_ask_chatbot` | Query the Hybrid BM25 + Slide RAG Meeting Chat Bot. |
| `zoom_generate_summary` | Generate or refresh `SUMMARY.md`, `REPORT.html`, and `ANTIGRAVITY_HANDOFF.md`. |

---

## Installation

```bash
git clone https://github.com/dzakyzahy/zoom-automation.git
cd zoom-automation
pip install -e .
```

Optional `.env` setup (copy from `.env.example` to customize attendance watch keywords or optional `GEMINI_API_KEY`):
```bash
cp .env.example .env
```

---

## Usage

### 1. Live Web AI Companion & Chat Bot (`http://127.0.0.1:8765`)
Double-click `Start_Zoom_Companion.bat` (Windows) or run:
```bash
zoom-automation ui
```

### 2. Command-Line Interface (`zoom-automation`)
```bash
# Check Zoom window state & WASAPI speaker loopback
zoom-automation status

# Start autonomous AFK session (runs until Zoom meeting ends)
zoom-automation start-afk --title "Weekly Engineering Sync"

# Take an instant silent offscreen screenshot
zoom-automation capture --note "Key architecture diagram"

# Ask the Meeting RAG Chat Bot
zoom-automation ask "What deadlines or action items were mentioned?"

# Stop manually & build SUMMARY.md + REPORT.html
zoom-automation stop
zoom-automation summary
```

### 3. Connect to AI Agents (Antigravity / Claude Desktop / Cursor MCP)
Add `zoom-companion-mcp` to `~/.gemini/config/mcp_config.json` or `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "zoom-companion-mcp": {
      "command": "python",
      "args": ["-m", "zoom_companion.mcp_server"]
    }
  }
}
```

---

## License

Released under the [MIT License](LICENSE).