Introducing Sanity MCP Server: Connect your content to AI tools
The Sanity MCP server enables AI agents to interact with your content, empowering you with powerful tools for document management, GROQ queries, and more.
The local MCP server (@sanity/mcp-server) is deprecated.
We recommend migrating to the remote MCP server at mcp.sanity.io.
The remote server offers OAuth authentication, managed infrastructure, and automatic updates. No npm install, no API token management required, no version maintenance.
To migrate, run: npx sanity@latest mcp configure
The local server will continue to work but won't receive new features.
Have you ever wished you could just ask your favorite AI Agent to find, update, or create content for you? The Model Context Protocol (MCP) makes this possible, and we've built a server that brings this capability to your Sanity projects. The Sanity MCP server connects your structured content directly to AI agents like Claude and Cursor, letting you manage content through natural language conversations.
Need to update product descriptions across multiple pages? Want to organize content for a seasonal campaign? Simply describe what you need, and let the AI handle the technical details. No more switching contexts or remembering query syntax.
Here's what you can do with the Sanity MCP server:
Query your content using natural language instead of writing GROQ
Create and update documents by describing what you want
Organize content releases and schedule publication
Explore your schema without digging through documentation
Perform semantic searches across your content
Get information about your projects
Create and update datasets
Let's get practical and see how you can start using the MCP server today.
The remote MCP server is hosted on Sanity's infrastructure and is the easiest way to get started.
The server follows Anthropic's official MCP specification and should work with any MCP clients. Follow the documentation for your client for how to add MCP servers. Typically, you add a section like the following to the relevant configuration file:
If you're itching to see the MCP server in action (and who wouldn't be?), let's get you up and running in minutes. The setup is straightforwardβjust follow these steps, and you'll be able to converse with your content in no time.
First, make sure you've deployed your schema manifest. This is crucial because the MCP server needs to understand your content structure to work on it:
# Option A: Force latest CLI version (recommended)
cd /path/to/studio
SANITY_CLI_SCHEMA_STORE_ENABLED=true npx --ignore-existing sanity@latest schema deploy
# Option B: If you have the CLI installed globally
npm install -g sanity
cd /path/to/studio
SANITY_CLI_SCHEMA_STORE_ENABLED=true sanity schema deploy
# Option C: Update your Studio first
cd /path/to/studio
npm update sanity
SANITY_CLI_SCHEMA_STORE_ENABLED=true npx sanity schema deploy
You'll also need your Sanity credentials handy (you can find these in your project settings):
Project ID
Dataset name
API token with appropriate permissions
Now for the fun part. Add the Sanity MCP server to your AI tool's configuration file:
Using nvm, mise, or another Node version manager? Here's a quick fix for the most common setup issue. It's a one-time configuration that creates the necessary system links:
# First, activate your preferred Node version
nvm use 20 # or whichever version you prefer
# Then create the symlinks (macOS/Linux)
sudo ln -sf "$(which node)" /usr/local/bin/node && sudo ln -sf "$(which npx)" /usr/local/bin/npx
Windows users can run this in PowerShell (as Administrator):
This mode brings your content into the conversation, making it part of your thinking process. It's like having a research assistant who:
Reads and understands your entire content library
Answers questions about your existing content
Identifies patterns, gaps, and connections
Provides insights that inform your decision-making
The power here lies in how naturally you can explore your content. Instead of constructing complex queries, you simply ask questions in plain language: "What product pages haven't been updated in the last six months?" or "Which blog posts mention our enterprise features?"
In this conversation with Claude, I asked, "What are common ways of defining 'Sanity Studio' in our Sanity documentation?" Here is what it did:
Got the context of the project and the schema
Did semantic searches from our embeddings indices
Fetched the articles and GROQed the text blocks mentioning "Sanity Studio"
Summarized its findings into nine common Studio definitions
These could be useful insights for our documentation team, ensuring we stay consistent and helpful in defining our products. But knowing is only half the battle, which takes us to the really powerful stuff.
This mode puts your content ideas into action. It's like having a skilled specialist who can:
Create new content following your schemas
Update existing content across multiple documents
Organize content into strategic releases
Manage publishing workflows through simple instructions
The transformation happens when you go from "I need to update all product descriptions to include our new pricing model" to simply saying exactly thatβand having it done. Let's say we needed to rename "Sanity Create" to "Sanity Canvas". Here is a video of Claude at work finding documents that mention Sanity Create and staging the name change into a Content Release (cut and sped up for demo purposes):
That's pretty useful!
It doesn't always get everything right, but it did save us a lot of time. Now a human editor can go through the changes to quality control that everything is correct before running the release.
What makes the MCP server so handy isn't just these individual capabilities but how seamlessly you can flow between understanding your content and taking action on itβall through natural conversation rather than technical interfaces.
So far, it has worked with most applications by installing and configuring the MCP server, which then shows up as "tools" that your AI Agent or chat can use. Conceptually, it is a bit like building a API, where you translate the schema to resolvers that connect to the data and operations you want to expose.
Usually, the AI will intuit when and what tools to use depending on what you ask it to do. Claude will explicitly ask for permission to run tools within a conversation, while Cursor can run them automatically, depending on your configuration.
Claude will ask for explicit permission before it runs tools from the MCP server
For now, the most common way to install and run MCP servers is to install them locally on your computer and authenticate with API tokens stored in the JSON configuration. The MCP specification maintainers and the developer community are still actively figuring out how to best implement MCP servers, especially when hosting them remotely and dealing with authentication and security. We are actively following these discussions.
So, what can you use the Sanity MCP server for? Pretty much anything you can do with your content in Sanity! We are launching the server with several tools and capabilities.
General tools:
Start your session with essential context and configuration details
Access your current Sanity environment settings
View all available projects at a glance
Browse studio hosts for any project
Document management:
Retrieve individual or multiple documents instantly
Create new content with automatic schema validation
Make batch document changes in single transactions
Update existing documents while maintaining integrity
Remove specific documents or groups that match the criteria
Apply various mutation types within single operations
Control document publication status seamlessly
Move drafts to published status individually or in batches
Revert published content back to draft form
Release management:
Create new content releases with custom metadata
Add individual or multiple documents to planned releases
Get comprehensive views of release contents
Control publication status of release documents
Remove specific content from planned releases
Update release titles and descriptions
Dataset management:
Create custom datasets with flexible access controls
Modify dataset settings and permissions
Permanently remove datasets when needed
View detailed information about all available datasets
Content querying:
Access the complete GROQ specification
Execute powerful queries to find exactly what you need
AI-Powered search:
List available embedding indices
Find content based on meaning rather than exact keywords
Schema tools:
Get high-level overviews of your content structure
Access detailed information about specific content types, including field descriptions
It's tempting to come up with lofty promises about how this revolutionizes content operations and will 10x the productivity of your teams. Using these tools, you get a sense of the potential, but you will also discover that it's also a skill to manage AI in a way that makes it do the right things and not over-eagerly get off the trail. Working with the MPC server is an excellent way to build those skills.
And speaking of skill building, you might also be interested in some of our recent AI materials:
# Option A: Force latest CLI version (recommended)cd /path/to/studioSANITY_CLI_SCHEMA_STORE_ENABLED=true npx --ignore-existing sanity@latest schema deploy# Option B: If you have the CLI installed globallynpm install -g sanitycd /path/to/studioSANITY_CLI_SCHEMA_STORE_ENABLED=true sanity schema deploy# Option C: Update your Studio firstcd /path/to/studionpm update sanitySANITY_CLI_SCHEMA_STORE_ENABLED=true npx sanity schema deploy
# First, activate your preferred Node versionnvm use 20 # or whichever version you prefer# Then create the symlinks (macOS/Linux)sudo ln -sf "$(which node)" /usr/local/bin/node && sudo ln -sf "$(which npx)" /usr/local/bin/npx