MCP Servers

模型上下文协议服务器、框架、SDK 和模板的综合目录。

Node.js MCP 服务,提供拍照和录像功能

创建于 2/26/2026
更新于 about 7 hours ago
Repository documentation and setup instructions

NodeCameraMCP

Node.js MCP (Model Context Protocol) 服务,提供拍照和录像功能。

npm version npm downloads license

功能特性

  • 📷 拍照功能 - 使用摄像头拍摄照片并保存为 JPG 格式
  • 🎥 录像功能 - 录制视频并保存为 MP4 格式

系统要求

  • Node.js >= 18.0.0
  • macOS 系统
  • 摄像头设备

依赖安装

安装系统依赖

推荐使用 Homebrew 安装以下工具:

# 安装 imagesnap(用于快速拍照)
brew install imagesnap

# 安装 ffmpeg(用于拍照和录像)
brew install ffmpeg

注意: 至少需要安装其中一个工具才能使用拍照功能。录像功能需要 ffmpeg。

使用方法

{
  "mcpServers": {
    "Camera": {
      "command": "npx",
      "args": [
        "-y",
        "camera-mcp"
      ]
    }
  }
}

可用工具

1. take_photo - 拍照

{
  "name": "take_photo",
  "arguments": {
    "outputDir": "./output",
    "filename": "my-photo.jpg",
    "cameraIndex": 0,
    "width": 1920,
    "height": 1080
  }
}

参数说明:

  • outputDir: 输出目录路径(可选,默认 ./output)
  • filename: 输出文件名(可选,默认使用时间戳)
  • cameraIndex: 摄像头索引(可选,默认 0)
  • width: 图片宽度(可选,默认 1920)
  • height: 图片高度(可选,默认 1080)

返回示例:

{
  "success": true,
  "path": "/path/to/output/2024-01-01T12-00-00.jpg",
  "filename": "2024-01-01T12-00-00.jpg",
  "message": "拍照成功",
  "method": "imagesnap"
}

2. record_video - 录像

{
  "name": "record_video",
  "arguments": {
    "outputDir": "./output",
    "filename": "my-video.mp4",
    "cameraIndex": 0,
    "duration": 10,
    "fps": 30,
    "quality": "medium"
  }
}

参数说明:

  • outputDir: 输出目录路径(可选,默认 ./output)
  • filename: 输出文件名(可选,默认使用时间戳)
  • cameraIndex: 摄像头索引(可选,默认 0)
  • duration: 录制时长(秒),0 表示需要外部控制停止
  • fps: 帧率(可选,默认 30)
  • quality: 视频质量预设(ultrafast/fast/medium/slow,默认 medium)

返回示例:

{
  "success": true,
  "path": "/path/to/output/2024-01-01T12-00-00.mp4",
  "filename": "2024-01-01T12-00-00.mp4",
  "message": "录制 10 秒视频成功",
  "duration": 10,
  "method": "ffmpeg"
}

权限说明

在 macOS 上首次使用摄像头时,系统会弹出权限请求对话框。请确保:

  1. 允许终端/Node.js 访问摄像头
  2. 在「系统设置」>「隐私与安全性」>「相机」中检查权限

故障排除

问题:找不到摄像头

解决方案:

  1. 运行 list_cameras 工具检查可用摄像头
  2. 确保已授予摄像头权限
  3. 检查是否有其他应用正在使用摄像头

问题:拍照/录像失败

解决方案:

  1. 运行 check_dependencies 检查依赖是否已安装
  2. 确保 imagesnap 或 ffmpeg 已正确安装
  3. 检查输出目录是否有写入权限

问题:录像文件损坏

解决方案:

  1. 确保录制时长足够长(至少 1 秒)
  2. 尝试降低视频质量预设
  3. 检查磁盘空间是否充足

许可证

MIT License

快速设置
此服务器的安装指南

安装包 (如果需要)

npx @modelcontextprotocol/server-nodecameramcp

Cursor 配置 (mcp.json)

{ "mcpServers": { "hammcn-nodecameramcp": { "command": "npx", "args": [ "hammcn-nodecameramcp" ] } } }