Sanity logosanity.ioAll Systems Operational© Sanity 2026
Change Site Theme
Sanity logo

Documentation

    • Overview
    • Platform introduction
    • Next.js quickstart
    • Nuxt.js quickstart
    • Astro quickstart
    • React Router quickstart
    • Studio quickstart
    • Build with AI
    • Content Lake
    • Functions
    • APIs and SDKs
    • Agent Actions
    • Visual Editing
    • Blueprints
    • Platform management
    • Dashboard
    • Studio
    • Canvas
    • Media Library
    • App SDK
    • Content Agent
    • HTTP API
    • CLI
    • Libraries
    • Specifications
    • Changelog
    • User guides
    • Developer guides
    • Courses and certifications
    • Join the community
    • Templates
Developer guides
Overview

  • Develop with AI

    Best practices

  • Query optimization

    Paginating with GROQ
    High performance GROQ

  • Roles and authentication

    Setting up Single Sign-On with SAML
    Third-Party Login (Deprecated)
    OAuth2
    Set up SSO authentication with SAML and Azure/Entra ID
    Set up SSO authentication with SAML and PingIdentity
    Set up SSO authentication with SAML and JumpCloud
    Reconcile users against internal systems
    Restrict Access to Specific Documents
    Setting up a Default Relay State for IdP Initiated - SAML Logins

  • Structured content

    Scalable navigation patterns
    An opinionated guide to Sanity Studio
    Browsing Content How You Want with Structure Builder
    Deciding on fields and relationships
    Create richer array item previews
    Dynamic folder structure using the currentUser and workflow states
    Create a time duration object field
    Level up Your Edit Modal with Next/Previous Navigation Buttons for Array Items
    Create a “coupon generator” string field input
    Managing redirects with Sanity
    Create a document form progress component
    Create an array input field with selectable templates
    Creating a Parent/Child Taxonomy
    Create interactive array items for featured elements
    Create a visual string selector field input
    Create a survey rating number field input
    How to use structured content for page building
    Create a recycling bin for deleted documents via Sanity Functions

  • Frontend integration

    Add live content to your application
    Forms with Sanity
    Vercel Integration
    Build your blog with Astro and Sanity
    How to implement front-end search with Sanity

  • Ecommerce

    Displaying Sanity content in Shopify
    Sanity Connect for Shopify
    Custom sync handlers for Sanity Connect

  • Integrating with other services

    A/B testing with Sanity and Growthbook
    Cookie consent integrations with Sanity
    Integrating external data sources with Sanity
    Klaviyo (email campaigns)
    Developing with Next.js on GitHub Codespaces

  • Adopting Sanity

    How to pitch Sanity.io to your team
    Convincing your clients to go with Sanity.io, rather than a traditional CMS
    Not-profit plan
    Agencies: Navigating the Spring 2025 Organization Changes
    How to generate massive amounts of demo content for Sanity
    How to implement Multi-tenancy with Sanity

  • GROQ

    GROQ-Powered Webhooks – Intro to Filters
    GROQ-Powered Webhooks – Intro to Projections

  • Portable Text

    Presenting Portable Text
    Add Inline blocks for the Portable Text Editor
    Beginners guide to Portable Text
    How to add custom YouTube blocks to Portable Text
    Converting Inline Styles to Sanity Block Decorators
    Add things to Portable Text
    Change the height of the PTE

  • Community and ecosystem

    Create your own Sanity template
    Community guides
    Community Code of Conduct
    Contribute to the ecosystem

  • Plugin development

    Migrating plugins to support Content Releases

On this page

Next

Developer guides

Was this page helpful?

On this page

  • Configure the MCP server
  • Add best practice rules and skills
  • Leveraging documentation content
  • Leveraging Sanity Learn content
Developer guidesLast updated January 29, 2026

Get started with AI-powered Sanity development

Set up the Sanity Agent Toolkit and MCP server to help AI assistants generate high-quality Sanity code that follows established best practices.

AI tools can dramatically accelerate Sanity development, but without proper guidance, they often produce generic code that fails to leverage Sanity's full capabilities.

This guide will help you:

  • Set up AI tools to generate high-quality Sanity code.
  • Avoid common pitfalls of AI-generated configurations.
  • Implement best practices from Sanity into your AI workflow.

Configure the MCP server

The fastest way to connect your AI tools to Sanity is with the Sanity MCP server. Run the following command to automatically detect and configure the MCP server for Cursor, Claude Code, and VS Code:

npx sanity@latest mcp configure
pnpm dlx sanity@latest mcp configure
yarn dlx sanity@latest mcp configure
bunx sanity@latest mcp configure

This detects and configures the MCP server automatically. See the MCP server documentation for manual configuration options and troubleshooting. If you’re starting a new project with sanity init, the CLI will help you set up the MCP server as part of the setup steps.

Add best practice rules and skills

The Sanity Agent Toolkit is a collection of resources to help AI agents build better with Sanity.

It includes:

  • 20+ context rules covering schema design, GROQ, Visual Editing, SEO, localization, migrations, and framework integrations.
  • Claude Code plugin with slash commands and interactive skills for common workflows.
  • Knowledge router (AGENTS.md) that directs AI to the right guidance based on task keywords.

You can also install skills directly by running the following command from your project directory:

npx skills add sanity-io/agent-toolkit
pnpm dlx skills add sanity-io/agent-toolkit
yarn dlx skills add sanity-io/agent-toolkit
bunx skills add sanity-io/agent-toolkit

Leveraging documentation content

The Sanity documentation has several ways you can use AI to get the job done:

  • For quick, specific reference: Use the Copy article button on all articles that puts the markdown version of the content on your clipboard. You can also add .md at the end of any article URL to get the markdown version.
  • For comprehensive context: You can point LLMs to /docs/llms.txt and /docs/llms-full.txt to access all the links and the full corpus as markdown formatted content.
  • For interactive queries: Use the MCP server's search_docs and read_docs tools.
  • For CLI-based work: You can even tell LLMs to use sanity docs search and sanity docs read to find docs articles.

In tools like Cursor that support local docs, you can add the Sanity Docs and Learn materials directly by typing @Docs in their agent chats.

Leveraging Sanity Learn content

All course and lesson material on Sanity Learn is also available in the LLM-friendly llms.txt standard. You can read how we made this on our blog.

There are two different sizes you can import into your IDE:

  • /llms.txt is an abbreviated index of all the content with links.
  • /llms-full.txt is the complete content (sometimes optimized to fit within the context window limits).
npx sanity@latest mcp configure
pnpm dlx sanity@latest mcp configure
yarn dlx sanity@latest mcp configure
bunx sanity@latest mcp configure
npx sanity@latest mcp configure
pnpm dlx sanity@latest mcp configure
yarn dlx sanity@latest mcp configure
bunx sanity@latest mcp configure
npx skills add sanity-io/agent-toolkit
pnpm dlx skills add sanity-io/agent-toolkit
yarn dlx skills add sanity-io/agent-toolkit
bunx skills add sanity-io/agent-toolkit
npx skills add sanity-io/agent-toolkit
pnpm dlx skills add sanity-io/agent-toolkit
yarn dlx skills add sanity-io/agent-toolkit
bunx skills add sanity-io/agent-toolkit