{
  "markdown": "<p align=\"center\">\n  <img src=\"logo.svg\" alt=\"MCPi sanity-images\" width=\"280\" />\n</p>\n\n<p align=\"center\">\n  MCP server for uploading local images to <a href=\"https://www.sanity.io/\">Sanity CMS</a>.\n  <br/>\n  Lets AI assistants upload files from your filesystem directly into Sanity as image assets.\n</p>\n\n---\n\n## Quick Start\n\n### 1. Get your Sanity token\n\nEither set the `SANITY_TOKEN` env var, or just log in with the Sanity CLI:\n\n```bash\nnpx sanity login\n```\n\nThe server reads the token from the Sanity CLI config automatically (`~/.config/sanity/config.json` on all platforms).\n\n### 2. Add to Claude Code\n\n```bash\nclaude mcp add sanity-images --scope user --transport stdio \\\n  -e SANITY_PROJECT_ID=your-project-id \\\n  -- npx -y mcp-sanity-images@latest\n```\n\nThat's it. Restart Claude Code and the tools are available. Every session runs the latest version automatically.\n\n> Also works with `bunx mcp-sanity-images@latest` if you have [Bun](https://bun.sh/).\n\n<details>\n<summary>Alternative: standalone binary</summary>\n\nDownload a pre-built binary from [Releases](https://github.com/pijusz/mcp-sanity-images/releases):\n\n| Platform | File |\n|----------|------|\n| macOS (Apple Silicon) | `mcp-sanity-images-darwin-arm64` |\n| macOS (Intel) | `mcp-sanity-images-darwin-x64` |\n| Linux | `mcp-sanity-images-linux-x64` |\n| Windows | `mcp-sanity-images-windows-x64.exe` |\n\n**macOS / Linux:**\n\n```bash\ncurl -Lo mcp-sanity-images https://github.com/pijusz/mcp-sanity-images/releases/latest/download/mcp-sanity-images-darwin-arm64\nchmod +x mcp-sanity-images\nsudo mv mcp-sanity-images /usr/local/bin/\nclaude mcp add sanity-images --scope user --transport stdio \\\n  -e SANITY_PROJECT_ID=your-project-id \\\n  -- /usr/local/bin/mcp-sanity-images\n```\n\n**Windows (PowerShell):**\n\n```powershell\nInvoke-WebRequest -Uri \"https://github.com/pijusz/mcp-sanity-images/releases/latest/download/mcp-sanity-images-windows-x64.exe\" -OutFile \"$env:LOCALAPPDATA\\mcp-sanity-images.exe\"\nclaude mcp add sanity-images --scope user --transport stdio -e SANITY_PROJECT_ID=your-project-id -- \"%LOCALAPPDATA%\\mcp-sanity-images.exe\"\n```\n\n</details>\n\n### Claude Desktop\n\nAdd to your `claude_desktop_config.json`:\n\n<details>\n<summary>Using npx (auto-updates)</summary>\n\n```json\n{\n  \"mcpServers\": {\n    \"sanity-images\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mcp-sanity-images@latest\"],\n      \"env\": {\n        \"SANITY_PROJECT_ID\": \"your-project-id\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary>Using binary (macOS / Linux)</summary>\n\n```json\n{\n  \"mcpServers\": {\n    \"sanity-images\": {\n      \"command\": \"/usr/local/bin/mcp-sanity-images\",\n      \"env\": {\n        \"SANITY_PROJECT_ID\": \"your-project-id\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary>Using binary (Windows)</summary>\n\n```json\n{\n  \"mcpServers\": {\n    \"sanity-images\": {\n      \"command\": \"%LOCALAPPDATA%\\\\mcp-sanity-images.exe\",\n      \"env\": {\n        \"SANITY_PROJECT_ID\": \"your-project-id\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n## Tools\n\n| Tool | Description |\n|------|-------------|\n| `upload_image` | Upload a single local image to Sanity as an asset |\n| `upload_and_set` | Upload an image and patch it onto a document field |\n| `batch_upload` | Upload all images from a folder as assets |\n| `list_images` | List image files in a directory |\n| `groq_query` | Run a GROQ query (find documents before attaching) |\n\nSupported formats: PNG, JPG/JPEG, WebP, GIF, SVG.\n\n## Configuration\n\n| Env var | Required | Default | Description |\n|---------|----------|---------|-------------|\n| `SANITY_PROJECT_ID` | Yes | — | Your Sanity project ID |\n| `SANITY_DATASET` | No | `production` | Dataset name |\n| `SANITY_TOKEN` | No* | — | API token (*falls back to CLI auth) |\n\nAll tools also accept `projectId` and `dataset` as parameters, overriding the env vars per-call.\n\n## Tool Details\n\n### upload_image\n\nUpload a single file and get back the asset reference.\n\n```\nfilePath: \"/path/to/hero.png\"\nalt: \"Hero banner\"  (optional — derived from filename)\n```\n\nReturns `{ assetId, url, alt, reference }` — the `reference` is ready to patch onto any Sanity image field.\n\n### upload_and_set\n\nUpload + patch in one call.\n\n```\nfilePath: \"/path/to/hero.png\"\ndocumentId: \"product-123\"\nfieldPath: \"hero.image\"\n```\n\n### batch_upload\n\nUpload all images from a directory.\n\n```\ndirectory: \"/path/to/images\"\nrecursive: true\n```\n\n### list_images\n\nList image files without uploading — useful for the AI to see what's available.\n\n```\ndirectory: \"/path/to/images\"\nrecursive: true\n```\n\n### groq_query\n\nRun any GROQ query. Useful to find document IDs before using `upload_and_set`.\n\n```\nquery: \"*[_type == 'product']{_id, title, slug}\"\n```\n\n## Updates\n\n**Using `npx @latest`** (recommended): You always get the latest version — no manual updates needed.\n\n**Using a binary**: The server checks for new releases on startup and logs to stderr if outdated:\n\n```\n[update] v0.2.0 available (current: v0.1.0). Download: https://github.com/pijusz/mcp-sanity-images/releases/latest\n```\n\nCheck your installed version:\n\n```bash\nmcp-sanity-images --version\n```\n\nTo update, download the new binary and replace the old one.\n\n## Development\n\nRequires [Bun](https://bun.sh/).\n\n```bash\ngit clone https://github.com/pijusz/mcp-sanity-images.git\ncd mcp-sanity-images\nbun install\nbun test          # 37 tests\nbun run lint      # biome check\nbun run build     # compile standalone binary\n```\n\n## License\n\nMIT\n",
  "bytes": 5405,
  "sha": "b392da1d63f402bc7df60309f4b4bb9a534e1d3a5242dae39c74f2cd511e42e0",
  "repo_slug": "pijusz/mcp-sanity-images",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_pijusz_mcp_sanity_images_7798488c/readme"
}