Skip to main content

Video Still Capture MCP

A Model Context Protocol server for accessing and controlling webcams via OpenCV

Overview

Video Still Capture MCP is a Python implementation of the Model Context Protocol (MCP) that provides AI assistants with the ability to access and control webcams and video sources through OpenCV. This server exposes a set of tools that allow language models to capture images, manipulate camera settings, and manage video connections. There is no video capture.

Examples

Here are some examples of the Video Still Capture MCP server in action:

Orange Example

Left: Claude's view of the image Right: Actual webcam capture
Claude's view of orange Webcam capture of orange

Magnet Example

Left: Claude's view of the image Right: Actual webcam capture
Claude's view of magnet Webcam capture of magnet

Installation

Prerequisites

Installation from source

git clone https://github.com/13rac1/videocapture-mcp.git
cd videocapture-mcp
pip install -e .

Run the MCP server:

mcp dev videocapture_mcp.py

Integrating with Claude for Desktop

macOS/Linux

Edit your Claude Desktop configuration:

# Mac
nano ~/Library/Application\ Support/Claude/claude_desktop_config.json
# Linux
nano ~/.config/Claude/claude_desktop_config.json 

Add this MCP server configuration:

{
  "mcpServers": {
    "VideoCapture ": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp[cli]",
        "--with",
        "numpy",
        "--with",
        "opencv-python",
        "mcp",
        "run",
        "/ABSOLUTE_PATH/videocapture_mcp.py"
      ]
    }
  }
}

Ensure you replace /ABSOLUTE_PATH/videocapture-mcp with the project's absolute path.

Windows

Edit your Claude Desktop configuration:

nano $env:AppData\Claude\claude_desktop_config.json

Add this MCP server configuration:

{
  "mcpServers": {
    "VideoCapture": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp[cli]",
        "--with",
        "numpy",
        "--with",
        "opencv-python",
        "mcp",
        "run",
        "C:\ABSOLUTE_PATH\videocapture-mcp\videocapture_mcp.py"
      ]
    }
  }
}

Ensure you replace C:\ABSOLUTE_PATH\videocapture-mcp with the project's absolute path.

Using the Installation Command

Alternatively, you can use the mcp CLI to install the server:

mcp install videocapture_mcp.py

This will automatically configure Claude Desktop to use your videocapture MCP server.

Once integrated, Claude will be able to access your webcam or video source when requested. Simply ask Claude to take a photo or perform any webcam-related task.

Features

  • Quick Image Capture: Capture a single image from a webcam without managing connections
  • Connection Management: Open, manage, and close camera connections
  • Video Properties: Read and adjust camera settings like brightness, contrast, and resolution
  • Image Processing: Basic image transformations like horizontal flipping

Tools Reference

quick_capture

Quickly open a camera, capture a single frame, and close it.

quick_capture(device_index: int = 0, flip: bool = False) -> Image
  • device_index: Camera index (0 is usually the default webcam)
  • flip: Whether to horizontally flip the image
  • Returns: The captured frame as an Image object

open_camera

Open a connection to a camera device.

open_camera(device_index: int = 0, name: Optional[str] = None) -> str
  • device_index: Camera index (0 is usually the default webcam)
  • name: Optional name to identify this camera connection
  • Returns: Connection ID for the opened camera

capture_frame

Capture a single frame from the specified video source.

capture_frame(connection_id: str, flip: bool = False) -> Image
  • connection_id: ID of the previously opened video connection
  • flip: Whether to horizontally flip the image
  • Returns: The captured frame as an Image object

get_video_properties

Get properties of the video source.

get_video_properties(connection_id: str) -> dict
  • connection_id: ID of the previously opened video connection
  • Returns: Dictionary of video properties (width, height, fps, etc.)

set_video_property

Set a property of the video source.

set_video_property(connection_id: str, property_name: str, value: float) -> bool
  • connection_id: ID of the previously opened video connection
  • property_name: Name of the property to set (width, height, brightness, etc.)
  • value: Value to set
  • Returns: True if successful, False otherwise

close_connection

Close a video connection and release resources.

close_connection(connection_id: str) -> bool
  • connection_id: ID of the connection to close
  • Returns: True if successful

list_active_connections

List all active video connections.

list_active_connections() -> list
  • Returns: List of active connection IDs

Example Usage

Here's how an AI assistant might use the Webcam MCP server:

  1. Take a quick photo:

    I'll take a photo using your webcam.
    

    (The AI would call quick_capture() behind the scenes)

  2. Open a persistent connection:

    I'll open a connection to your webcam so we can take multiple photos.
    

    (The AI would call open_camera() and store the connection ID)

  3. Adjust camera settings:

    Let me increase the brightness of the webcam feed.
    

    (The AI would call set_video_property() with the appropriate parameters)

Advanced Usage

Resource Management

The server automatically manages camera resources, ensuring all connections are properly released when the server shuts down. For long-running applications, it's good practice to explicitly close connections when they're no longer needed.

Multiple Cameras

If your system has multiple cameras, you can specify the device index when opening a connection:

# Open the second webcam (index 1)
connection_id = open_camera(device_index=1)

Troubleshooting

  • Camera Not Found: Ensure your webcam is properly connected and not in use by another application
  • Permission Issues: Some systems require explicit permission to access the camera
  • OpenCV Installation: If you encounter issues with OpenCV, refer to the official installation guide

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Metadata

Release files for iflow-mcp_videocapture-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iflow-mcp_videocapture-mcp 0.1.0
File Size Uploaded
iflow_mcp_videocapture_mcp-0.1.0.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iflow-mcp_videocapture-mcp 0.1.0
File Interpreter ABI Platform
iflow_mcp_videocapture_mcp-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.8 kB

Release files / iflow_mcp_videocapture_mcp-0.1.0.tar.gz

Download URL iflow_mcp_videocapture_mcp-0.1.0.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
cae5af24091155d34c20bc35782f59512e9e17426e8437a5367829f8470c7f25
BLAKE2b-256 checksum
How to use checksums
f92412e23eb7ca82af53e1688c56720910e5b6f72ccaddbbaf6b2f12655fa901
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / iflow_mcp_videocapture_mcp-0.1.0-py3-none-any.whl

Download URL iflow_mcp_videocapture_mcp-0.1.0-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9cd46749e08b1fa8229ab34b145956ea8be51bf6cb3e464a23001bd8d404e42
BLAKE2b-256 checksum
How to use checksums
45b8933839dcbcd09d0515446c7f6ace82530465313d5b4b103a5ca1d585f929
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page