
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 分