camera-mcp
MCP server that exposes local webcam capabilities to Claude via ffmpeg/DirectShow, enabling listing cameras, taking photos, and recording/stopping videos on Windows.
README
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 |
列出当前所有进行中的录像 |
环境要求
- 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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.