Get the FREE Ultimate OpenClaw Setup Guide →

webcam_mcp

An MCP server to give LLM agents access to a camera for taking photos

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio pavel-kirienko-webcam_mcp python -m webcam_mcp

How to use

Webcam MCP provides an MCP server that lets autonomous agents access your webcam to capture photos and record video sequences via the MCP protocol using SSE transport. It exposes two primary tools to clients: take_photo, which returns a high-resolution JPEG image from the configured webcam, and record_video, which captures a sequence of JPEG frames over a specified duration. Clients can connect through any MCP-compatible interface (e.g., MCP Inspector) using the SSE endpoint at http://<host>:<port>/sse. This setup is particularly useful for debugging cyberphysical systems, monitoring environments, and enabling agents to interact with the physical world without human intervention.

To use the server, install the Python package and start the server. By default, the server runs on 0.0.0.0:8000 and exposes the /sse feed. You can query the take_photo capability to retrieve a single image and the record_video capability to obtain a sequence of frames over a configurable duration. The server supports configuring camera index and image dimensions to suit different webcams and environments, making it adaptable for laptops with built-in cameras or external USB webcams.

How to install

Prerequisites:

  • Python 3.8+ installed on your system
  • Access to pip for Python package installation

Installation steps:

  1. Create and activate a virtual environment (optional but recommended):
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate
  1. Install the webcam-mcp package from PyPI:
pip install webcam-mcp
  1. Run the MCP server:
# Method 1: Direct command
webcam-mcp

# Method 2: Explicit module invocation
python -m webcam_mcp

The server will start serving at http://0.0.0.0:8000/sse by default.

Additional notes

Environment and configuration tips:

  • You can override host/port with standard CLI options when launching the server (e.g., --host, --port).
  • If you have multiple webcams, use --camera-index to select the desired device (0 is typically the built-in camera).
  • The server supports adjusting photo and video dimensions via --photo-width, --photo-height, --video-width, and --video-height.
  • If the camera is busy or unavailable, the server will log an error and continue attempting other requests; ensure no other process is using the camera.
  • For production deployments, consider exposing the SSE endpoint behind appropriate authentication or a reverse proxy.
  • Tests in this project use mocked camera hardware, so local development does not require a physical webcam.

Related MCP Servers

Sponsor this space

Reach thousands of developers