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.
Knut Melvær
Head of Developer Community and Education
Even Westvang
Co-founder and product person at Sanity
Published
Table of Contents
- Setting up the MCP server in minutes
- Troubleshooting Node.js version managers
- Your first MCP conversation
- From insights to actions
- Content Intelligence: Learn about your content
- Content Operations: Get stuff done
- What is the Model Context Protocol?
- Beyond the basics: MCP Server capabilities
- We are all still figuring this stuff out!
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.
Setting up the MCP server in minutes
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.
Go to the GitHub repository for full documentation.
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:
{
"mcpServers": {
"sanity": {
"command": "npx",
"args": ["-y", "@sanity/mcp-server@latest"],
"env": {
"SANITY_PROJECT_ID": "your-project-id",
"SANITY_DATASET": "production",
"SANITY_API_TOKEN": "your-sanity-api-token"
}
}
}
}
Where exactly this configuration goes depends on which AI tool you're using:
- For Claude Desktop, add it to your Claude configuration file
- For Cursor, add it to a project workspace or in global settings
- VS Code has MCP support in preview for Copilot
Troubleshooting Node.js version managers
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):
New-Item -ItemType SymbolicLink -Path "C:\Program Files\nodejs\node.exe" -Target (Get-Command node).Source -Force
New-Item -ItemType SymbolicLink -Path "C:\Program Files\nodejs\npx.cmd" -Target (Get-Command npx).Source -Force
Your first MCP conversation
With everything set up, you're ready for your first AI-powered content conversation! Try these starter prompts:
- "Show me all blog posts published in the last month"
- "Create a new product page for our upcoming feature"
- "Update our pricing information across all service pages"
- "Schedule the Easter marketing campaign content release for next Tuesday"
The first time you run a command, your AI agent will most likely ask for permission to use the Sanity tools. After that, you're off to the races!
From insights to actions
In the week we had of internal testing at Sanity, we found that you can use the MCP server in tandem with AI in two fundamental approaches.
Content Intelligence: Learn about your content
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.
Content Operations: Get stuff done
This mode puts your content ideas into action. It's like having a skilled content operations 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.
What is the Model Context Protocol?
The Model Context Protocol (MCP) provides a standardized interface for AI models interacting with external systems through APIs. Anthropic proposed and maintains it, and MCP has gained traction as the default way to make services available as AI tools. For example, OpenAI is on board with official support, and the Google team has committed to maintaining the official Go SDK. Reassuring!
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 GraphQL 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.

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.
Beyond the basics: MCP Server capabilities
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 query language 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
We are all still figuring this stuff out!
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:
- The new AI-driven Sanity development course on Sanity Learn
- New docs on best practices for AI-enhanced Sanity development
- Blog post on how to render AI-friendly content
- Video on building apps with voice and Cursor
And don't forget to check out our upcoming Spring release; there will be more AI news there, too! 🍰