data
Sanity MCP, CLI, and Lua Integration for AI Agents
Sanity integration docs for AI agents: MCP gateway setup, Sanity CLI commands, Lua API reference, credentials, and function schemas.
7 functions 4 read 3 write API token auth
Sanity for agents
Credentials can be configured manually in web or CLI hosts.
Use this integration from Lua code mode, the headless integrations CLI, or the KosmoKrator MCP gateway. The same package metadata powers all three surfaces.
Machine-Readable Metadata
- integration_slug
sanity- route_slug
sanity- package
sanity- auth_strategy
api_tokenAPI token- cli_setup_supported
true- cli_runtime_supported
true- mcp_gateway_supported
true- lua_supported
true- supports_multi_account
true
Quick Links
Lua APIAgent-facing namespace and function reference. Sanity CLIHeadless setup and direct function calls. Sanity MCPMCP gateway setup for external clients. Submit feedbackReport missing tools, auth problems, wrong docs, or runtime issues. ContributeAdd tools or improve metadata in the integrations repo.
Sanity MCP Client Matrix
Use these pages when a specific agent client or framework needs copy-pasteable MCP setup for Sanity.
Claude Code Sanity MCP setup for Claude Code. Cursor Sanity MCP setup for Cursor. Codex Sanity MCP setup for Codex. OpenAI Agents Sanity MCP setup for OpenAI Agents SDK. Claude Agent SDK Sanity MCP setup for Claude Agent SDK. Vercel AI SDK Sanity MCP setup for Vercel AI SDK. LangChain Sanity MCP setup for LangChain. LangGraph Sanity MCP setup for LangGraph. CrewAI Sanity MCP setup for CrewAI. MCP clients Sanity MCP setup for Generic MCP Clients.
Sanity CLI Matrix
Use these pages for direct Sanity CLI workflows in scripts, CI, cron, and agent wrappers.
CI Sanity CLI for CI. Cron Jobs Sanity CLI for cron jobs. Shell Scripts Sanity CLI for shell scripts. Headless Automation Sanity CLI for headless automation. Coding Agents Sanity CLI for coding agents.
Function Catalog
| Function | Type | Parameters | Description |
|---|---|---|---|
sanity.sanity_query_documents | Read read | 2 | Query documents in Sanity using GROQ (Graph-Relational Object Queries). Returns matching documents with their fields. |
sanity.sanity_get_document | Read read | 1 | Retrieve a single Sanity document by its ID. Returns the full document with all fields. |
sanity.sanity_create_document | Write write | 1 | Create a new document in the Sanity dataset. The document data must include a _type field matching a schema type. |
sanity.sanity_update_document | Write write | 2 | Update an existing Sanity document by applying a patch with the specified fields. |
sanity.sanity_delete_document | Write write | 1 | Delete a document from the Sanity dataset by its ID. This action is permanent. |
sanity.sanity_list_projects | Read read | 0 | List all Sanity projects accessible to the authenticated user. Requires a management API token. |
sanity.sanity_get_current_user | Read read | 0 | Get the currently authenticated Sanity user. Useful for verifying credentials and checking user identity. |