Agent Cam MCP Tool
Provides an adapter for reading timestamped events from MQTT topics, allowing agents to correlate physical camera frames and timeline data with MQTT event streams.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Agent Cam MCP Tool watch the 3D printer camera and tell me if the first layer is sticking"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Agent Cam MCP Tool
Physical camera perception, quantitative measurement, and verification tool for MCP AI agents.
1. Overview
Agent Cam MCP Tool gives AI coding agents eyes on the physical world. It interfaces with USB webcams and RTSP/HTTP network camera streams, exposing them to any Model Context Protocol (MCP) compatible agent (Google Antigravity, Claude Code, OpenAI Codex, Cursor).
The Problem
Agents working on embedded systems, robotics, CNC machinery, or 3D printers frequently declare builds or firmware flashes "successful" while the physical hardware remains unresponsive, stuck in a boot loop, or displaying error codes. Traditional agents rely solely on build return codes and serial logs.
The Solution
Agent Cam MCP Tool allows the agent to inspect the physical hardware at any moment:
Returns images directly as MCP image content (like browser screenshots in IDE agents). Nothing is written to disk by default.
Returns quantitative numbers alongside visual frames (mean brightness, contrast, lit pixel percentage, dominant colors, edge density, sharpness, and motion level) so agents make decisions on hard evidence.
Maintains an in-memory RAM ring buffer so agents can retrieve what happened before an error or correlate visual changes with serial logs.
Includes a local developer dashboard to monitor camera feeds, define named regions of interest, apply privacy masks, and maintain user access control.
Related MCP server: Vision MCP Server
2. Cross-Domain Use Cases
Embedded Boards: Verify power LEDs, RGB status indicators, seven-segment displays, and OLED boot screens after firmware flashing.
3D Printing: Inspect first-layer adhesion, detect spaghetti failures mid-print, and monitor nozzle travel.
CNC & Laser Cutting: Inspect workpiece alignment, stock clamp clearance, and job completion.
Robotics: Verify robot arm home positions, gripper actuation, and physical limit switch contact.
Lab Benches: Read multimeter digits, oscilloscope waveforms, and power supply displays via OCR.
Environmental Rigs: Monitor automated plant watering, aquariums, heating cycles, and prototyping rigs.
Soldering & Inspection: Perform macro inspection of solder joints and component placement.
3. Architecture
Agent Cam MCP Tool utilizes a single long-lived daemon architecture to ensure multiple agent sessions never contend for hardware access:
graph TD
Agent[AI Agent: Antigravity / Claude / Cursor] -->|MCP over stdio| Shim[agent-cam-mcp Stdio Shim]
Agent -->|MCP over HTTP/SSE| Daemon[Daemon 127.0.0.1:8765]
Shim -->|Fast Local REST / IPC| Daemon
Daemon --> CamMgr[Camera Manager]
CamMgr -->|DirectShow / V4L2 / AVFoundation| USB[USB Webcams]
CamMgr -->|RTSP / HTTP Stream| IP[IP Cameras]
CamMgr --> Buffer[RAM Ring Buffer: JPEG 4 FPS]
Daemon --> Analysis[Analysis Engine: SSIM, Metrics, Watcher]
Daemon --> Policy[Policy Engine: Rate Limits, Privacy Masks]
Daemon --> Adapters[Adapters: Serial, Logfile, MQTT]
Daemon --> WebUI[Dashboard: REST, WebSocket, MJPEG]Why a Daemon?
Operating systems restrict camera hardware to a single accessing process. If every agent session spawned an independent camera process, conflicts and device locks would occur. The Agent Cam daemon exclusively owns the hardware, while the lightweight stdio shim transparently connects to the daemon, starting it in the background if it is not already running.
4. Key Features
Direct MCP Image Content: Images are encoded as base64 JPEG/PNG objects directly within tool responses.
Sub-5ms Image Delivery: Background grabber threads maintain a latest-frame slot in memory, eliminating camera warm-up delays.
Quantitative Measurement: The
measuretool provides deterministic numerical metrics without transmitting heavy image tokens.Watch Loops: The
watchtool monitors physical feeds until a condition fires (change,motion_start,motion_stop,brightness_above,brightness_below,color_present) or a timeout occurs.Baseline Comparisons: Compute SSIM (Structural Similarity Index) and generate visual difference heatmaps against saved reference images.
Timeline Correlation: Combine buffered frames with timestamped lines from serial COM ports, logfiles, or MQTT topics.
Privacy & Safety Controls: Permanent privacy masks redact sensitive areas before frames reach agent results or the dashboard. A prominent toggle switch allows instant pausing of agent camera access.
Local Offline Dashboard: Developer console built with zero external web requests or CDN dependencies.
5. Quick Start (Under 60 Seconds)
Installation
Install via uv or pip:
# Using uv (recommended)
uv tool install agent-cam-mcp
# Or using pip
pip install agent-cam-mcpWith optional extras:
uv tool install "agent-cam-mcp[all]"
# Extras available: [serial], [mqtt], [ocr], [all]Run Self-Diagnosis
Verify all system dependencies and cameras:
agent-cam-mcp doctorRegister with Your IDE
agent-cam-mcp install --client antigravity6. Client Configuration
The installer automatically writes absolute executable paths to client configurations to prevent path resolution failures when IDEs are launched from desktop shortcuts.
Google Antigravity
Config location: ~/.gemini/antigravity-ide/mcp_config.json
{
"mcpServers": {
"agent-cam": {
"command": "D:\\Projects\\mcp-tool-development\\agent-cam-mcp-tool\\.venv\\Scripts\\agent-cam-mcp.exe",
"args": [],
"env": {},
"disabled": false
}
}
}Claude Code
Run the registration command:
claude mcp add agent-cam -- "D:\path\to\agent-cam-mcp.exe"Cursor
Config location: ~/.cursor/mcp.json
{
"mcpServers": {
"agent-cam": {
"command": "D:\\path\\to\\agent-cam-mcp.exe",
"args": []
}
}
}OpenAI Codex / TOML Clients
Config location: ~/.codex/config.toml
[mcp_servers.agent-cam]
command = "D:\\path\\to\\agent-cam-mcp.exe"
args = []7. CLI Reference
Command | Description |
| Run the stdio shim (launched by AI IDEs) |
| Run the daemon process in the foreground |
| Ensure daemon is running and open dashboard in browser |
| Print daemon uptime, cameras, and connected clients |
| Stop background daemon cleanly |
| Execute 11 self-diagnosis checks |
| Configure client ( |
| Print package version |
8. MCP Tools Reference
All tools return structured JSON text blocks alongside image content when applicable.
Tool | Parameters | Description |
| none | Daemon version, uptime, cameras, pause flag, buffer fill. Agents call this first. |
|
| List physical USB and IP cameras with IDs, resolutions, and states. |
|
| Captures live image (default width 1024px, JPEG quality 80). |
|
| Returns a multi-frame sequence rendered into a contact sheet. |
|
| Contact sheet of buffered frames aligned with adapter events. |
|
| Computes mean brightness, contrast, lit %, edge density, sharpness, motion. |
|
| Asynchronously waits for visual condition with before/after evidence. |
|
| Saves named region of interest using normalized or pixel coordinates. |
| none | Lists all defined named regions. |
|
| Deletes a defined region. |
|
| Prompts user on the dashboard to draw a region interactively. |
|
| Persists a golden reference image in the data directory. |
|
| Computes SSIM score, changed pixel %, and diff heatmap. |
|
| Extracts text and confidence using OCR (optional extra). |
|
| Negotiates driver settings and reports accepted vs ignored values. |
|
| Reads timestamped events from serial ports, logfiles, or MQTT. |
|
| Executes allowlisted system commands with optional timeline observation. |
9. Recommended Agent Instructions
Add the following verification policy to your project instructions (AGENTS.md, GEMINI.md, or CLAUDE.md):
# Physical Verification Policy
Never report physical task completion or hardware success without verification:
1. Call `get_status` to ensure camera streams are active.
2. Call `capture_image` or `measure` to verify physical state (LEDs, displays, moving components).
3. If checking state changes, use `watch` or `compare_to_baseline`.
4. Quote exact observed values in your response (e.g. "Status LED brightness rose from 12.0 to 184.5").
5. Never assume success based solely on compiler output or flash utility logs.10. Performance Benchmarks
Measured on a standard workstation (Python 3.11, Windows 11):
Operation | Measured Latency | Specification Target | Status |
| 43.47 ms | < 100 ms | PASS |
| 3.23 ms median | < 250 ms | PASS |
| 4.11 ms | < 250 ms | PASS |
Buffer RAM consumption (30s @ 4 fps) | < 15.0 MB | < 300 MB cap | PASS |
Daemon startup health latency | 0.85 s | < 3.0 s | PASS |
11. Security and Privacy
Local Host Binding: Defaults to
127.0.0.1. Non-localhost binding requires explicit flags and prints warnings.Header Validation: Strict verification of
HostandOriginheaders prevents cross-site scripting and DNS rebinding attacks.Access Token: Mutating endpoints require an authentication token generated per-installation and stored with user-only permissions.
Action Allowlist: The
run_actiontool only runs commands defined inconfig.json. Subprocesses execute argv lists directly (shell=False).Privacy Redaction: Rectangular privacy masks black out pixels in the camera layer before frames reach agents, buffers, or previews.
Agent Access Pause: A hardware pause toggle instantly revokes agent image access and returns a structured
paused_by_userstatus.
12. Troubleshooting Guide
Symptom | Cause | Solution |
Black image returned | Privacy shutter closed or inadequate lighting | Remove lens cover; verify room illumination. |
| Another application holds camera lock | Close video meeting software, browser tabs, or other capture tools. |
Permission denied | OS camera privacy settings block access | Enable camera access in Windows Settings > Privacy > Camera or macOS System Settings. |
Tools not showing in IDE | IDE has not reloaded MCP configuration | Restart the IDE completely to reload |
Port 8765 occupied | Previous process lingering | Run |
High CPU usage | Full resolution MJPEG streaming | The dashboard automatically downscales preview streams to 720p. |
13. License
Released under the MIT License. Copyright (c) 2026 SK Raihan.
Available Tools
19 toolsanalyze_ledA
Sample high-speed frames of an LED or indicator to detect state (solid_on, blinking, off), blink frequency in Hz, duty cycle, and exact perceived color (red, green, blue, amber, etc.).
Inputs: fps, camera, region, duration_s.
capture_imageA
Use this any time you need to visually inspect the hardware. Captures a live frame directly as an MCP image result. Never saves to disk by default. Can crop to a defined region and annotate existing regions.
Inputs: width, camera, format, region, +1 more.
capture_sequenceA
Captures a sequence of frames over time and returns a single token-efficient contact sheet with timestamps. Use to observe physical motions, LED blink patterns, or mechanical movements.
Inputs: seconds (required), fps, camera, region.
compare_to_baselineA
Compare the current physical camera state against a saved baseline. Returns SSIM structural similarity score, percent of changed pixels, and a visual difference heatmap image.
Inputs: name (required), camera, region.
define_regionB
Define and save a named region of interest (e.g. 'status_led', 'oled_screen', 'pixgen32') using normalized coordinates (0.0 to 1.0) or 4 corner points for perspective homography.
Inputs: name (required), h, w, x, +5 more.
delete_regionB
Delete a saved named region.
Inputs: name (required).
get_statusA
Use this any time you need to see the physical hardware: while debugging, after reboots, during serial output, mid-process. Do not wait until the end of a task. Returns daemon version, uptime, camera states, pause flag, buffer fill, adapters, and system warnings. Always call this first.
Inputs: no named parameters.
get_timelineA
Returns a contact sheet of buffered history frames plus timestamp-aligned event lines from serial or log adapters. Use to correlate hardware events (e.g. crash, reset, button press) with visual frames.
Inputs: camera, last_seconds, include_events.
list_camerasA
List all detected physical USB webcams and IP cameras with their ID, name, resolution, fps, and state.
Inputs: refresh.
list_regionsA
List all saved named hardware regions of interest.
Inputs: no named parameters.
measureA
Compute quantitative measurements on the camera frame or region without returning heavy images. Returns mean brightness, contrast, lit-pixel percentage, dominant colors, edge density, sharpness (Laplacian variance), and motion level.
Inputs: camera, region.
read_eventsA
Read timestamped lines from an active event adapter (serial, log file, MQTT). Can block until specific text appears or until timeout.
Inputs: source (required), lines, timeout_s, until_text, +1 more.
read_textA
Perform OCR to extract printed text or seven-segment display digits from the camera frame or region. Returns extracted text and confidence.
Inputs: camera, region.
rectify_regionA
Capture and perspective-correct (unwarp/rectify) an angled hardware region or screen into a flat, orthogonal top-down image. Returns the rectified image for high-precision inspection or OCR.
Inputs: region (required), camera, format.
request_region_from_userA
Ask the user in the Dashboard UI to interactively draw a region on the camera preview. Blocks until user finishes drawing or timeout.
Inputs: name (required), message.
run_actionB
Execute a configured allowlist action (e.g. 'reset_board', 'pause_print'). Subject to approval policy. If observe_seconds is configured, returns post-action timeline sheet.
Inputs: name (required), args.
save_baselineA
Capture and persist a golden reference image for subsequent comparison. Use to establish a known-good baseline before running experiments or flashing firmware.
Inputs: name (required), camera, region.
set_camera_settingsA
Adjust hardware camera parameters: exposure, focus, brightness, contrast, gain, white balance, or lock auto settings. Reports exactly which parameters were accepted vs rejected by the driver.
Inputs: camera (required), gain, focus, contrast, +4 more.
watchB
Asynchronously monitor the camera until a physical condition is met or timeout expires. Conditions: 'change', 'motion_start', 'motion_stop', 'brightness_above', 'brightness_below', 'color_present'. Returns fired status, timing, and before/after evidence images.
Inputs: condition (required), camera, region, threshold, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Most tools target distinct purposes (capture vs analysis vs monitoring vs region management). Some overlap exists between capture_image, capture_sequence, and get_timeline, which all return frames but at different time semantics; descriptions differentiate them reasonably well. analyze_led and measure also stay distinct (LED state vs general quantitative metrics).
Nearly all tools use snake_case, most following a verb_noun pattern (list_cameras, capture_image, define_region, save_baseline). A few use bare verbs without a noun (measure, watch), which is a minor deviation but still readable and consistent in casing style.
19 tools is slightly heavy but each covers a genuine capability in a rich domain (capture, camera settings, region lifecycle, analysis, monitoring, baseline comparison, actions). No obvious redundancies, though the set sits at the upper end of the comfortable range.
The surface covers the full lifecycle: camera discovery, capture, settings, region define/list/delete/request, analysis (OCR, LED, measure), monitoring (watch, timeline, events, sequence), baseline save/compare, actions, and status. No significant gaps for the stated physical-inspection purpose.
Maintenance
Related MCP Connectors
Watch cameras and video with AI vision and get alerts in Slack, Discord, Telegram or a webhook.
Generate images, GIFs, videos, and PDFs from HTML, URLs, or templates — from your AI agent.
Video, audio, and image processing for AI agents: convert, transcribe, upscale - 150+ operations.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Related MCP Servers
- FlicenseAqualityNot gradedmaintenanceEnables AI agents to analyze images through vision AI providers (Gemini, OpenAI, Claude), performing tasks like image description, object detection with bounding boxes, region-specific analysis, and precise color extraction without consuming context window with raw pixels.4-
- AlicenseAqualityDmaintenanceEnables AI agents to analyze images, extract text, compare images, and analyze video through any OpenAI-compatible vision model.4375 npm20MIT
- AlicenseNot gradedqualityBmaintenanceEnables text-only AI agents to see images on demand by calling any OpenAI-compatible vision API for OCR, image analysis, structured extraction, image comparison, and GUI screenshot-to-accessibility-tree conversion.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to connect to security cameras, detect objects with YOLOv8, recognize known faces, monitor restricted intrusion zones, capture annotated snapshots, and query a persistent SQLite event history.MIT