v0.1.1 Released on PyPI

Connect AI Assistants to Live Cameras with
go2rtc & MCP

Production-ready Model Context Protocol (MCP) server for go2rtc. Inspect camera feeds, probe video/audio codecs, take live JPEG snapshots, generate streaming URLs, and execute visual security patrolsβ€”with strict, automated credential redaction.

Zero-Install Instant Run
$GO2RTC_URL=http://localhost:1984 uvx go2rtc-mcp

Engineered for Security and Reliability

Built from the ground up for Linux media servers, Home Assistant OS, and modern AI environments.

πŸ›‘οΈ

Automated Credential Redaction

Every tool return value, resource payload, client error message, and log record is recursively scrubbed of RTSP/HTTP credentials, ONVIF passwords, and API tokens.

🚫

Command Execution Guardrail

Dangerous go2rtc sources like exec:, echo:, and expr: are strictly rejected by default before network requests are dispatched, preventing RCE vulnerabilities.

πŸ“Έ

Live JPEG Snapshots

Captures real-time camera frames and feeds them directly to multimodal LLMs (Claude 3.7, Gemini 2.5 Flash/Pro, GPT-4o) for automated visual verification.

πŸ”

Deep Codec Diagnostics

Probes live video and audio streams via /api/probe to diagnose codecs (H.264, H.265, AAC, Opus, PCMU) and identify WebRTC compatibility issues.

🌐

Universal Playback URLs

Instantly generate client-ready WebRTC (WHEP), MSE, HLS, MP4, MJPEG, and RTSP streaming links for direct browser or mobile playback.

🐧

Native Linux & Systemd

Includes production-tested systemd unit files, environment files, and zero-install uvx execution for headless Linux and Home Assistant deployments.

Zero-Leak Security Guardrail

Real RTSP streams expose camera credentials in producer URLs. go2rtc-mcp masks them automatically before LLMs ever see them.

Raw go2rtc API Response (Exposed)
rtsp://admin:SecretPass2026!@192.168.1.50:554/live
http://cam.lan/snapshot.jpg?token=eyJhbGciOiJIUzI1Ni...
ffmpeg:rtsp://viewer:CamP@ss@192.168.1.51:554/ch0
Returned by go2rtc-mcp (Scrubbed)
rtsp://***:***@192.168.1.50:554/live
http://cam.lan/snapshot.jpg?token=***
ffmpeg:rtsp://***:***@192.168.1.51:554/ch0

Client Configuration

Integrate go2rtc-mcp into your favorite MCP-compatible client in seconds.

Add to ~/.config/Claude/claude_desktop_config.json (Linux) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "go2rtc": {
      "command": "uvx",
      "args": ["go2rtc-mcp"],
      "env": {
        "GO2RTC_URL": "http://127.0.0.1:1984"
      }
    }
  }
}

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "go2rtc": {
      "command": "uvx",
      "args": ["go2rtc-mcp"],
      "env": {
        "GO2RTC_URL": "http://127.0.0.1:1984"
      }
    }
  }
}

Plugin configuration in mcp_config.json:

{
  "mcpServers": {
    "go2rtc": {
      "command": "uvx",
      "args": ["go2rtc-mcp"],
      "env": {
        "GO2RTC_URL": "http://127.0.0.1:1984"
      }
    }
  }
}

Create /etc/systemd/system/go2rtc-mcp.service for headless background operation:

[Unit]
Description=go2rtc Model Context Protocol Server
After=network.target go2rtc.service

[Service]
Type=simple
User=root
WorkingDirectory=/opt/go2rtc-mcp
Environment="GO2RTC_URL=http://127.0.0.1:1984"
Environment="GO2RTC_TIMEOUT=15.0"
ExecStart=/root/.cargo/bin/uvx go2rtc-mcp
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

Tools & Resources Reference

12 Tools, 4 MCP Resources, and 5 Specialized Prompts available out of the box.

get_server_info Tool
Retrieve go2rtc server version, status, and health metrics.
Endpoint: GET /api
Returns: Server version string, online state, and connection status.
list_streams Tool
List all configured and dynamic streams with sanitized producer URLs.
Endpoint: GET /api/streams
Security: All RTSP/HTTP passwords and auth tokens in producer source strings are redacted.
get_stream_info Tool
Get detailed stats, active consumer sessions, and track details for a stream.
Parameters: src (string, required) β€” Stream name.
Returns: Active tracks, consumer protocols (webrtc, mse, rtsp), byte counters, and client IPs.
probe_stream Tool
Probe a camera or source URL directly to inspect media streams and codecs.
Parameters: src (string, required) β€” Stream name or media URL.
Returns: Media payloads, audio sample rates, video dimensions, and codec profiles.
get_stream_snapshot Tool
Capture live JPEG frame returned as base64-encoded image content for AI vision.
Parameters: src (string, required) β€” Stream name.
Returns: MCP image content object with mimeType: image/jpeg.
get_stream_urls Tool
Generate all supported client playback URLs for a given stream name.
Parameters: src (string, required) β€” Stream name.
Returns: Full URL dictionary for WebRTC (WHEP), MSE, HLS, MP4, MJPEG, and RTSP.
add_stream Tool
Dynamically add a new stream to go2rtc at runtime with validation.
Parameters: name (string), src (string or list of strings).
Guardrail: Blocks exec:, echo:, expr: sources unless enabled.
get_server_logs Tool
Fetch and redact recent go2rtc server log entries.
Endpoint: GET /api/log
Security: All embedded stream URLs with passwords inside log messages are sanitized.

Environment Variables

Configure go2rtc-mcp using environment variables or a .env file.

Variable Default Description
GO2RTC_URL http://localhost:1984 Base URL of the go2rtc server or Home Assistant go2rtc instance.
GO2RTC_USERNAME (none) Optional HTTP Basic Auth username for secured go2rtc instances.
GO2RTC_PASSWORD (none) Optional HTTP Basic Auth password for secured go2rtc instances.
GO2RTC_TIMEOUT 15.0 Timeout in seconds for HTTP requests to go2rtc.
GO2RTC_ALLOW_EXEC_STREAMS false Allow adding streams with exec:, echo:, or expr: prefixes.