
Mcp Sanity Images
io.github.pijusz由 GitHub 帳號 pijusz 發布v0.3.7更新於 Nov 3, 2026
MCP server for uploading local images to Sanity CMS
概覽
本機 MCP 伺服器,讓助理把本機圖片上傳到 Sanity CMS 成為資源,並掛到文件欄位上。
- 可以做什麼
- 上傳單張本機圖片到 Sanity,取回資源參照
- 一次呼叫完成上傳並把圖片寫入文件欄位
- 批次上傳某個資料夾中的所有圖片,並另外列出失敗項目
- 列出目錄中的圖片檔案而不上傳
- 執行唯讀 GROQ 查詢,在掛圖前找出文件 ID
- 適用情境
- 適合圖片存放在本機、希望由助理推送到 Sanity 資料集並寫入內容欄位的情境,例如不開 Sanity Studio 就為產品或文章補圖。
- 執行需求
- 透過 npx、bunx 或預先編譯的執行檔(macOS、Linux、Windows)以 stdio 在本機執行。需要 SANITY_PROJECT_ID,SANITY_DATASET 預設為 production。API 權杖從 SANITY_TOKEN 或 Sanity CLI 登入設定讀取。需要連線到 Sanity 的網路。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Mcp Sanity Images,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
MCP server for uploading local images to Sanity CMS.
Lets AI assistants upload files from your filesystem directly into Sanity as image assets.
Quick Start
1. Get your Sanity token
Either set the SANITY_TOKEN env var, or just log in with the Sanity CLI:
The server reads the token from the Sanity CLI config automatically (~/.config/sanity/config.json on all platforms).
2. Add to Claude Code
That's it. Restart Claude Code and the tools are available. Every session runs the latest version automatically.
Also works with
bunx mcp-sanity-images@latestif you have Bun.
Alternative: standalone binary
Download a pre-built binary from Releases:
macOS / Linux:
Windows (PowerShell):
Claude Desktop
Add to your claude_desktop_config.json:
Using npx (auto-updates)
Using binary (macOS / Linux)
Using binary (Windows)
Tools
Supported formats: PNG, JPG/JPEG, WebP, GIF, SVG.
Configuration
All tools also accept projectId and dataset as parameters, overriding the env vars per-call.
Tool Details
upload_image
Upload a single file and get back the asset reference.
Returns { assetId, url, alt, reference } — the reference is ready to patch onto any Sanity image field.
upload_and_set
Upload + patch in one call.
Before uploading, the tool checks which of <id> and drafts.<id> exist, so a wrong ID uploads nothing:
The response's documentId is the document actually patched. Mutations are sent with returnIds=true&visibility=sync, so a follow-up groq_query sees the change.
batch_upload
Upload all images from a directory.
Returns { uploaded, assets }. If some files fail, the rest still upload and the failures are listed in failed (with failedCount).
list_images
List image files without uploading — useful for the AI to see what's available.
groq_query
Run any GROQ query (read-only). Long queries are sent via POST automatically. Useful to find document IDs before using upload_and_set.
The server pins Sanity API version v2025-02-19. That version made published the API's default perspective. This tool sends raw unless you ask otherwise, so results match what earlier releases (API v2021-10-21, default raw) returned.
Updates
Using npx @latest (recommended): You always get the latest version — no manual updates needed.
Using a binary: The server checks for new releases on startup and logs to stderr if outdated:
Check your installed version:
To update, download the new binary and replace the old one.
Development
Requires Bun.
License
MIT
來源:README.md,提交 835c357
工具
0版本歷史
1- v0.3.7最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分