Set up Sanity MCP in VS Code
Manage Sanity CMS content with 40+ tools for document operations, schema management, content releases, GROQ queries, and media generation.
1
Locate the config file
VS Code reads MCP server configuration from the following file:
.vscode/settings.json → mcp sectionCreate this file if it does not already exist. For VS Code, this is inside your workspace .vscode/settings.json file under the mcp section.
2
Add the configuration
Add the following to your VS Code config file:
json
{
"servers": {
"sanity-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@sanity/mcp-server"
],
"env": {
"SANITY_PROJECT_ID": "YOUR_SANITY_PROJECT_ID",
"SANITY_TOKEN": "YOUR_SANITY_TOKEN"
}
}
}
}3
Set up environment variables
Sanity MCP requires the following environment variables:
SANITY_PROJECT_IDRequiredSanity project ID
SANITY_TOKENRequiredSanity API token with write access
4
Verify it works
Restart VS Code. Sanity MCP should appear in your MCP server list with 40 tools available.
This server adds approximately 20,600 tokens to your context window for tool definitions.