Skip to main content

MCP server for camera/vision tools - connect any camera to AI assistants

Project description

OpticMCP

PyPI version Python 3.10+ License: MIT

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 (Planned) - RTSP, ONVIF, HTTP 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 (v0.1.0 - USB Cameras)

  • list_cameras - Scan and list all available USB cameras
  • capture_image - Capture a frame and return as base64-encoded JPEG
  • save_image - Capture a frame and save directly to a file

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

Testing with the Client (from source)

uv run python client.py

Direct Camera Test (from source)

uv run python test_camera.py

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/ or your project directory):

{
  "mcp": {
    "servers": {
      "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", "python", "-m", "optic_mcp.server"]
    }
  }
}

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)"
  }
]

capture_image

Captures a single frame from the specified camera.

Parameters:

  • camera_index (int, default: 0) - Camera index to capture from

Returns: Base64-encoded JPEG string

save_image

Captures a frame and saves it to disk.

Parameters:

  • file_path (str) - Path where the image will be saved
  • camera_index (int, default: 0) - Camera index to capture from

Returns: Success message with file path

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 streams)
  • v0.3.0 - Camera configuration (resolution, format, etc.)
  • v0.4.0 - Video recording capabilities
  • v0.5.0 - Multi-camera simultaneous capture

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

optic_mcp-0.2.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

optic_mcp-0.2.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file optic_mcp-0.2.0.tar.gz.

File metadata

  • Download URL: optic_mcp-0.2.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for optic_mcp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5ed0208d1c3df95885a1ec4b52209017df2492f2f5f38d3776c0ae496c937172
MD5 80cab9d172546bf3bf47d425b77b2f32
BLAKE2b-256 1db8022ae05a344f341ac1b594c71db21b72097c1026c229dd261286e2f17ac5

See more details on using hashes here.

Provenance

The following attestation bundles were made for optic_mcp-0.2.0.tar.gz:

Publisher: publish.yml on Timorleiderman/OpticMCP

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file optic_mcp-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: optic_mcp-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for optic_mcp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aaf5c7e36e8bad974f31c82321f272aae97cb41342211f89f65ec25ee2e5ee3c
MD5 0e80f89601d963b94749f5b64555dee5
BLAKE2b-256 f6ce9ce5310d6ea8a292afe1407d4c706b3c241f5668d6385b330998f42f8f78

See more details on using hashes here.

Provenance

The following attestation bundles were made for optic_mcp-0.2.0-py3-none-any.whl:

Publisher: publish.yml on Timorleiderman/OpticMCP

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page