Skip to main content
Glama

camera-mcp

通过 ffmpeg / DirectShow,把本机摄像头能力暴露给 Claude 的 MCP server。

让 Claude 可以直接:列出摄像头 → 拍照 → 录像 → 停止录像,全程本地处理,文件落到磁盘。


功能

工具

说明

list_cameras

列出本机所有 DirectShow 视频设备

take_photo

用指定摄像头拍一张 JPEG

start_recording

后台开始录像(libx264 / mp4),返回 recording_id

stop_recording

优雅停止录像(写 q → ffmpeg 自动收尾,写入 moov 索引)

list_recordings

列出当前所有进行中的录像


Related MCP server: Webcam MCP

环境要求

  • Windows(用了 DirectShow,Linux/macOS 需要换 avfoundation / v4l2

  • Node.js ≥ 18

  • ffmpeg(在 PATH 里,或自行改成绝对路径)

# Windows 用 winget 装 ffmpeg
winget install ffmpeg

安装 & 构建

cd camera
npm install
npm run build

构建产物在 dist/index.js,可执行项 camera-mcp


配置到 Claude Code

~/.claude/mcp.json(或项目级 .mcp.json)里加:

{
  "mcpServers": {
    "camera": {
      "command": "node",
      "args": ["C:/Users/hj158/mcp-servers/camera/dist/index.js"]
    }
  }
}

启动后用 claude mcp list 应该能看到 camera: ... √ Connected


使用示例

帮我拍一张照片

Claude 会调:

take_photo(device="HD Webcam", path="./photos/test.jpg", quality=2)

用 ToDesk Camera 录一段 30 秒视频

start_recording(device="ToDesk Camera", path="./videos/demo.mp4")
# → recording_id: rec_xxxxxxxx_1
# ... 30 秒后 ...
stop_recording(recording_id="rec_xxxxxxxx_1")

工具参数

take_photo

参数

类型

必填

说明

device

string

设备名(必须来自 list_cameras

path

string

保存路径,默认 ./photos/photo-{timestamp}.jpg

quality

number

JPEG 质量 1-31,数字越小质量越高,默认 2

start_recording

参数

类型

必填

说明

device

string

设备名

path

string

默认 ./videos/video-{timestamp}.mp4

resolution

string

默认 1280x720

fps

number

1-60,默认 30

stop_recording

参数

类型

必填

说明

recording_id

string

start_recording 返回的 ID


工作原理

  • 设备枚举:调 ffmpeg -list_devices true -f dshow -i dummy,正则匹配 "..." (video)

  • 拍照:spawn ffmpeg,-frames:v 1 -q:v <quality> 截单帧

  • 录像:spawn ffmpeg 保持长连接,用 Map<recording_id, ChildProcess> 跟踪;停止时往 stdin 写 q,让 ffmpeg 走正常退出流程(否则 mp4 moov 索引缺失,很多播放器打不开)


已知限制

  • Windows-only(DirectShow);跨平台需要按平台分支选择 input format

  • 多进程隔离:每次拍照/录像都新 spawn 一个 ffmpeg,启动开销约 300-500ms

  • 录像启动 500ms 后才检查 exit code,极端情况下启动失败可能要等一下才能发现


License

MIT

A
license - permissive license
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    -
    quality
    C
    maintenance
    An MCP server that provides LLM agents with direct access to webcam hardware for capturing high-resolution photos and recording video sequences. It enables autonomous agents to monitor environments and interact with the physical world through standard Model Context Protocol tools.
    3
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    An MCP server that enables interaction with local camera devices to capture and process images. It allows LLMs to access video devices with configurable settings such as resolution, orientation, and image format.
    1
    MIT

View all related MCP servers

Related MCP Connectors

  • MCP server for Clipkit — gives AI agents a video toolbox via the Clipkit schema.

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

  • Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/NingZiXi/camera-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server