Back to MCP Servers

Sanity MCP Server

Schema-aware, GROQ-driven content operations on Sanity CMS. Lets AI agents query, patch, publish, and release documents via the hosted server at mcp.sanity.io.

Content & CMS by Sanity OAuth2 active
Overview

The Sanity MCP server is the official remote Model Context Protocol server hosted by Sanity at https://mcp.sanity.io. It connects AI assistants (Claude Code, Cursor, VS Code, Lovable, Replit, v0, OpenCode) directly to Sanity Content Lake projects, exposing schema-aware tools for content operations. The server understands your studio schemas, so agents can create and patch documents with field-level awareness rather than blind JSON edits.

Capabilities span the full content lifecycle: GROQ querying, document CRUD with draft and publish controls, content releases and versioning, dataset and project administration, schema and studio deployment, semantic search over embeddings indices, AI image generation and transformation, and access to Sanity's own documentation. Authentication is handled via OAuth by default with no API token management required, with a Bearer token option for headless setups.

A local npm package (@sanity/mcp-server) previously existed but was deprecated in October 2025 in favor of the remote server, which is continuously updated, requires no Node install, and runs over streamable HTTP transport.

Tools

Tool Description
get_schema Fetch the schema for the current workspace.
list_workspace_schemas List all workspace schemas in the project.
deploy_schema Deploy a schema to Sanity.
deploy_studio Deploy a Sanity Studio instance.
query_documents Run a GROQ query against a dataset.
get_document Retrieve one or more documents by ID.
create_documents_from_json Create documents from a JSON payload with schema validation.
create_documents_from_markdown Create documents from Markdown source.
patch_document_from_json Patch a document using JSON operations.
patch_document_from_markdown Patch a document using Markdown input.
publish_documents Publish one or more draft documents.
unpublish_documents Unpublish published documents.
discard_drafts Discard draft versions of documents.
create_release Create a content release.
list_releases List available content releases.
create_version Create a versioned document inside a release.
version_replace_document Replace a versioned document in a release.
version_discard Discard a versioned document from a release.
version_unpublish_document Mark a versioned document to be unpublished on release.
generate_image Generate an image via AI.
transform_image Transform an existing image asset.
list_organizations List Sanity organizations accessible to the user.
list_projects List projects in the current organization.
get_project_studios List Studio hosts attached to a project.
create_project Create a new Sanity project.
add_cors_origin Add a CORS origin to a project.
list_datasets List datasets in a project.
create_dataset Create a new dataset.
update_dataset Update dataset settings or permissions.
list_embeddings_indices List embeddings indices available for semantic search.
semantic_search Find content based on meaning rather than exact keywords.
search_docs Search Sanity's official documentation.
read_docs Read a specific page of Sanity documentation.
migration_guide Retrieve migration guides for Sanity products.
whoami Return information about the authenticated user.
list_sanity_rules List Sanity Rules available in the project.
get_sanity_rules Retrieve specific Sanity Rules content.
Setup Guide

Prerequisites

  • A Sanity account (sign up at sanity.io)
  • An MCP-compatible client (Claude Code, Cursor, VS Code, Lovable, Replit, v0, OpenCode)

Recommended: Sanity CLI auto-configure

The CLI detects your installed clients and writes the correct config:

npx sanity@latest mcp configure

Claude Code

claude mcp add Sanity -t http https://mcp.sanity.io --scope user

Cursor / generic mcp.json

{
  "mcpServers": {
    "Sanity": {
      "type": "http",
      "url": "https://mcp.sanity.io"
    }
  }
}

VS Code

Same config as above but under the "servers" key instead of "mcpServers":

{
  "servers": {
    "Sanity": {
      "type": "http",
      "url": "https://mcp.sanity.io"
    }
  }
}

Authentication

The default flow is OAuth, triggered automatically on first connect. For headless setups, pass a Bearer token via the Authorization header. Tokens are managed at sanity.io/manage or via the Sanity CLI.

Use Cases
  • Pull all blog posts authored by a given person via GROQ, draft revisions, and publish them as a coordinated content release.
  • Bulk patch product documents from a Markdown changelog, validating against the schema before publish.
  • Run semantic search across an embeddings index to find every document referencing a topic, then add cross-links.
  • Spin up a new dataset for a staging environment, register CORS origins, and deploy the Studio configuration.
  • Generate and transform hero images for landing pages directly inside the agent workflow.
Example Prompts
  • "Run a GROQ query to list the 20 most recent draft articles and show their authors and titles."
  • "Create a release called summer-launch, add all products tagged summer-2026, and schedule them to publish on June 1."
  • "Patch the document with id siteSettings to set the footer text to our new tagline and publish it."
  • "Use semantic search to find all case studies that talk about reducing churn, then add a topic: retention field."
  • "Create a new dataset called staging, add https://preview.example.com as a CORS origin, and list all studios on the project."
Pros
  • Officially built and hosted by Sanity at mcp.sanity.io, with continuous updates and no local install.
  • Schema-aware tooling means edits respect field types and validation, not just blind JSON writes.
  • Covers the full content lifecycle: GROQ, drafts, publishing, releases, datasets, schemas, and images.
  • OAuth out of the box; no manual API token rotation required for interactive use.
Limitations
  • Requires a Sanity account and project; not useful outside the Sanity ecosystem.
  • The previous local server (@sanity/mcp-server) is deprecated, so self-hosting is no longer a supported path.
  • Streamable HTTP transport requires an MCP client that supports remote HTTP servers.
Alternatives
  • Contentful MCP server for similar headless CMS workflows.
  • Strapi community MCP integrations for self-hosted CMS use cases.
  • Directly using the Sanity HTTP API or GROQ via a generic HTTP MCP server (less ergonomic, no schema awareness).