Raspberry Pi camera MCP server
Allows capturing images from a Raspberry Pi CSI camera, returning JPEG image data via the capture_image tool.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Raspberry Pi camera MCP serverTake a photo of the room and describe what you see."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Raspberry Pi camera MCP server
Note:
This program is entirely AI-generated and has not been thoroughly tested.
It is intended for experimental use within a LAN. As it does not use HTTPS, there is no security whatsoever; do not use it over the internet.
The camera images are intended to be processed by an LLM. Please be aware of privacy implications, as images will be sent to the AI provider if you use external LLM APIs.
注意:
フルAI生成のプログラムです。あまりきちんと検証していません。
LAN内での実験用利用を想定しています。httpですので暗号化はなく、セキュリティは皆無です。インターネット上で使用してはいけません。
カメラ画像はLLMに読まれることを想定しています。外部LLM APIなどを利用する場合、画像はAI提供元に送信されますのでプライバシーにご注意ください。
Raspberry Pi の CSI カメラから JPEG を1枚撮り、MCP の capture_image ツールで画像として返す小さな TypeScript サーバーです。Streamable HTTP のエンドポイントは /mcp で、共有トークンを使います。
準備
Raspberry Pi OS で
rpicam-stillが使えることを確認してください。先にrpicam-hello --list-camerasとrpicam-still -n -t 1000 -o test.jpgを実行すると切り分けが簡単です。Node.js 22 以上と pnpm を用意します。( https://nodesource.com/products/distributions などで Ubuntu の node 22以降を設定してください。)
pnpm install --frozen-lockfile
pnpm buildRelated MCP server: OpticMCP
起動
MCP_HOST は Pi の LAN 側 IPv4 アドレスに設定してください。起動時にそのアドレスへバインドし、異なる Host ヘッダーを拒否します。IP が変わったら設定も更新します。MCP_TOKEN は必須です。
export MCP_HOST=192.168.1.50
export MCP_PORT=3000
export MCP_TOKEN="$(openssl rand -hex 32)"
pnpm start接続先は http://192.168.1.50:3000/mcp、認証ヘッダーは Authorization: Bearer <MCP_TOKEN> です。クライアントの設定に URL と固定の Bearer トークンを指定してください。MCP_HOST を省略すると 127.0.0.1 にのみバインドします。MCP_PORT の既定値は 3000 です。
wlan0 の IP で起動
Pi 上で MCP_TOKEN を設定した後、次のワンライナーで現在の wlan0 の IPv4 アドレスへバインドできます。
MCP_HOST="$(ip -4 -o address show dev wlan0 scope global | awk 'NR == 1 { split($4, a, "/"); print a[1] }')" node dist/server.js同じ処理を行う 起動スクリプト も用意しています。こちらは IP が未設定ならエラーで終了するため、systemd からの起動に使えます。
MCP_TOKEN="YOUR_SAVED_TOKEN" bash scripts/start-wlan0.shsystemd で自動起動
サービス定義の例 を Pi 上でコピーし、YOUR_USER とプロジェクトの配置先を実際の値に変更します。Node.js を /usr/bin/node 以外に入れた場合は、環境ファイルに NODE_BIN=/実際の/node/へのパス を追加します。
sudo install -m 644 deploy/raspi-cam-mcp.service.example /etc/systemd/system/raspi-cam-mcp.service
sudoedit /etc/systemd/system/raspi-cam-mcp.serviceトークンはサービス定義に直接書かず、Pi 上の環境ファイルへ保存します。次のコマンドはトークンを新規生成して表示します。既にクライアントに設定したトークンがある場合は、その値をファイルに設定してください。
sudo install -m 600 -o root -g root /dev/null /etc/raspi-cam-mcp.env
TOKEN="$(openssl rand -hex 32)"
printf 'MCP_TOKEN=%s\nMCP_PORT=3000\n' "$TOKEN" | sudo tee /etc/raspi-cam-mcp.env >/dev/null
printf 'クライアントに設定するトークン: %s\n' "$TOKEN"
sudo systemctl daemon-reload
sudo systemctl enable --now raspi-cam-mcp.service
sudo systemctl status raspi-cam-mcp.service接続先の確認は ip -4 -o address show dev wlan0 scope global、ログの確認は journalctl -u raspi-cam-mcp.service -f です。Wi-Fi がまだ接続されていない場合はサービスが5秒後に再試行します。実行中に DHCP で IP が変わった場合は sudo systemctl restart raspi-cam-mcp.service を実行してください。
接続確認の例です。Pi または同じ LAN の端末から実行できます。
curl -i http://192.168.1.50:3000/mcp \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
--data '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"curl-test","version":"1.0.0"}}}'初期化応答にサーバー名が表示されれば接続できています。実際の画像確認には MCP クライアントから capture_image を呼んでください。
撮影時は rpicam-still --nopreview --timeout 1000 --width 1280 --height 720 --quality 85 --output - を実行します。画像は保存せず、JPEG の Base64 を MCP ImageContent で返します。撮影が重なった場合は後から来た呼び出しにエラーを返します。RPICAM_STILL でコマンドのパスを変更できます。
LAN で使う際の注意
HTTP ではトークンと画像が暗号化されません。信頼できる LAN 内だけで使用し、ルーターでインターネットへポート公開しないでください。トークンは環境変数などに保存し、Git に入れないでください。ブラウザーからの Origin 付きリクエストは拒否します。
This server cannot be deployed
Maintenance
Related MCP Connectors
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Generate AI images and videos from any compatible MCP client.
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
Focused MCP server for OpenAI image/audio generation (v2.0.0). Wraps endpoints via HAPI CLI.
Related MCP Servers
- AlicenseBqualityCmaintenanceEnables users to send live webcam images to Claude Desktop or other MCP clients, facilitating interaction through capturing images, screenshots, and providing a webcam view for visual input.240 npm121MIT
- AlicenseNot gradedqualityCmaintenanceProvides camera and vision tools for AI assistants to list available cameras, capture images from USB cameras, and save frames to disk for use with LLMs.4MIT
- AlicenseNot gradedqualityCmaintenanceAn 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.3MIT
- AlicenseNot gradedqualityDmaintenanceAn 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.1MIT