What You'll Build
An AI-powered content management system workflow that uses Continue’s AI agent with Sanity
MCP to manage schemas, execute GROQ queries, handle migrations, and maintain documentation - all through simple natural language prompts
Prerequisites
Before starting, ensure you have:- Continue account with Hub access
- Read: Understanding Agents — How to get started with Hub agents
- Node.js 20+ installed locally
- A Sanity account and project (free tier works)
- Basic understanding of content management systems
1
Install Continue CLI
2
Install Sanity CLI
To use agents in headless mode, you need a Continue API key and proper environment variable configuration.
Getting Started with Sanity
New to Sanity? Start Here
New to Sanity? Start Here
New to Sanity? Follow the Sanity Getting Started Guide to set up your first project.Quick setup:Key resources:
- Sanity Studio - Content editing interface
- Schema Types - Define content structure
- GROQ - Query language for fetching content
- Content Lake - Real-time data store
Sanity MCP Workflow Options
Fastest Path to Success
Skip the manual setup and use our pre-built Sanity Assistant agent that includes
the Sanity MCP and optimized content management workflows for more consistent results. You can remix this agent to customize it for your specific needs.
- ⚡ Quick Start (Recommended)
- 🛠️ Manual Setup
1
Load the Pre-Built Agent
Visit the Sanity Agent Config on Continue Hub and click “Install Agent” or run:This agent includes:
- Sanity MCP pre-configured and ready to use
- Content management rules for best practices
- Schema optimization guidelines
2
Your First MCP Conversation
Start with these beginner-friendly prompts to explore your content:That’s it! The agent handles everything automatically. For more starter prompts and examples, see the official Sanity MCP blog post.
Why Use the Agent? The pre-built Sanity Assistant agent provides consistent content management workflows and handles MCP configuration automatically, making it easier to get started with AI-powered CMS operations. Results are more consistent and debugging is easier thanks to the Sanity MCP integration and pre-tested prompts.
Agent Requirements
Agent Requirements
To use the pre-built Sanity Assistant agent, you need either:
- Continue CLI Pro Plan with the models add-on, OR
- Your own API keys added to Continue Hub secrets
Sanity MCP Capabilities
Understanding the Capabilities
Sanity MCP provides comprehensive tools for content management:
- Execute GROQ queries to fetch and analyze content
- Explore and modify document schemas
- Manage content releases and versions
- Handle content migrations between environments
- Automate documentation generation
- Perform bulk content operations
- Manage localization and translations
Your First MCP Conversation
With everything set up, you’re ready for your first AI-powered content conversation! Try these beginner-friendly starter prompts:Content Discovery
Content Creation
Content Updates
Content Scheduling
New to MCP? These prompts demonstrate the power of natural language content management. For more examples and detailed explanations, check out the official Sanity MCP blog post.
Content Management Recipes
Now you can use natural language prompts to manage your Sanity content and schemas. The Continue agent automatically calls the appropriate Sanity MCP tools.You can add prompts to your agent’s configuration for easy access in future sessions. Go to your agent in the Continue Hub, click Edit, and add prompts under the Prompts section.
Where to run these workflows:
- IDE Extensions: Use Continue in VS Code, JetBrains, or other supported IDEs
- Terminal (TUI mode): Run
cn
to enter interactive mode, then type your prompts - CLI (headless mode): Use
cn -p "your prompt"
for headless commands
About the —auto flag: The
--auto
flag enables tools to run continuously without manual confirmation. This is essential for headless mode where the agent needs to execute multiple tools automatically to complete tasks like schema exploration, GROQ execution, and content migration.Schema Management
Explore Document Types
Review and understand your content schema structure.TUI Mode Prompt:Headless Mode Prompt:
GROQ Queries
Execute GROQ Queries
Run GROQ queries to fetch and analyze content.TUI Mode Prompt:Headless Mode Prompt:
Content Operations
Bulk Content Updates
Perform bulk operations on your content.TUI Mode Prompt:Headless Mode Prompt:
Localization
Add Localization Support
Set up and manage content translations.TUI Mode Prompt:Headless Mode Prompt:
Content Migration
Migrate Content Structure
Migrate content between different schemas or environments.TUI Mode Prompt:Headless Mode Prompt:
Documentation Generation
Generate Schema Documentation
Automatically generate documentation for your content model.TUI Mode Prompt:Headless Mode Prompt:
Content Releases
Manage Content Releases
Work with Sanity’s content release feature.TUI Mode Prompt:Headless Mode Prompt:
Performance Analysis
Analyze Query Performance
Optimize GROQ queries for better performance.TUI Mode Prompt:Headless Mode Prompt:
Continuous Content Management with GitHub Actions
This example demonstrates a Continuous AI workflow where content validation and schema checks run automatically in your CI/CD pipeline in headless mode using the Sanity agent config. Consider remixing this agent to add your organization’s specific content governance rules.Add GitHub Secrets
Navigate to Repository Settings → Secrets and variables → Actions and add:CONTINUE_API_KEY
: Your Continue API key from hub.continue.dev/settings/api-keysSANITY_PROJECT_ID
: Your Sanity project IDSANITY_DATASET
: Your Sanity dataset name (usually “production”)SANITY_API_TOKEN
: Your Sanity API token with appropriate permissionsMCP_USER_ROLE
: Your MCP user role (typically “admin” or “editor”)
The workflow uses the Sanity Agent Config with environment variable authentication via Sanity MCP Config. This enables headless mode operation without OAuth browser authentication.
Create Workflow File
This workflow automatically validates your Sanity schemas and content on pull requests using the Continue CLI in headless mode. It checks schema integrity, validates content relationships, and posts a summary report as a PR comment. Create.github/workflows/sanity-content-validation.yml
in your repository:
Environment variables enable the MCP to authenticate without OAuth browser prompts. The Sanity MCP Config documentation provides detailed setup instructions for all required variables.
Content Management Best Practices
Implement automated content quality checks using Continue’s rule system. See the Rules deep dive for authoring tips.Schema Validation
Content Consistency
Query Optimization
Localization Standards
Troubleshooting
Authentication Issues
Schema Not Found
GROQ Query Errors
Migration Conflicts
Verification Steps:
- Sanity MCP is installed via Continue Hub
- Project is authenticated with Sanity
- Schema files are present and valid
- Dataset permissions are correctly configured
What You’ve Built
After completing this guide, you have a complete AI-powered content management system that:- ✅ Uses natural language — Simple prompts instead of complex CMS commands
- ✅ Manages schemas automatically — AI handles schema evolution and migrations
- ✅ Runs continuously — Automated validation in CI/CD pipelines
- ✅ Ensures quality — Content checks prevent broken references and invalid data
Continuous AI
Your content management workflow now operates at Level 2 Continuous
AI -
AI handles routine content operations and schema management with human oversight
through review and approval of changes.
Next Steps
- Explore your schema - Try the schema exploration prompt on your current project
- Run GROQ queries - Use natural language to query your content
- Set up CI validation - Add the GitHub Actions workflow to your repo
- Create documentation - Generate comprehensive docs for your content model
- Optimize performance - Analyze and improve query performance