Camera-MCP-Server

jkoets/Camera-MCP-Server

3.2

If you are the rightful owner of Camera-MCP-Server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The Camera MCP Server provides webcam access to AI assistants, enabling them to see and monitor the physical world through a computer's camera.

Tools
6
Resources
0
Prompts
0

Camera MCP Server

An MCP (Model Context Protocol) server that provides webcam access to AI assistants like Claude. This allows AI to see and monitor the physical world through your computer's camera.

Features

  • List Available Cameras: Detect all connected webcams
  • Capture Images: Take single snapshots from any camera
  • Capture Sequences: Take multiple images over time for monitoring or time-lapse
  • Camera Control: Adjust brightness, contrast, exposure, and other settings
  • High Quality: Configurable resolution and image quality
  • Multiple Cameras: Support for multiple simultaneous cameras

Use Cases

  • Robotics: Monitor robot position and drawing output (e.g., iRobot Root)
  • Science Experiments: Observe chemical reactions, plant growth, or physics demonstrations
  • Hardware Projects: Check circuit boards, 3D prints, or CNC operations
  • Quality Control: Verify physical outputs match expected results
  • Data Collection: Gather visual data for analysis or training

Installation

Prerequisites

  • Python 3.10 or higher
  • A webcam connected to your computer
  • Claude Desktop app (or another MCP client)

Install the Server

  1. Navigate to the project directory:
cd "E:\SolSync\Projects\code stuff\camera_mcp"
  1. Install in development mode:
pip install -e .

This will install the required dependencies:

  • mcp - Model Context Protocol SDK
  • opencv-python - Camera access and image processing
  • numpy - Array operations
  • pillow - Image encoding

Configure Claude Desktop

Add this to your Claude Desktop configuration file:

Windows: %APPDATA%\Claude\claude_desktop_config.json macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "camera": {
      "command": "python",
      "args": [
        "-m",
        "camera_mcp.server"
      ]
    }
  }
}

Restart Claude Desktop after updating the configuration.

Available Tools

list_cameras

List all available camera devices on your system.

No parameters required

Returns information about each camera including ID, resolution, and frame rate.

capture_image

Capture a single image from the webcam.

Parameters:

  • camera_id (integer, default: 0): Camera index (0 for default camera)
  • width (integer, optional): Image width in pixels
  • height (integer, optional): Image height in pixels
  • format (string, default: "jpeg"): Image format ("jpeg" or "png")
  • quality (integer, default: 95): JPEG quality (1-100)
  • warmup_frames (integer, default: 5): Frames to skip before capture (helps with auto-exposure)

Example:

Can you capture an image from my webcam to see if the robot is still on the table?

capture_sequence

Capture multiple images over time.

Parameters:

  • camera_id (integer, default: 0): Camera index
  • num_frames (integer, default: 5): Number of frames to capture (max 30)
  • interval (number, default: 1.0): Interval between captures in seconds
  • width (integer, optional): Image width
  • height (integer, optional): Image height
  • format (string, default: "jpeg"): Image format
  • quality (integer, default: 85): JPEG quality

Example:

Capture 10 frames over 30 seconds so I can see how the chemical reaction progresses.

get_camera_info

Get information about a camera's current settings and capabilities.

Parameters:

  • camera_id (integer, default: 0): Camera index

Returns resolution, FPS, brightness, contrast, saturation, and exposure settings.

set_camera_property

Adjust camera settings for better image quality.

Parameters:

  • camera_id (integer, default: 0): Camera index
  • property_name (string): Property to adjust:
    • brightness: Brightness level
    • contrast: Contrast level
    • saturation: Color saturation
    • hue: Color hue
    • exposure: Exposure time
    • gain: Signal amplification
    • focus: Focus distance
    • auto_exposure: Enable/disable auto exposure
    • auto_focus: Enable/disable auto focus
  • value (number): Property value (range depends on property)

Example:

The image is too dark - can you increase the brightness to 0.7?

release_camera

Release/close a camera to free up resources.

Parameters:

  • camera_id (integer, default: 0): Camera index

Useful if you need to switch cameras or if another application needs camera access.

Usage Examples

Basic Image Capture

"Can you take a picture from my webcam so I can see what's on my desk?"

Claude will capture an image and display it in the conversation.

Monitoring a Robot

"I'm running my Root robot to draw a square. Can you capture an image 
every 10 seconds for the next minute to make sure it's working correctly?"

Claude will capture 6 images and show you the robot's progress.

Adjusting Camera Settings

"The images are coming out too dark. Can you check the camera settings 
and increase the exposure?"

Claude will check current settings and adjust as needed.

Quality Control

"I'm 3D printing a part. Can you take a high-resolution photo so I can 
check if the layers are printing correctly?"

Claude will capture a high-quality image for detailed inspection.

Technical Details

Image Encoding

Images are captured as OpenCV frames (BGR format), converted to RGB, and encoded as JPEG or PNG. They're then base64-encoded and returned in the MCP response so Claude can see them directly in the conversation.

Camera Management

The server maintains persistent camera connections to avoid reopening overhead. Cameras are automatically released when switching between cameras or when the server exits.

Performance

  • Warmup Frames: By default, 5 frames are skipped before capture to allow camera auto-exposure and white balance to stabilize
  • Quality vs Size: JPEG format with quality 85-95 provides good compression while maintaining visual quality
  • Resolution: Most webcams support 640x480 (VGA), 1280x720 (HD), or 1920x1080 (Full HD)

Troubleshooting

No Cameras Found

  • Check that your webcam is physically connected
  • Make sure no other applications are using the camera
  • Try unplugging and reconnecting the webcam
  • Check Windows Device Manager to verify the camera is recognized

Failed to Capture Image

  • Another application may be using the camera
  • Try calling release_camera first, then capture again
  • Check that the camera index is correct (use list_cameras)

Images Are Low Quality

  • Increase the quality parameter (up to 100)
  • Use PNG format for lossless compression
  • Specify a higher resolution with width and height
  • Adjust camera properties with set_camera_property

Images Are Too Dark/Bright

  • Use set_camera_property to adjust brightness and exposure
  • Increase warmup_frames to give auto-exposure more time
  • Check room lighting conditions

Development

Project Structure

camera_mcp/
├── camera_mcp/
│   ├── __init__.py
│   └── server.py       # Main MCP server implementation
├── pyproject.toml      # Package configuration
└── README.md           # This file

Dependencies

  • opencv-python: Camera access and image processing
  • numpy: Array operations for image data
  • pillow: Image encoding (JPEG/PNG)
  • mcp: Model Context Protocol SDK

Testing

You can test the camera server directly:

python -m camera_mcp.server

Or use the MCP inspector:

mcp inspect python -m camera_mcp.server

Future Enhancements

Potential additions:

  • Video recording with audio
  • Face/object detection
  • Motion detection alerts
  • Image comparison/diff
  • Optical character recognition (OCR)
  • QR code / barcode scanning
  • Color analysis and histograms
  • Integration with computer vision models

License

This is a personal project created for educational and research purposes.

Author

Josh Koets- Primary AI Development Guy at National Heritage Academies

Built to enable AI assistants to observe and interact with the physical world through webcams, supporting robotics projects, science experiments, and hands-on learning activities.