go2rtc-mcp
Provides tools for interacting with Home Assistant's built-in go2rtc service, enabling inspection of camera streams, codec probing, JPEG snapshots, playback URL generation, and dynamic stream management.
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., "@go2rtc-mcp capture a live JPEG snapshot from the front door camera"
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.
go2rtc-mcp
A production-grade Model Context Protocol (MCP) server for go2rtc (including Home Assistant's built-in go2rtc service). Designed primarily for Linux environments (Home Assistant Supervised/OS, Debian/Ubuntu, Docker, and headless media servers), go2rtc-mcp enables AI assistants and MCP clients to inspect camera streams, probe video/audio codecs, capture live JPEG snapshots, generate streaming playback URLs (WebRTC, MSE, HLS, MP4, MJPEG, RTSP), discover camera integrations, and manage streams dynamically—with strict, automated credential redaction.
Table of Contents
Related MCP server: WAVE MCP Server
Architecture & Security Guardrails
Live go2rtc API endpoints (/api/streams, /api/config, /api/hass, /api/log) regularly return plaintext or URL-encoded camera credentials and authentication tokens in RTSP producer URLs. go2rtc-mcp enforces defense-in-depth security:
1. Centralized Recursive Credential Redaction (redact_sensitive_data)
Every MCP tool return value, MCP resource response, client error message, and log record passes through redact_sensitive_data:
Universal URI Credential Masking: Masks credentials in any URI scheme (
rtsp://,rtsps://,http://,https://,rtmp://,onvif://,dvrip://, including chained prefixes likeffmpeg:rtsp://...).Query Parameter Token Masking: Masks sensitive query parameters (
token,access_token,auth,password,pass,pwd,secret,api_key,jwt).Recursive Dict Key & Value Sanitization: Sanitizes both dictionary keys and values (crucial because
go2rtccreates dynamic stream keys named after raw RTSP URLs), lists, tuples, sets, Pydantic models, and multiline YAML text.Log Stream Redaction: Attaches
RedactingLoggingFiltertohttpx,httpcore,mcp, andgo2rtc_mcploggers so credentials never reachstdout/stderrorjournald.
Example Transformation:
Raw from go2rtc:
rtsp://admin:mockpass%2A@192.0.2.10:554/Streaming/Channels/101
rtsp://stream.example.com/live?token=eyJmockToken123&tracks=v1a1
Returned by go2rtc-mcp:
rtsp://***:***@192.0.2.10:554/Streaming/Channels/101
rtsp://stream.example.com/live?token=***&tracks=v1a12. Command Execution Guardrail (GO2RTC_ALLOW_EXEC_STREAMS)
go2rtc allows stream sources starting with exec:, echo:, and expr: to execute host shell commands. By default (GO2RTC_ALLOW_EXEC_STREAMS=false), go2rtc-mcp rejects any add_stream or update_stream request containing exec:, echo:, or expr: (including chained forms like ffmpeg:exec:...) before any network request is issued.
Linux Installation & Quick Start
Prerequisites
Linux (Debian, Ubuntu, Alpine, Arch, Fedora, Raspberry Pi OS, etc.)
Python
>= 3.11uv package manager (recommended:
curl -LsSf https://astral.sh/uv/install.sh | sh)
Instant Run with uvx (No Clone Required)
Run go2rtc-mcp directly using uvx from PyPI:
# Run over stdio
GO2RTC_URL=http://localhost:1984 uvx go2rtc-mcpManual Installation from Source
1. Clone the Repository
git clone https://github.com/gaxkalik/go2rtc-mcp.git
cd go2rtc-mcp2. Install Dependencies with uv
uv sync3. Configure Environment Variables
Copy .env.example to .env:
cp .env.example .envEdit .env using your preferred editor (nano .env or vim .env):
GO2RTC_URL=http://localhost:1984
GO2RTC_USERNAME=
GO2RTC_PASSWORD=
GO2RTC_TIMEOUT=15.0
GO2RTC_ALLOW_EXEC_STREAMS=false4. Run and Test the MCP Server
Run over stdio transport (standard for MCP clients):
uv run go2rtc-mcpOr test interactively in your browser with the official MCP Inspector:
npx @modelcontextprotocol/inspector uv run go2rtc-mcpConfiguration
go2rtc-mcp loads settings from environment variables (and automatically reads a local .env file if present):
Environment Variable | Default | Description |
|
| Base HTTP/HTTPS URL of your |
| (empty) | Optional HTTP Basic Auth username |
| (empty) | Optional HTTP Basic Auth password |
|
| Request timeout in seconds |
|
| Set to |
MCP Client Configuration (Claude Desktop, Cursor, Antigravity)
Option A: Using uvx from PyPI (Recommended - No Clone Needed)
Add go2rtc to your client configuration file:
Linux:
~/.config/Claude/claude_desktop_config.jsonor~/.gemini/config/mcp_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"go2rtc": {
"command": "uvx",
"args": ["go2rtc-mcp"],
"env": {
"GO2RTC_URL": "http://localhost:1984",
"GO2RTC_ALLOW_EXEC_STREAMS": "false"
}
}
}
}Option B: From Local Source Clone
If running from a cloned local repository:
{
"mcpServers": {
"go2rtc": {
"command": "uv",
"args": [
"--directory",
"/path/to/go2rtc-mcp",
"run",
"go2rtc-mcp"
],
"env": {
"GO2RTC_URL": "http://localhost:1984",
"GO2RTC_ALLOW_EXEC_STREAMS": "false"
}
}
}
}Running as a Systemd Service (Linux)
If you wish to run go2rtc-mcp as a persistent background daemon or manage it through Linux systemctl:
Create /etc/systemd/system/go2rtc-mcp.service:
[Unit]
Description=go2rtc Model Context Protocol Server
After=network.target
[Service]
Type=simple
User=user
WorkingDirectory=/home/user/go2rtc-mcp
EnvironmentFile=/home/user/go2rtc-mcp/.env
ExecStart=/home/user/.cargo/bin/uv run go2rtc-mcp
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.targetEnable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable --now go2rtc-mcp
sudo systemctl status go2rtc-mcpUsage Guide
Example Natural-Language Prompts
Ask your AI assistant:
"List all cameras configured on my go2rtc server."
"Take a snapshot of
door_cameraand describe the current scene.""Perform a security patrol across all active cameras."
"Probe
garage_cameracodecs, resolution, and RTSP protocol.""Generate WebRTC viewer, HLS (.m3u8), and RTSP playback links for
outside_camera.""Check recent go2rtc logs for connection errors or offline feeds."
MCP Tools Reference & Examples
1. get_server_info()
Fetches go2rtc version, revision, host, and RTSP port (GET /api).
Sample Output:
{ "config_path": "/config/go2rtc.yaml", "host": "localhost:1984", "revision": "b5948cf", "rtsp": { "default_query": "video&audio", "listen": ":554" }, "version": "1.9.14" }
2. list_streams()
Lists all configured and active streams (GET /api/streams) with credentials automatically masked.
Sample Output:
{ "door_camera": { "producers": [ { "url": "rtsp://***:***@192.0.2.10:554/Streaming/Channels/101" } ], "consumers": [] }, "garage_camera": { "producers": [ { "url": "rtsp://***:***@192.0.2.11:554/Streaming/Channels/101" } ], "consumers": [] } }
3. get_stream_info(stream_name: str, probe: bool = False)
Fetches producer and consumer state for a specific camera (GET /api/streams?src=<stream_name>). Pass probe=True to query live codecs and SDP.
4. probe_stream(stream_name: str)
Actively queries GET /api/streams?src=<stream_name>&video=all&audio=all to inspect active codecs (H.264, H.265, AAC, PCMA, Opus), SDP tracks, protocol (rtsp+tcp), and byte counters.
5. get_stream_snapshot(stream_name: str, width: int | None = None, height: int | None = None)
Captures a live JPEG frame from stream_name (GET /api/frame.jpeg?src=<stream_name>) and returns it as a native MCP Image (image/jpeg) for multimodal vision models.
6. get_stream_urls(stream_name: str)
Generates ready-to-use streaming URLs for web, mobile, and NVR playback:
Sample Output:
{ "stream": "door_camera", "webrtc_viewer": "http://localhost:1984/stream.html?src=door_camera&mode=webrtc", "mse_viewer": "http://localhost:1984/stream.html?src=door_camera&mode=mse", "websocket_url": "ws://localhost:1984/api/ws?src=door_camera", "hls_m3u8": "http://localhost:1984/api/stream.m3u8?src=door_camera", "mp4_stream": "http://localhost:1984/api/stream.mp4?src=door_camera", "mjpeg_stream": "http://localhost:1984/api/stream.mjpeg?src=door_camera", "snapshot_jpeg": "http://localhost:1984/api/frame.jpeg?src=door_camera", "rtsp_url": "rtsp://localhost:554/door_camera" }
7. add_stream(stream_name: str, source_url: str)
Dynamically registers or updates a stream (PUT /api/streams?name=<name>&src=<url>), validating against GO2RTC_ALLOW_EXEC_STREAMS.
8. update_stream(stream_name: str, source_url: str)
Dynamically updates an existing stream source (PATCH /api/streams).
9. delete_stream(stream_name: str)
Removes a dynamically registered stream (DELETE /api/streams?src=<name>).
10. get_config()
Retrieves sanitized go2rtc.yaml configuration (GET /api/config) with all secrets masked.
11. get_server_logs(limit: int = 50)
Fetches recent go2rtc log entries (GET /api/log) with credentials redacted.
12. discover_sources(provider: str = "hass")
Discovers stream sources from integrations (hass, onvif, dvrip, homekit, roborock, webtorrent).
MCP Resources Reference
Resource URI | MIME Type | Description |
|
| Server version, revision, host, and RTSP listener config |
|
| Complete dictionary of streams with redacted producer URLs |
|
| Producer and consumer details for |
|
| Sanitized |
MCP Prompts Reference
snapshot_all: Captures live frames from all cameras and generates a multi-camera visual security summary.security_patrol: Full security assessment combining stream health, frame capture, and log error analysis.diagnose_stream(stream_name): Guided step-by-step diagnostic workflow for troubleshooting a camera.camera_urls(stream_name): Formats all direct streaming integration links.stream_health_check: System-wide health audit of all streams, codecs, and logs.
Programmatic Python Usage
import asyncio
from go2rtc_mcp import Go2RtcClient, Go2RtcSettings, redact_sensitive_data
async def main() -> None:
settings = Go2RtcSettings.from_env()
client = Go2RtcClient(settings=settings)
# 1. Fetch server metadata
info = await client.get_server_info()
print("Server version:", info.get("version"))
# 2. List streams (credentials automatically masked)
streams = await client.list_streams()
for name, data in streams.items():
print(f"Stream: {name} -> {data}")
# 3. Capture a live JPEG snapshot
jpeg_bytes = await client.get_snapshot("door_camera", width=1280)
with open("door_snapshot.jpg", "wb") as f:
f.write(jpeg_bytes)
print("Saved door_snapshot.jpg")
if __name__ == "__main__":
asyncio.run(main())Project Structure
go2rtc-mcp/
├── .env.example # Safe template for environment variables
├── .gitignore # Excludes .env, snapshots (*.jpg/*.png/*.mp4), and live dumps
├── LICENSE # MIT License
├── pyproject.toml # Package metadata, dependencies, pytest & ruff config
├── README.md # Project documentation and Linux usage guide
├── src/
│ └── go2rtc_mcp/
│ ├── __init__.py # Public package exports
│ ├── client.py # Async httpx Go2RtcClient with automatic redaction
│ ├── config.py # Pydantic Go2RtcSettings & dotenv loader
│ ├── models.py # Pydantic models for server & stream objects
│ ├── sanitizer.py # Alias module re-exporting security redaction utilities
│ ├── security.py # redact_sensitive_data, validate_stream_source, log filter
│ └── server.py # MCPServer tools, resources, prompts, and CLI entry point
└── tests/
├── test_client.py # respx unit tests for Go2RtcClient endpoints & error handling
├── test_security.py # Unit tests for URI schemes, recursive redaction & exec policy
└── test_server.py # Unit tests for MCP tools, resources, snapshots & promptsDevelopment & Testing
All unit tests use synthetic RFC 5737 (192.0.2.0/24) test fixtures and mock responses via respx so tests run offline and deterministically on Linux:
# Run unit tests
uv run python -m pytest -v
# Run ruff linter
uv run ruff check src/ tests/License
Released under the MIT License.
Available Tools
12 toolsadd_streamB
Dynamically add or overwrite a stream on go2rtc (PUT /api/streams).
Rejects exec:, echo:, and expr: sources unless GO2RTC_ALLOW_EXEC_STREAMS=true.
Inputs: source_url (required), stream_name (required). Returns: object
delete_streamC
Delete a dynamically registered stream from go2rtc (DELETE /api/streams).
Inputs: stream_name (required). Returns: object
discover_sourcesB
Discover stream sources from a go2rtc integration (hass, onvif, dvrip, homekit).
Inputs: provider.
get_configA
Retrieve the go2rtc YAML configuration (GET /api/config) with all credentials redacted.
Inputs: no named parameters. Returns: result
get_server_infoA
Get go2rtc server metadata including version, revision, host, RTSP port, and config path.
Inputs: no named parameters. Returns: object
get_server_logsA
Retrieve the most recent limit log entries from go2rtc (GET /api/log), sanitized.
Inputs: limit. Returns: result
get_stream_infoA
Get producer and consumer details for a specific stream (stream_name).
Set probe=True to actively query video/audio codecs, SDP, and byte counters.
Inputs: stream_name (required), probe. Returns: object
get_stream_snapshotC
Capture a live JPEG snapshot frame from stream_name and return it as an MCP Image.
Inputs: stream_name (required), width, height.
get_stream_urlsB
Generate WebRTC, MSE, HLS (.m3u8), MP4, MJPEG, JPEG snapshot, and RTSP URLs for a stream.
Inputs: stream_name (required). Returns: object
list_streamsA
List all configured and active streams on the go2rtc server with credentials redacted.
Inputs: no named parameters. Returns: object
probe_streamB
Actively probe a camera stream to inspect its video/audio codecs, SDP, and track stats.
Inputs: stream_name (required). Returns: object
update_streamA
Dynamically update an existing stream on go2rtc (PATCH /api/streams).
Rejects exec:, echo:, and expr: sources unless GO2RTC_ALLOW_EXEC_STREAMS=true.
Inputs: source_url (required), stream_name (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Most tools have clearly distinct purposes, but get_stream_info (with probe=True) and probe_stream overlap significantly in actively inspecting stream codecs, SDP, and track stats. This one pair could cause occasional misselection, though descriptions help clarify the intended use.
All tool names use snake_case with a consistent verb_noun pattern (e.g., get_server_info, list_streams, add_stream, delete_stream). The convention is predictable and readable throughout, with only minor natural variation like probe_stream vs. get_stream_info.
With 12 tools, the set is well-scoped for managing a go2rtc server: CRUD for streams, inspection, discovery, snapshots, URLs, config, and logs. Each tool earns its place without obvious redundancy or bloat.
The surface covers core stream lifecycle operations, server info, logs, config, discovery, snapshots, and URL generation. Minor gaps exist, such as a server restart or health-check operation, but agents can work around these for most workflows.
Maintenance
Related MCP Connectors
Manage 24/7 live streams, media, playback queues, schedules, and multistreaming from AI assistants.
Query, browse, and automate OmegaAI workspaces from any MCP client. Streamable HTTP with OAuth 2.0.
Manage SRG+ hubs, channels, content, assets, users, and workspaces from any MCP-aware AI agent.
AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables interaction with local camera devices to capture and process images. It allows LLMs to access video devices with configurable settings such as resolution, orientation, and image format.1MIT

WAVE MCP Serverofficial
AlicenseAqualityBmaintenanceExposes WAVE streaming APIs as tools for AI assistants to manage live streams, studio productions, and real-time analytics. It enables users to control stream lifecycles, monitor health metrics, and access billing usage through the Model Context Protocol.2487 npm1Apache 2.0- FlicenseBqualityBmaintenanceEnables AI agents to access an allowlisted set of local Eufy cameras through MediaMTX, providing camera status, single JPEG snapshots, and motion clip listing with frame extraction, without PTZ or cloud APIs.6-

Upstream MCP Serverofficial
AlicenseNot gradedqualityCmaintenanceEnables an AI assistant to run cloud live streaming end to end: starting and stopping broadcasts, reordering playback queues, searching and organizing the media library, planning stream schedules, and managing multistream destinations. It connects over a remote Streamable HTTP endpoint secured with OAuth or a personal access token, applying the same validation, ownership rules, and rate limits as the public REST API.1MIT