Collection of resources to help AI agents build better with Sanity.
npx skills add https://github.com/sanity-io/agent-toolkit --skill sanity-best-practicesInstall this skill with the CLI and start using the SKILL.md workflow in your workspace.
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.
Choose your path based on how you want agents to work with Sanity:
Give agents direct access to Sanity projects and always up-to-date agent rules via the MCP server.
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.
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"
}
}
}
Run in terminal. Authenticate with OAuth on next launch:
claude mcp add Sanity -t http https://mcp.sanity.io --scope user
Open Command Palette (Cmd+Shift+P / Ctrl+Shift+P) → MCP: Open User Configuration → add:
{
"servers": {
"Sanity": {
"type": "http",
"url": "https://mcp.sanity.io"
}
}
}
Settings → Connectors → Personal connectors → New MCP server → Enter Sanity as name and https://mcp.sanity.io as Server URL → Add & authorize → Authenticate with OAuth.
In the prompt input field, click Prompt Tools → MCPs → Add New → Select Sanity → Authorize → Authenticate with OAuth.
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.
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
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.
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.
Install the Sanity plugin to get MCP server, agent skills, and commands.
/plugin marketplace add sanity-io/agent-toolkit
/plugin install sanity-plugin@sanity-agent-toolkit
You should see the Sanity skills listed.
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.
In Cursor chat, run:
/add-plugin sanity
Install the skill references locally to teach your editor Sanity best practices:
skills/sanity-best-practices/ to your project.AGENTS.md to your project root to act as a knowledge router.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 demandSee the full list of available tools.
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 |
The onboarding guide follows three phases:
Just say: "Get started with Sanity" to begin.
| 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 |
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.
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:
npm install.skills/<skill-name>/.npm run validate:all to check skill and plugin validity.License: MIT