Projects

cammcp: Giving an AI Assistant a Camera, Not a Video Stream

Rust
MCP
Cameras

A Rust MCP server that turns connected cameras into two focused tools, with practical decisions around device discovery, capture formats, and exposure.

A camera on a tripod overlooking a riverside village.

A model that accepts images still needs a way to obtain them. Asking someone to capture a photo and upload it works, but it leaves a manual step between the assistant and the scene it needs to inspect.

cammcp makes that step available as a tool. It is a Rust MCP server that discovers cameras connected to the machine and returns captured photos as PNG images. The interface is intentionally small: list the cameras, then take a photo from one of them.

Two tools are enough to define the workflow

list_cameras provides the device information an assistant needs before making a capture request: a short identifier, a name, device type and position, and supported resolutions.

The identifiers are derived from the operating system’s device IDs rather than being only a camera’s position in a list. That gives a client a more useful reference than “the first camera,” while still depending on how the operating system identifies the device.

take_photo then accepts the camera ID and optional capture settings. It can return a single image or a burst of up to ten photos, with a configurable delay between them. This is a still-image workflow, not an open-ended video stream.

That boundary makes the interaction easier to reason about: a request produces a bounded set of images, and the assistant can decide what to do with those results before requesting more.

Camera capture is not a single format

Different devices expose different resolutions and pixel formats. Rather than requiring the model to understand those details, the server selects the closest supported resolution, prefers MJPEG before NV12 and YUYV, and chooses the highest available frame rate for the selected mode.

By default, a request targets 1280×720, but the server’s defaults and individual request dimensions can be changed. The image returned to the client is PNG, giving the assistant a consistent result even when the underlying camera supplies a different format.

The capture options also include warmup frames and a per-frame timeout. Discarding a few initial frames gives auto-exposure time to settle; a timeout prevents a stalled camera from leaving the operation waiting indefinitely. Neither eliminates hardware-specific behavior, but both acknowledge it explicitly in the interface.

Local hardware becomes a permission boundary

The server supports stdio for clients that launch it as a local process, plus Streamable HTTP at /mcp. The Rust implementation uses the cameras crate for the Windows, macOS, and Linux camera layer, with rmcp, Tokio, and Axum in the server stack.

HTTP mode has no authentication. That is not an incidental deployment detail: anyone who can reach the listening address can use the cameras exposed by the server. The README recommends binding to 127.0.0.1, and exposing it elsewhere requires an appropriate access-control design.

Even a local deployment needs a deliberate choice about which assistant receives images. The capture happens on the machine, but an image passed to a cloud model can leave that machine. People in view and sensitive surroundings deserve the same consideration as any other camera use.

A narrow bridge between perception and action

cammcp keeps the camera-specific work in one place: device discovery, mode selection, capture, and image encoding. The assistant receives a small tool surface rather than needing a bespoke integration with each webcam.

That is the part of MCP I find useful here. It provides a common interface without pretending that the hardware, permissions, or privacy questions have become generic.

Explore cammcp on GitHub. The README documents installation, capture parameters, and the transport configuration.