
sanity
★ 161Claude Code plugin · sanity-io/agent-toolkit · MIT
Sanity plugin for Claude Code with MCP server, agent skills, agent rules, and slash commands.
7 skills · 4 slash commands · a bundled MCP server — installs as one unit
⌁ skills (7)
content-experimentation-best-practices
🔥🔥🔥🔥✓ VerifiedContent experimentation and A/B testing guidance covering experiment design, hypotheses, metrics, sample size, statistical foundations, CMS-managed variants, and common analysis pitfalls. Use this skill when planning experiments, setting up variants, choosing success metrics, interpreting statistical results, or building experimentation workflows in a CMS or frontend stack.
Full instructions & audit →content-modeling-best-practices
🔥🔥🔥🔥✓ VerifiedStructured content modeling guidance for schema design, content architecture, content reuse, references versus embedded objects, separation of concerns, and taxonomies across Sanity and other headless CMSes. Use this skill when designing or refactoring content types, deciding field shapes, debating reusable versus nested content, planning omnichannel content models, or reviewing whether a schema is too page-shaped or presentation-driven.
Full instructions & audit →portable-text-conversion
🔥🔥🔥✓ VerifiedConvert HTML and Markdown content into Portable Text blocks for Sanity. Use when migrating content from legacy CMSs, importing HTML or Markdown into Sanity, building content pipelines that ingest external content, converting rich text between formats, or programmatically creating Portable Text documents. Covers @portabletext/markdown (markdownToPortableText), @portabletext/block-tools (htmlToBlocks), custom deserializers, and the Portable Text specification for manual block construction.
Full instructions & audit →portable-text-serialization
🔥🔥🔥✓ VerifiedRender and serialize Portable Text to React, Svelte, Vue, Astro, HTML, Markdown, and plain text. Use when implementing Portable Text rendering in any frontend framework, building custom serializers for non-standard block types, converting Portable Text to HTML strings server-side, converting Portable Text to Markdown, extracting plain text from Portable Text, or troubleshooting rendering issues with marks, blocks, lists, or custom types.
Full instructions & audit →sanity-best-practices
🔥🔥🔥🔥✓ VerifiedSanity development best practices for schema design, GROQ queries, TypeGen, Visual Editing, images, Portable Text, Studio structure, localization, migrations, Sanity Functions, Blueprints, and framework integrations such as Next.js, Nuxt, Astro, Remix, SvelteKit, Angular, Hydrogen, and the App SDK. Use this skill whenever working with Sanity schemas, defineType or defineField, GROQ or defineQuery, content modeling, Presentation or preview setups, Sanity-powered frontend integrations, Sanity Func
Full instructions & audit →sanity-migration
🔥🔥🔥🔥✓ VerifiedPlans, implements, and reviews migrations from other CMSes and content systems into Sanity. Use when migrating or replatforming to Sanity from AEM, Adobe Experience Manager, Contentful, Strapi, Webflow, WordPress, Payload, Drupal, Markdown/MDX/frontmatter files, WXR/XML exports, CMS APIs, database dumps, static HTML, or when designing extraction, transformation, Portable Text conversion, asset migration, redirects, validation, and cutover workflows.
Full instructions & audit →seo-aeo-best-practices
🔥🔥🔥🔥✓ VerifiedSEO and AEO best practices for metadata, Open Graph, sitemaps, robots.txt, hreflang, JSON-LD structured data, EEAT, and content optimized for search engines and AI answer surfaces. Use this skill when implementing page SEO, technical SEO, schema markup, international SEO, AI-overview readiness, or improving content for Google, ChatGPT, Perplexity, and similar assistants.
Full instructions & audit →⌁ slash commands (4)
/deploy-schema/sanity/sanity-review/typegen⌁ also included
- A bundled MCP server configuration
Sanity Agent Toolkit
Collection of resources to help AI agents build better with Sanity. Supports Cursor, Claude Code, Codex, VS Code, Lovable, v0, Replit, OpenCode, 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. Available on the official Anthropic plugin marketplace.
- Cursor plugin: MCP server, agent skills, and commands on the Cursor Marketplace.
- Codex plugin: MCP server and agent skills for OpenAI Codex users.
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, Replit, OpenCode, 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 configureUses 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 userCodex
Run in terminal. Authenticate with OAuth on next launch:
codex mcp add Sanity --url https://mcp.sanity.ioOr manually add to ~/.codex/config.toml:
[mcp_servers.Sanity]
url = "https://mcp.sanity.io"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
Sanity is available as a prebuilt chat connector in Lovable:
- Open Connectors → Chat connectors
- Select Sanity
- Click Connect and sign in to authorize your Sanity account
In your next prompt, reference your Sanity project or ask the agent to read your schema.
See the Lovable MCP documentation or Sanity + Lovable guide for more details.
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"]
}
}
}Authorization and troubleshooting
Manual MCP configuration uses OAuth by default. You can use token auth instead by setting an Authorization: Bearer <token> header in the MCP config. If authentication fails after CLI setup, rerun npx sanity@latest mcp configure and restart your MCP client. For OAuth reset issues, Cursor provides Cursor: Clear All MCP Tokens and VS Code provides Authentication: Remove Dynamic Authentication Providers.
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-toolkitSee Option 3 for plugin installation.
Option 3: Install plugin
Install the Sanity plugin to get MCP server, agent skills, and commands. Available on the Claude Code marketplace and Cursor Marketplace.
Claude Code
The Sanity plugin is listed on the official Anthropic plugin marketplace. The official marketplace (claude-plugins-official) is pre-registered when you start Claude Code — you do not need to add a custom marketplace.
Install from Claude Code:
/plugin install sanity@claude-plugins-officialIf the plugin is not found, refresh the marketplace catalog and retry:
/plugin marketplace update claude-plugins-officialThen run /reload-plugins to activate without restarting.
Alternative: interactive install
- Run
/pluginand open the Discover tab - Search for Sanity
- Review what the plugin will install — commands, skills, hooks, and MCP servers — before confirming (Anthropic recommends reviewing plugin permissions and source before installing)
- Choose an installation scope:
- User (default): all projects on this machine
- Project: shared with collaborators via
.claude/settings.json - Local: this repository only
- Run
/reload-pluginsto activate without restarting
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
Install from the Cursor Marketplace by running this in Cursor chat:
/add-plugin sanityVerify installation: Ask Cursor: "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
Codex
- Add the Sanity marketplace:
codex plugin marketplace add sanity-io/agent-toolkit-
Install the plugin from Codex's plugin directory (select the Sanity Agent Toolkit marketplace, then install Sanity).
-
Restart Codex. Verify by asking: "which skills do you have access to?" — you should see the Sanity skills listed.
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— create draft documents from structured content, or version documents when a release ID is providedpatch_documents— surgical edits to existing documents; published documents are edited by creating or updating draftspublish_documents/unpublish_documents— manage document lifecycledeploy_schema/get_schema— deploy MCP-managed schemas and inspect deployed schemasdeploy_studio— deploy a hosted Studio bound to an MCP-managed schemacreate_release/list_releases— create and inspect Content Releasescreate_version— create version documents for releasesgenerate_image/transform_image— AI image generation and editingwhoami— verify the authenticated Sanity userget_project_studios— list Studio applications linked to a projectsearch_docs/read_docs— search and read Sanity documentationlist_sanity_rules/get_sanity_rules— load agent rules on demandgive_feedback— report MCP tool errors, missing capabilities, confusing output, or documentation issues
MCP-managed schemas are resolved before Studio-deployed and legacy schemas. If you deploy schema changes with deploy_schema, redeploy any matching MCP-managed Studio with deploy_studio so it picks up the latest schema. generate_image, transform_image, and create_version with an instruction consume Sanity AI credits.
See the full list of available tools.
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.
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
├── .agents/plugins/ # Codex marketplace
│ └── marketplace.json # Codex marketplace metadata
├── .claude-plugin/ # Claude Code plugin configuration (distributed via claude-plugins-official)
│ ├── plugin.json # Plugin manifest (name: sanity)
│ └── marketplace.json # Marketplace manifest for repo-based discovery
├── .codex-plugin/ # Codex plugin configuration
│ └── plugin.json # Codex plugin manifest
├── .cursor-plugin/ # Cursor plugin configuration (distributed via cursor.com/marketplace)
│ ├── 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
│ ├── sanity-review.md # /sanity-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 referencesAll 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
Support
License: MIT
In Claude Code, add the marketplace and install:
/plugin marketplace add sanity-io/agent-toolkit/plugin install sanityOne install gets you everything — 7 skills, 4 slash commands, a bundled MCP server — kept up to date together.
Licensed under MIT— you can use, modify, and redistribute it under that license's terms.
View the full license file on GitHub →