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
    • 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
Build with AI
Overview

  • Get started
  • MCP Server

    MCP setup and introduction

  • Libraries and resources

    Agent Toolkit

  • Add AI to your Sanity Apps

    Explore Agent Actions
    Add AI Assist to Sanity Studio

On this page

Previous

Build with AI

Next

MCP setup and introduction

Was this page helpful?

On this page

  • Configure the MCP server
  • Add best practice rules and skills
  • Leveraging documentation content
  • Leveraging Sanity Learn content
Build with AILast 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