StackMCP

Set up Sanity MCP in Claude 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

Claude Code reads MCP server configuration from the following file:

~/.claude.json

Create this file if it does not already exist.

2

Add the configuration

You can configure Sanity MCP using the CLI command or by editing the config file directly.

Option A: CLI command

bash
claude mcp add sanity-mcp -e SANITY_PROJECT_ID=YOUR_SANITY_PROJECT_ID -e SANITY_TOKEN=YOUR_SANITY_TOKEN -- npx -y @sanity/mcp-server

Option B: Config file

json
{
  "mcpServers": {
    "sanity-mcp": {
      "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_IDRequired

Sanity project ID

SANITY_TOKENRequired

Sanity API token with write access

4

Verify it works

Restart Claude 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.

Set up Sanity MCP in other editors