Sanity
Direct access to your Sanity projects (content, datasets, releases, schemas) and agent rules
Ask AI about Sanity
Powered by Claude Β· Grounded in docs
I know everything about Sanity. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
Sanity Agent Toolkit
Collection of resources to help AI agents build better with Sanity. Supports Cursor, Claude Code, VS Code, Lovable, v0, and any other editor/agent compatible with MCP or Agent Skills.
Features
- MCP server: Direct access to your Sanity projects (content, datasets, releases, schemas) and agent rules.
- 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.
- Claude Code plugin: MCP server, agent skills, and slash commands for Claude Code users.
- Cursor plugin: MCP server, agent skills, and commands for the Cursor Marketplace.
Get started
Choose your path based on how you want agents to work with Sanity:
- 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, and other MCP-compatible clients.
- Agent skills β Install best practices skills for Sanity, content modeling, SEO/AEO, and experimentation. Works with Cursor, Claude Code, and any Agent Skills-compatible agent.
- Plugin β Install the Sanity plugin for Cursor or Claude Code. Bundles MCP server, agent skills, and commands.
- Manual installation β Copy the skill references locally for offline use. You'll need to update them yourself.
Option 1: Install MCP server (recommended)
Give agents direct access to Sanity projects and always up-to-date agent rules via the MCP server.
Quick install via Sanity CLI
Run in terminal to detect and configure MCP for Cursor, Claude Code and VS Code automatically:
npx sanity@latest mcp configure
Uses your logged-in CLI user for authentication β no manual tokens or OAuth needed.
Client-specific instructions
Cursor
Or manually: Open Command Palette (Cmd+Shift+P / Ctrl+Shift+P) β View: Open MCP Settings β + New MCP Server β add to mcp.json:
{
"mcpServers": {
"Sanity": {
"type": "http",
"url": "https://mcp.sanity.io"
}
}
}
Claude Code
Run in terminal. Authenticate with OAuth on next launch:
claude mcp add Sanity -t http https://mcp.sanity.io --scope user
VS Code
Open Command Palette (Cmd+Shift+P / Ctrl+Shift+P) β MCP: Open User Configuration β add:
{
"servers": {
"Sanity": {
"type": "http",
"url": "https://mcp.sanity.io"
}
}
}
Lovable
Settings β Connectors β Personal connectors β New MCP server β Enter Sanity as name and https://mcp.sanity.io as Server URL β Add & authorize β Authenticate with OAuth.
v0
In the prompt input field, click Prompt Tools β MCPs β Add New β Select Sanity β Authorize β Authenticate with OAuth.
Replit
Go to Integrations Page β 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.
OpenCode
Add to your opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"sanity": {
"type": "remote",
"url": "https://mcp.sanity.io",
"oauth": {}
}
}
}
Then run: opencode mcp auth sanity
Other clients
For any MCP-compatible client, add https://mcp.sanity.io as the server URL.
If your client doesn't support remote MCP servers, use a proxy like mcp-remote:
{
"mcpServers": {
"Sanity": {
"command": "npx",
"args": ["mcp-remote", "https://mcp.sanity.io", "--transport", "http-only"]
}
}
}
See the Sanity MCP docs for authorization options and troubleshooting.
Option 2: Install Agent Skills
Install best practices skills that work with any Agent Skills-compatible agent.
npx skills add sanity-io/agent-toolkit
See Option 3 for plugin installation.
Option 3: Install plugin
Install the Sanity plugin to get MCP server, agent skills, and commands.
Claude Code
- Add the Sanity marketplace:
/plugin marketplace add sanity-io/agent-toolkit
- Install the plugin:
/plugin install sanity-plugin@sanity-agent-toolkit
- Verify installation: Ask Claude Code: "which skills do you have access to?"
You should see the Sanity skills listed.
- Start using: Use natural language and skills activate automatically:
Help me create a blog post schema in Sanity
Review my GROQ query and Next.js Visual Editing setup
Or run /sanity to explore all capabilities.
Cursor
In Cursor chat, run:
/add-plugin sanity
Option 4: Manual installation
Install the skill references locally to teach your editor Sanity best practices:
- Copy
skills/sanity-best-practices/to your project. - (Recommended) Copy
AGENTS.mdto your project root to act as a knowledge router.
Capabilities
MCP tools
With MCP connected, your AI can use tools like:
query_documentsβ run GROQ queries directlycreate_documents_from_json/create_documents_from_markdownβ create draft documentspatch_document_from_json/patch_document_from_markdownβ surgical edits to existing documentspublish_documents/unpublish_documentsβ manage document lifecycledeploy_schema/get_schemaβ deploy and inspect schemascreate_versionβ create version documents for releasesgenerate_image/transform_imageβ AI image generation and editingsearch_docs/read_docsβ search and read Sanity documentationlist_sanity_rules/get_sanity_rulesβ load agent rules on demand
See the full list of available tools.
Agent skills
Best practices skills that agents like Claude Code, Cursor, GitHub Copilot, etc. can discover and use automatically. Skills follow the Agent Skills format. See Option 2 for installation.
| Skill | Description |
|---|---|
| sanity-best-practices | GROQ performance, schema design, Visual Editing, images, Portable Text, Studio, TypeGen, localization, migrations, and framework integration guides |
| content-modeling-best-practices | Structured content principles: separation of concerns, references vs embedding, content reuse |
| seo-aeo-best-practices | SEO/AEO with EEAT principles, structured data (JSON-LD), technical SEO patterns |
| content-experimentation-best-practices | A/B testing methodology, statistical foundations, experiment design |
Getting started flow
The onboarding guide follows three phases:
- Studio & Schema β Set up Sanity Studio and define your content model
- Content β Import existing content or generate placeholder content via MCP
- Frontend β Integrate with your application (framework-specific)
Just say: "Get started with Sanity" to begin.
Slash commands (Claude Code)
| Command | What it does |
|---|---|
/sanity | List available skills and help topics |
/review | Review code for Sanity best practices |
/typegen | Run TypeGen and troubleshoot issues |
/deploy-schema | Deploy schema with verification |
Repository structure
Note: The reference files in
skills/sanity-best-practices/references/are the canonical content for the Sanity MCP server'slist_sanity_rules/get_sanity_rulestools. Each file must have validnameanddescriptionfrontmatter β rule names are derived from filenames (e.g.,nextjs.mdβnextjs).
sanity-io/agent-toolkit/
βββ AGENTS.md # Knowledge router & agent behavior
βββ README.md # This file
βββ .claude-plugin/ # Claude Code plugin configuration
β βββ marketplace.json # Plugin metadata and marketplace config
βββ .cursor-plugin/ # Cursor plugin configuration
β βββ marketplace.json # Cursor marketplace metadata
β βββ plugin.json # Per-plugin manifest
βββ .mcp.json # MCP server configuration
βββ assets/ # Plugin branding
β βββ logo.svg # Sanity logo for marketplace display
βββ commands/ # Agent commands
β βββ sanity.md # /sanity help
β βββ review.md # /review
β βββ typegen.md # /typegen
β βββ deploy-schema.md # /deploy-schema
βββ scripts/ # Validation and CI scripts
β βββ validate-cursor-plugin.mjs # Cursor plugin validator
βββ skills/ # Agent skills (agentskills.io format)
βββ sanity-best-practices/ # Comprehensive Sanity skill
β βββ SKILL.md # Skill definition and quick reference
β βββ references/ # Canonical content (22 guides)
β βββ get-started.md # Onboarding guide
β βββ nextjs.md # Next.js integration
β βββ groq.md # GROQ patterns & performance
β βββ schema.md # Schema design & validation
β βββ ... # See SKILL.md for full index
βββ content-modeling-best-practices/ # Modeling guidance + topic references
βββ seo-aeo-best-practices/ # SEO/AEO guidance + topic references
βββ content-experimentation-best-practices/ # Experiment design + stats references
All skills use references/ for detailed content loaded on demand. The sanity-best-practices references are also the canonical source for the MCP server's Sanity rules.
Resources
- Create Sanity account
- Sanity documentation
- GROQ language reference
- Visual Editing guide
- Sanity TypeGen
- MCP server docs
- Blueprints Infrastructure as Code
Contributing
Found a better pattern? Missing a framework or best practice? Read the contributing guide for how skills work and what makes a good contribution, then:
- Fork the repo.
- Install dependencies with
npm install. - Make your changes in
skills/<skill-name>/. - Run
npm run validate:allto check skill and plugin validity. - Submit a PR.
Support
License: MIT
