# Sanity (verified)

Enable AI agents to interact with your Sanity workspace through the Model Context Protocol (MCP).

## Quick Start

```bash
# Connect this server (installs CLI if needed)
npx -y @smithery/cli@latest mcp add sanity

# Browse available tools
npx -y @smithery/cli@latest tool list sanity

# Get full schema for a tool
npx -y @smithery/cli@latest tool get sanity get_schema

# Call a tool
npx -y @smithery/cli@latest tool call sanity get_schema '{}'
```

## Direct MCP Connection

Endpoint: `https://sanity.run.tools`

## Tools (41)

- `get_schema` — Get the full schema of the current Sanity workspace
- `list_workspace_schemas` — Get a list of all available workspace schema names
- `deploy_schema` — Deploy Sanity schema directly to cloud (project and dataset). IMPORTANT: Only use this for projects WITHOUT a local San…
- `create_documents_from_json` — Create one or more draft documents by directly providing JSON content. Creates drafts (drafts.* prefix) unless releaseI…
- `create_documents_from_markdown` — Create one or more draft documents from Markdown content. Creates drafts (drafts.* prefix) unless releaseId is specifie…
- `create_version` — Create a version document (versions.{releaseId}.* prefix) for a specific release. Versions are separate from drafts and…
- `patch_document_from_json` — Apply precise modifications to document fields. When targeting a published document, this creates or updates a draft wi…
- `patch_document_from_markdown` — Patch a specific field in a document using Markdown content
- `query_documents` — Query documents from Sanity using GROQ query language
- `generate_image` — Generate a new image in a document using AI. When targeting a published document, this creates or updates a draft with …
- `transform_image` — Transform an existing image in a document using AI. When targeting a published document, this creates or updates a draf…
- `get_document` — Fetch a single document by its exact ID. This is a direct ID lookup only - it does not search, filter, or query. Use wh…
- `publish_documents` — Publish one or more draft documents to make them live
- `unpublish_documents` — Unpublish one or more published documents (moves them back to drafts)
- `version_replace_document` — Replace the contents of a document version with contents from another document
- `discard_drafts` — Discard one or more draft documents (deletes drafts while keeping published documents intact). Can also discard release…
- `version_unpublish_document` — Mark a document to be unpublished when the release is run
- `list_organizations` — Lists all organizations the user has access to in Sanity
- `list_projects` — Lists all Sanity projects associated with your account
- `get_project_studios` — Retrieves all studio applications linked to a specific Sanity project
- `create_project` — Creates a new Sanity project and initializes it with a dataset and API tokens
- `add_cors_origin` — Adds CORS origin(s) to allow client-side requests to a Sanity project
- `list_datasets` — Lists all datasets in your Sanity project
- `create_dataset` — Creates a new dataset with specified name and access settings
- `update_dataset` — Modifies a dataset's name or access control settings
- `list_releases` — List content releases in Sanity, optionally filtered by state (active, scheduled, etc)
- `create_release` — Create a new content release in Sanity with an automatically generated ID
- `edit_release` — Update metadata for an existing content release
- `schedule_release` — Schedule a content release to be published at a specific time
- `publish_release` — Publish a release immediately
- `archive_release` — Archive a release that is no longer active
- `unarchive_release` — Restore an archived release
- `unschedule_release` — Remove a previously set schedule from a release
- `delete_release` — Delete a release
- `list_embeddings_indices` — List all available embeddings indices for a dataset
- `semantic_search` — Perform a semantic search on an embeddings index
- `migration_guide` — Get comprehensive guidance for migrating existing projects to Sanity. Supports general migration guides, analyzing exis…
- `search_docs` — Search Sanity docs
- `read_docs` — Read a specific Sanity documentation article
- `list_sanity_rules` — IMPORTANT: Call this FIRST before any Sanity development work. Returns available best practice rules for schemas, queri…
- `get_sanity_rules` — Load Sanity development rules. ALWAYS call list_sanity_rules first to see available rules, then load all rules relevant…

```bash
# Get full input/output schema for a tool
npx -y @smithery/cli@latest tool get sanity <tool-name>
```

## Resources

- `sanity://rules/sanity-app-sdk` — Rules for building custom applications with the Sanity App SDK, including React hooks, document handles, real-time patt…
- `sanity://rules/sanity-astro` — Integration guide for Astro, including @sanity/astro, visual editing, and data fetching.
- `sanity://rules/sanity-get-started` — Use these rules when users ask to 'Get started with Sanity' or need help setting up a new Sanity project.
- `sanity://rules/sanity-groq` — Guidelines for GROQ queries, type safety, performance optimization, and syntax highlighting.
- `sanity://rules/sanity-hydrogen` — Integration guide for Sanity with Shopify using the Hydrogen framework (React Router 7).
- `sanity://rules/sanity-image` — Best practices for handling images in Sanity: Schema, URL generation, and Next.js Image integration.
- `sanity://rules/sanity-localization` — Localization patterns for Sanity using official plugins and best practices.
- `sanity://rules/sanity-migration` — Best practices for migrating content (HTML, Markdown) into Sanity Portable Text.
- `sanity://rules/sanity-nextjs` — Integration guide for Next.js App Router, Live Content API, and Sanity Studio (Embedded or Standalone).
- `sanity://rules/sanity-nuxt` — Integration guide for Nuxt, including @nuxtjs/sanity, visual editing, and data fetching.
- `sanity://rules/sanity-page-builder` — Patterns for Sanity Page Builder arrays, block components, and live editing.
- `sanity://rules/sanity-portable-text` — Portable Text (Rich Text) rendering and custom component creation for React/Next.js.
- `sanity://rules/sanity-project-structure` — Project structure patterns for Sanity projects including monorepo and embedded Studio setups.
- `sanity://rules/sanity-remix` — Integration guide for React Router (formerly Remix) with Sanity, including Loaders and Visual Editing.
- `sanity://rules/sanity-schema` — Rules for defining Sanity Content Models (Schemas), including field definitions, strict typing, and validation patterns.
- `sanity://rules/sanity-seo` — SEO best practices for Sanity with Next.js, including metadata, Open Graph, sitemaps, redirects, and JSON-LD structured…
- `sanity://rules/sanity-studio-structure` — Rules for customizing the Sanity Studio Structure (S.structure).
- `sanity://rules/sanity-svelte` — Integration guide for SvelteKit with Sanity, including @sanity/svelte-loader, Visual Editing, and Preview Mode.
- `sanity://rules/sanity-typegen` — Workflow for generating TypeScript types from Sanity Schema and GROQ queries.
- `sanity://rules/sanity-visual-editing` — Comprehensive guide for Sanity Visual Editing, including Presentation Tool, Stega (Content Source Maps), and Overlays.
