Was this page helpful?
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:
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.
The Sanity Agent Toolkit is a collection of resources to help AI agents build better with Sanity.
It includes:
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
The Sanity documentation has several ways you can use AI to get the job done:
.md at the end of any article URL to get the markdown version./docs/llms.txt and /docs/llms-full.txt to access all the links and the full corpus as markdown formatted content.search_docs and read_docs tools.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.
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 configurepnpm dlx sanity@latest mcp configureyarn dlx sanity@latest mcp configurebunx sanity@latest mcp configurenpx sanity@latest mcp configurepnpm dlx sanity@latest mcp configureyarn dlx sanity@latest mcp configurebunx sanity@latest mcp configurenpx skills add sanity-io/agent-toolkitpnpm dlx skills add sanity-io/agent-toolkityarn dlx skills add sanity-io/agent-toolkitbunx skills add sanity-io/agent-toolkitnpx skills add sanity-io/agent-toolkitpnpm dlx skills add sanity-io/agent-toolkityarn dlx skills add sanity-io/agent-toolkitbunx skills add sanity-io/agent-toolkit