$git clone https://github.com/sanity-io/agent-toolkitCollection of resources to help AI agents build better with Sanity.
| 1 | <p align="center"> |
| 2 | <a href="https://sanity.io"> |
| 3 | <img src="https://cdn.sanity.io/images/3do82whm/next/d6cf401d52c33b7a5a354a14ab7de94dea2f0c02-192x192.svg" /> |
| 4 | </a> |
| 5 | <h1 align="center">Sanity Agent Toolkit</h1> |
| 6 | </p> |
| 7 | |
| 8 | Collection of resources to help AI agents build better with [Sanity](https://www.sanity.io). Supports Cursor, Claude Code, Codex, VS Code, Lovable, v0, Replit, OpenCode, and any other editor/agent compatible with MCP or [Agent Skills](https://agentskills.io). |
| 9 | |
| 10 | --- |
| 11 | |
| 12 | ## Features |
| 13 | |
| 14 | - **MCP server:** Direct access to your Sanity projects (content, datasets, releases, schemas) and agent rules. |
| 15 | - **Agent skills:** Comprehensive best practices skills for Sanity development, content modeling, SEO/AEO, and experimentation. Includes 21 integration/topic guides and 26 focused best-practice rules. |
| 16 | - **Claude Code plugin:** MCP server, agent skills, and slash commands for Claude Code users. Available on the [official Anthropic plugin marketplace](https://claude.com/plugins/sanity). |
| 17 | - **Cursor plugin:** MCP server, agent skills, and commands on the [Cursor Marketplace](https://cursor.com/marketplace/sanity). |
| 18 | - **Codex plugin:** MCP server and agent skills for [OpenAI Codex](https://developers.openai.com/codex) users. |
| 19 | |
| 20 | --- |
| 21 | |
| 22 | ## Get started |
| 23 | |
| 24 | Choose your path based on how you want agents to work with Sanity: |
| 25 | |
| 26 | 1. **MCP server** — Give your agent always up-to-date rules and full access to your Sanity projects. No local files to maintain. Works with Cursor, VS Code, Claude Code, Lovable, v0, Replit, OpenCode, and other MCP-compatible clients. |
| 27 | 2. **Agent skills** — Install best practices skills for Sanity, content modeling, SEO/AEO, and experimentation. Works with Cursor, Claude Code, and any [Agent Skills](https://agentskills.io)-compatible agent. |
| 28 | 3. **Plugin** — Install the Sanity plugin for Cursor or Claude Code. Bundles MCP server, agent skills, and commands. |
| 29 | 4. **Manual installation** — Copy the skill references locally for offline use. You'll need to update them yourself. |
| 30 | |
| 31 | ### Option 1: Install MCP server (recommended) |
| 32 | |
| 33 | Give agents direct access to Sanity projects and always up-to-date agent rules via the MCP server. |
| 34 | |
| 35 | #### Quick install via Sanity CLI |
| 36 | |
| 37 | Run in terminal to detect and configure MCP for Cursor, Claude Code and VS Code automatically: |
| 38 | |
| 39 | ```bash |
| 40 | npx sanity@latest mcp configure |
| 41 | ``` |
| 42 | |
| 43 | Uses your logged-in CLI user for authentication — no manual tokens or OAuth needed. |
| 44 | |
| 45 | #### Client-specific instructions |
| 46 | |
| 47 | <details> |
| 48 | <summary><strong>Cursor</strong></summary> |
| 49 | |
| 50 | One-click install:<br> |
| 51 | [](https://cursor.com/en-US/install-mcp?name=Sanity&config=eyJ0eXBlIjoiaHR0cCIsInVybCI6Imh0dHBzOi8vbWNwLnNhbml0eS5pbyJ9) |
| 52 | |
| 53 | Or manually: Open **Command Palette** (`Cmd+Shift+P` / `Ctrl+Shift+P`) → **View: Open MCP Settings** → **+ New MCP Server** → add to `mcp.json`: |
| 54 | ```json |
| 55 | { |
| 56 | "mcpServers": { |
| 57 | "Sanity": { |
| 58 | "type": "http", |
| 59 | "url": "https://mcp.sanity.io" |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | ``` |
| 64 | </details> |
| 65 | |
| 66 | <details> |
| 67 | <summary><strong>Claude Code</strong></summary> |
| 68 | |
| 69 | Run in terminal. Authenticate with OAuth on next launch: |
| 70 | ```bash |
| 71 | claude mcp add Sanity -t http https://mcp.sanity.io --scope user |
| 72 | ``` |
| 73 | </details> |
| 74 | |
| 75 | <details> |
| 76 | <summary><strong>Codex</strong></summary> |
| 77 | |
| 78 | Run in terminal. Authenticate with OAuth on next launch: |
| 79 | ```bash |
| 80 | codex mcp add Sanity --url https://mcp.sanity.io |
| 81 | ``` |
| 82 | |
| 83 | Or manually add to `~/.codex/config.toml`: |
| 84 | ```toml |
| 85 | [mcp_servers.Sanity] |
| 86 | url = "https://mcp.sanity.io" |
| 87 | ``` |
| 88 | </details> |
| 89 | |
| 90 | <details> |
| 91 | <summary><strong>VS Code</strong></summary> |
| 92 | |
| 93 | Open **Command Palette** (`Cmd+Shift+P` / `Ctrl+Shift+P`) → **MCP: Open User Configuration** → add: |
| 94 | ```json |
| 95 | { |
| 96 | "servers": { |
| 97 | "Sanity": { |
| 98 | "type": "http", |
| 99 | "url": "https://mcp.sanity.io" |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | ``` |
| 104 | </details> |
| 105 | |
| 106 | <details> |
| 107 | <summary><strong>Lovable</strong></summary> |
| 108 | |
| 109 | Sanity is available as a prebuilt chat connector in Lovable: |
| 110 | |
| 111 | 1. Open **Connectors** → **Chat connectors** |
| 112 | 2. Select **Sanity** |
| 113 | 3. Click **Connect** and sign in to authorize your Sanity account |
| 114 | |
| 115 | In your next prompt, reference your Sanity project or ask the agent to read your schema. |
| 116 | |
| 117 | See the [Lovable MCP documentation](https://docs.lovable.dev/integrations/mcp-servers) or [Sanity + Lovable guide](https://lovable.dev/connect/sanity) for more details. |
| 118 | </details> |
| 119 | |
| 120 | <details> |
| 121 | <summary><strong>v0</strong></summary> |
| 122 | |
| 123 | In the prompt input field, click **Prompt Tools** → **MCPs** → **Add New** → Select **Sanity** → **Authorize** → Authenticate with OAuth. |
| 124 | </details> |
| 125 | |
| 126 | <details> |
| 127 | <summary><strong>Replit</strong></summary> |
| 128 | |
| 129 | Go to [Integrations Page](https://replit.com/integrations) → scroll to **MCP Servers for Replit Agent** → **Add MCP server** → Enter `Sanity` as name and `https://mcp.sanity.io` as Server URL → **Test & Save** → Authenticate with OAuth. |
| 130 | </details> |
| 131 | |
| 132 | <details> |
| 133 | <summary><strong>OpenCode</strong></summary> |
| 134 | |
| 135 | Add to your `opencode.json`: |
| 136 | ```json |
| 137 | { |
| 138 | "$schema": "https://opencode.ai/config.json", |
| 139 | "mcp": { |
| 140 | "sanity": { |
| 141 | "type": "remote", |