npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

camera-mcp

v2.0.0

Published

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

Readme

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