MCP server for camera/vision tools - connect any camera to AI assistants
Project description
OpticMCP
A Model Context Protocol (MCP) server that provides camera/vision tools for AI assistants. Connect to cameras and capture images for use with LLMs.
Vision
OpticMCP aims to be a universal camera interface for AI assistants, supporting any camera type:
- USB Cameras (Current)
- IP/Network Cameras (Current) - RTSP, HLS streams
- Raspberry Pi Cameras (Planned) - CSI camera modules
- Screen Capture (Planned) - Desktop/window capture
- Mobile Cameras (Planned) - Phone camera integration
- Cloud Cameras (Planned) - Integration with cloud camera services
Current Features
USB Cameras
- list_cameras - Scan and list all available USB cameras
- save_image - Capture a frame and save directly to a file
Camera Streaming
- start_stream - Start streaming a camera to a localhost HTTP server (MJPEG)
- stop_stream - Stop streaming a camera
- list_streams - List all active camera streams
Multi-Camera Dashboard
- start_dashboard - Start a dynamic dashboard that displays all active camera streams in a responsive grid
- stop_dashboard - Stop the dashboard server
RTSP Streams (Not tested with real hardware)
- rtsp_save_image - Capture and save a frame from an RTSP stream
- rtsp_check_stream - Validate RTSP stream and get properties
HLS Streams (HTTP Live Streaming)
- hls_save_image - Capture and save a frame from an HLS stream
- hls_check_stream - Validate HLS stream and get properties
Requirements
- Python 3.10+
- USB camera connected to your system
Installation
From PyPI (Recommended)
pip install optic-mcp
Or with uv:
uv pip install optic-mcp
From Source
# Clone the repository
git clone https://github.com/Timorleiderman/OpticMCP.git
cd OpticMCP
# Install dependencies with uv
uv sync
Usage
Running the MCP Server
If installed from PyPI:
optic-mcp
Or with uvx (no installation required):
uvx optic-mcp
Running from Source
uv run optic-mcp
MCP Configuration
Claude Desktop
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"optic-mcp": {
"command": "uvx",
"args": ["optic-mcp"]
}
}
}
OpenCode
Add to your opencode.json (in .opencode/ in your project directory or ~/.opencode/ globally):
{
"mcp": {
"optic-mcp": {
"type": "local",
"command": ["uvx", "optic-mcp"]
}
}
}
Other MCP Clients
Using uvx (recommended - no installation required):
{
"mcpServers": {
"optic-mcp": {
"command": "uvx",
"args": ["optic-mcp"]
}
}
}
Using pip installation:
{
"mcpServers": {
"optic-mcp": {
"command": "optic-mcp"
}
}
}
From source:
{
"mcpServers": {
"optic-mcp": {
"command": "uv",
"args": ["run", "--directory", "/path/to/OpticMCP", "optic-mcp"]
}
}
}
Tools
list_cameras
Scans for available USB cameras (indices 0-9) and returns their status.
[
{
"index": 0,
"status": "available",
"backend": "AVFOUNDATION",
"description": "Camera 0 (AVFOUNDATION)"
}
]
save_image
Captures a frame and saves it to disk.
Parameters:
file_path(str) - Path where the image will be savedcamera_index(int, default: 0) - Camera index to capture from
Returns: Success message with file path
Streaming Tools
Stream cameras to a local HTTP server for real-time viewing in any browser.
start_stream
Start streaming a camera to a localhost HTTP server. The stream uses MJPEG format which is widely supported.
Parameters:
camera_index(int, default: 0) - Camera index to streamport(int, default: 8080) - Port to serve the stream on
Returns: Dictionary with stream URLs and status
{
"status": "started",
"camera_index": 0,
"port": 8080,
"url": "http://localhost:8080",
"stream_url": "http://localhost:8080/stream"
}
Usage:
- Open
http://localhost:8080in a browser to view the stream with a simple UI - Use
http://localhost:8080/streamfor the raw MJPEG stream (can be embedded in other applications)
stop_stream
Stop streaming a camera.
Parameters:
camera_index(int, default: 0) - Camera index to stop streaming
Returns: Dictionary with status
list_streams
List all active camera streams.
Returns: List of active stream information including URLs and ports
Dashboard Tools
start_dashboard
Start a dynamic multi-camera dashboard server. The dashboard automatically detects all active camera streams and displays them in a responsive grid layout.
Parameters:
port(int, default: 9000) - Port to serve the dashboard on
Returns: Dictionary with dashboard URL and status
{
"status": "started",
"port": 9000,
"url": "http://localhost:9000"
}
Usage:
- Start one or more camera streams with
start_stream - Start the dashboard with
start_dashboard - Open
http://localhost:9000in a browser - The dashboard auto-updates every 3 seconds to detect new/removed streams
stop_dashboard
Stop the dashboard server.
Returns: Dictionary with status
RTSP Tools
Note: RTSP functionality has not been tested with real RTSP hardware/streams. It is implemented but may require adjustments for specific camera vendors.
rtsp_save_image
Captures a frame from an RTSP stream and saves it to disk.
Parameters:
rtsp_url(str) - RTSP stream URL (e.g.,rtsp://ip:554/stream)file_path(str) - Path where the image will be savedtimeout_seconds(int, default: 10) - Connection timeout
Returns: Success message with file path
rtsp_check_stream
Validates an RTSP stream and returns stream information.
Parameters:
rtsp_url(str) - RTSP stream URL to validatetimeout_seconds(int, default: 10) - Connection timeout
Returns: Dictionary with stream status and properties (width, height, fps, codec)
HLS Tools
hls_save_image
Captures a frame from an HLS stream and saves it to disk.
Parameters:
hls_url(str) - HLS stream URL (typically ending in.m3u8)file_path(str) - Path where the image will be savedtimeout_seconds(int, default: 30) - Connection timeout
Returns: Success message with file path
hls_check_stream
Validates an HLS stream and returns stream information.
Parameters:
hls_url(str) - HLS stream URL to validatetimeout_seconds(int, default: 30) - Connection timeout
Returns: Dictionary with stream status and properties (width, height, fps, codec)
Technical Notes
OpenCV + MCP Compatibility
OpenCV prints debug messages to stderr which corrupts MCP's stdio communication. This server suppresses stderr at the file descriptor level before importing cv2 to prevent this issue.
Roadmap
- v0.1.0 - USB camera support via OpenCV
- v0.2.0 - IP camera support (RTSP and HLS streams)
- v0.3.0 - Multi-camera dashboard with realtime streaming
- v0.4.0 - Camera configuration (resolution, format, etc.)
- v0.5.0 - Video recording capabilities
Contributing
Contributions are welcome! See CONTRIBUTING.md for guidelines.
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file optic_mcp-0.3.0.tar.gz.
File metadata
- Download URL: optic_mcp-0.3.0.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbf8227f9e5b6d0283baa1b9296a42c8ecf69c9dbb0e33c13f5c3ff213bbfde7
|
|
| MD5 |
66fe11ffe62e2ffffe602e2a36946093
|
|
| BLAKE2b-256 |
12ee6b788b3a9bf3e9f11f295b6d7be47ddbe73bcc3a5772dab948cd34af981d
|
Provenance
The following attestation bundles were made for optic_mcp-0.3.0.tar.gz:
Publisher:
publish.yml on Timorleiderman/OpticMCP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
optic_mcp-0.3.0.tar.gz -
Subject digest:
fbf8227f9e5b6d0283baa1b9296a42c8ecf69c9dbb0e33c13f5c3ff213bbfde7 - Sigstore transparency entry: 757964030
- Sigstore integration time:
-
Permalink:
Timorleiderman/OpticMCP@7767c07aa3c4fe752ecb0ed25d083c3b0621b4fb -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/Timorleiderman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7767c07aa3c4fe752ecb0ed25d083c3b0621b4fb -
Trigger Event:
release
-
Statement type:
File details
Details for the file optic_mcp-0.3.0-py3-none-any.whl.
File metadata
- Download URL: optic_mcp-0.3.0-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e36094449300009be2b4979c0d190888648c55afccd7ead0da720b9a6cad1882
|
|
| MD5 |
44ce214a30d8de77dbe2b1c024301b73
|
|
| BLAKE2b-256 |
56c7a550a21a07aec708c913b4c0be032b6f5ab61bd82fae4d80130a22cbc2e1
|
Provenance
The following attestation bundles were made for optic_mcp-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on Timorleiderman/OpticMCP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
optic_mcp-0.3.0-py3-none-any.whl -
Subject digest:
e36094449300009be2b4979c0d190888648c55afccd7ead0da720b9a6cad1882 - Sigstore transparency entry: 757964032
- Sigstore integration time:
-
Permalink:
Timorleiderman/OpticMCP@7767c07aa3c4fe752ecb0ed25d083c3b0621b4fb -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/Timorleiderman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7767c07aa3c4fe752ecb0ed25d083c3b0621b4fb -
Trigger Event:
release
-
Statement type: