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.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.
Agent Surfaces
Machine-Readable Metadata
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. |