Sanity logo
Documents & ContentAuth: OAuthHosting: Official hosted

Sanity MCP Server

Connect AI agents to your Sanity content — query, draft, publish, and manage schemas via MCP.

Updated

What is Sanity MCP?

The Sanity MCP server is a Model Context Protocol server that connects AI agents and assistants directly to your Sanity content — letting them run GROQ queries, create and edit documents, manage schemas, and coordinate content releases through a single secure gateway.

It is an officially hosted, remote server operated by Sanity at https://mcp.sanity.io. Because it runs on Sanity's managed infrastructure, there is nothing to self-host: rate limiting, metrics, and error tracking are handled for you. The server also ships with built-in instructions and on-demand best-practice rules that teach the agent how Sanity's content model works, so it understands your schema instead of guessing.

Authentication uses OAuth by default — you sign in with your existing Sanity account and the agent inherits your project access, with no tokens to manage to get started. For automated, non-interactive workflows you can alternatively supply a scoped Sanity API token. A deprecated local @sanity/mcp-server package exists, but Sanity now points all users to the remote server at mcp.sanity.io.

Tools the Sanity MCP server exposes

ToolWhat it does
query_documentsRun a GROQ query against a dataset to read content.
get_documentFetch a single document by id.
create_documentsCreate one or more new documents.
patch_documentsUpdate existing documents with partial changes.
publish_documentsPublish draft documents to live.
unpublish_documentsUnpublish (retract) published documents.
get_schemaRetrieve the content schema for a workspace.
deploy_schemaDeploy schema changes to a Sanity project.
create_releaseCreate a content release to bundle and ship changes together.
semantic_searchRun semantic/embedding-based search over content.

Connect the Sanity MCP server

Claude Code

  1. 1

    Add the remote server

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

  2. 2

    Authenticate via OAuth

    Start Claude Code and trigger any Sanity tool; a browser window opens to sign in to your Sanity account and authorize access.

  3. 3

    Verify

    Ask the agent to run a GROQ query (e.g. list document types) to confirm the connection.

Cursor

  1. 1

    Open MCP settings

    Edit your Cursor mcp.json (Settings > MCP, or the project .cursor/mcp.json).

  2. 2

    Add the Sanity server

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

  3. 3

    Sign in

    Reload Cursor; the first Sanity tool call opens an OAuth login to your Sanity account. Alternatively run npx sanity@latest mcp configure to set it up automatically.

Sample use cases

An agent drafts and publishes blog content directly into Sanity

Content moves from idea to published document without leaving the agent.

A scheduled agent queries content via GROQ to audit or report on the dataset

Up-to-date content insights without manual Studio queries.

An agent bundles related changes into a content release for coordinated publishing

Multiple edits ship together cleanly.

Security & permissions

The remote server authenticates with OAuth by default: you sign in with your existing Sanity account and the agent operates with your user's access to the projects and datasets you can already see — it can read content via GROQ and create, patch, publish, and unpublish documents, manage schemas, and run releases. Because that scope includes write and publish operations, grant access only to trusted clients and review what the agent does on production datasets.

For automated or server-side workflows, use a scoped Sanity API token (Bearer) instead of interactive OAuth, and restrict it to the minimum dataset/role needed. AI image generation and transformation tools consume Sanity AI credits, so they also draw on your account's usage.

Using Sanity MCP with Gamut

In a Gamut workflow, the Sanity MCP server becomes a connected tool that an agent can call on a schedule or in response to an event — Gamut manages the OAuth/token connection so the agent can query content, draft documents, and publish releases without manual setup. For example, a scheduled agent could pull newly drafted posts via GROQ, enrich or fact-check them, and publish them as part of a content pipeline, or an event-triggered agent could sync structured content into Sanity when an upstream source changes.

Frequently asked questions

What is the Sanity MCP server?

It is an officially hosted Model Context Protocol server, at https://mcp.sanity.io, that lets AI agents connect to your Sanity projects to run GROQ queries, create and edit documents, manage schemas, and coordinate content releases — all with awareness of your content model.

Is the Sanity MCP server free?

There is no separate fee to connect — it is available for all Sanity projects and runs on Sanity's managed infrastructure. Your normal Sanity plan limits apply, and the AI image generation/transformation tools consume Sanity AI credits.

How do I connect the Sanity MCP server to Claude Code or Cursor?

For Claude Code, run: claude mcp add Sanity -t http https://mcp.sanity.io --scope user, then authorize via OAuth. For Cursor, add {"type":"http","url":"https://mcp.sanity.io"} under mcpServers in mcp.json (or run npx sanity@latest mcp configure) and sign in. The first tool call triggers the OAuth login.

Is the Sanity MCP server hosted or self-hosted?

It is officially hosted by Sanity as a remote server at https://mcp.sanity.io — there is nothing to self-host, and rate limiting, metrics, and error tracking are included. The older local @sanity/mcp-server package is deprecated in favor of the remote server.