Skip to main content

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 (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

Add to your MCP client configuration (e.g., Claude Desktop, OpenCode):

Using uvx (Recommended)

{
  "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.1.0.tar.gz (4.5 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.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: optic_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 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.1.0.tar.gz
Algorithm Hash digest
SHA256 0f471f0ca60aa187f4260b0757ba11f6a48d2734d46aa719485dc0f9483e4ac3
MD5 f9cc727489ad67d9330455777c501e3e
BLAKE2b-256 07ef16c33d3a93bd6f88f05f0b9922cf3fab6c7339901a48b6eef3a0c63153a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for optic_mcp-0.1.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: optic_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1db8f6e37b7e5bf6b49345c96c1ee13654d86860e1cda235a245b00dd379d767
MD5 0a625a35768f4eeb3fe7f48b11775f70
BLAKE2b-256 acbeacd80a8a306e3438153e89ced4022e7abca9f4074ea4b4143b1c1b8d019b

See more details on using hashes here.

Provenance

The following attestation bundles were made for optic_mcp-0.1.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