Sanity MCP connector
OAuth 2.1/DCR Developer ToolsFiles & DocumentsProductivityConnect to Sanity. Manage structured content, documents, datasets, schemas, releases, and media assets for headless CMS workflows.
Sanity MCP connector
-
Install the SDK
Section titled “Install the SDK”Terminal window npm install @scalekit-sdk/nodeTerminal window pip install scalekit -
Set your credentials
Section titled “Set your credentials”Add your Scalekit credentials to your
.envfile. Find values in app.scalekit.com > Developers > API Credentials..env SCALEKIT_ENVIRONMENT_URL=<your-environment-url>SCALEKIT_CLIENT_ID=<your-client-id>SCALEKIT_CLIENT_SECRET=<your-client-secret> -
Authorize and make your first call
Section titled “Authorize and make your first call”quickstart.ts import { ScalekitClient } from '@scalekit-sdk/node'import 'dotenv/config'const scalekit = new ScalekitClient(process.env.SCALEKIT_ENV_URL,process.env.SCALEKIT_CLIENT_ID,process.env.SCALEKIT_CLIENT_SECRET,)const actions = scalekit.actionsconst connector = 'sanitymcp'const identifier = 'user_123'// Generate an authorization link for the userconst { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })console.log('Authorize Sanity MCP:', link)process.stdout.write('Press Enter after authorizing...')await new Promise(r => process.stdin.once('data', r))// Make your first callconst result = await actions.executeTool({connector,identifier,toolName: 'sanitymcp_list_organizations',toolInput: {},})console.log(result)quickstart.py import osfrom scalekit.client import ScalekitClientfrom dotenv import load_dotenvload_dotenv()scalekit_client = ScalekitClient(env_url=os.getenv("SCALEKIT_ENV_URL"),client_id=os.getenv("SCALEKIT_CLIENT_ID"),client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"),)actions = scalekit_client.actionsconnection_name = "sanitymcp"identifier = "user_123"# Generate an authorization link for the userlink_response = actions.get_authorization_link(connection_name=connection_name,identifier=identifier,)print("Authorize Sanity MCP:", link_response.link)input("Press Enter after authorizing...")# Make your first callresult = actions.execute_tool(tool_input={},tool_name="sanitymcp_list_organizations",connection_name=connection_name,identifier=identifier,)print(result)
What you can do
Section titled “What you can do”Connect this agent connector to let your agent:
- Whoami records — Get the currently authenticated Sanity user profile
- Document version unpublish, version replace — Unpublish a versioned document from a release
- Discard version — Discard document versions associated with a release
- Update dataset — Update the access control mode or description of an existing Sanity dataset
- Documents unpublish, publish — Unpublish one or more documents to revert them to draft state
- Image transform, generate — Apply an AI transformation to an image field in a Sanity document
Tool list
Section titled “Tool list”Use the exact tool names from the Tool list below when you call execute_tool. If you’re not sure which name to use, list the tools available for the current user first.
sanitymcp__get_ui_context
#
Get the current UI context including the active document and workspace in Sanity Studio. 5 params
Get the current UI context including the active document and workspace in Sanity Studio.
resource object required No description. documentId string optional Sanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published). documentType string optional Schema type name of the document. maxRefDepth integer optional Maximum reference depth to follow when resolving document references. workspaceName string optional Sanity workspace name. Defaults to the default workspace. sanitymcp_add_cors_origin
#
Add a CORS origin to allow browser-based API access for a Sanity project. 4 params
Add a CORS origin to allow browser-based API access for a Sanity project.
origin string required CORS origin URL to allow (e.g. https://myapp.com). resource object required No description. allowCredentials boolean optional Whether to allow credentials (cookies) from this CORS origin. intent string optional Brief description of what you are trying to accomplish. sanitymcp_create_dataset
#
Create a new dataset in a Sanity project with the specified access control mode. 5 params
Create a new dataset in a Sanity project with the specified access control mode.
datasetName string required Name of the Sanity dataset. resource object required No description. aclMode string optional Dataset access control mode: public or private. description string optional Human-readable description. intent string optional Brief description of what you are trying to accomplish. sanitymcp_create_documents_from_json
#
Create one or more Sanity documents from a JSON array of document objects. 5 params
Create one or more Sanity documents from a JSON array of document objects.
documents array required Array of documents to create. Each document must have a type and content. resource object required Resource information indicating which project ID and dataset to target intent string optional Brief description of what you are trying to accomplish. releaseId string optional ID of the release to target. workspaceName string optional Sanity workspace name. Defaults to the default workspace. sanitymcp_create_documents_from_markdown
#
Create one or more Sanity documents from Markdown content. 5 params
Create one or more Sanity documents from Markdown content.
documents array required Array of documents to create. Each document must have a type and Markdown content. resource object required Resource information indicating which project ID and dataset to target intent string optional Brief description of what you are trying to accomplish. releaseId string optional ID of the release to target. workspaceName string optional Sanity workspace name. Defaults to the default workspace. sanitymcp_create_project
#
Create a new Sanity project with optional CORS origin and organization. 5 params
Create a new Sanity project with optional CORS origin and organization.
displayName string required Display name for the Sanity project. organizationId string required Sanity organization ID to create the project under. allowCredentials boolean optional Whether to allow credentials (cookies) from this CORS origin. corsOrigin string optional CORS origin URL for the new project. intent string optional Brief description of what you are trying to accomplish. sanitymcp_create_release
#
Create a new content release for scheduling or grouping document publications. 6 params
Create a new content release for scheduling or grouping document publications.
resource object required Resource information indicating which project ID and dataset to target title string required Title of the release. description string optional Human-readable description. intendedPublishAt string optional ISO 8601 datetime when the release is scheduled to publish. intent string optional Brief description of what you are trying to accomplish. releaseType string optional Type of release: scheduled, immediate, or undecided. sanitymcp_create_version
#
Create versioned copies of documents and associate them with a release. 4 params
Create versioned copies of documents and associate them with a release.
documentIds array required Array of document IDs to create versions for (min 1, max 10) releaseId string required ID of the release to target. resource object required Resource information indicating which project ID and dataset to target intent string optional Brief description of what you are trying to accomplish. sanitymcp_deploy_schema
#
Deploy a schema declaration to a Sanity project workspace. 4 params
Deploy a schema declaration to a Sanity project workspace.
resource object required Resource information indicating which project ID and dataset to target schemaDeclaration string required Sanity schema configuration declaration string. intent string optional Brief description of what you are trying to accomplish. workspaceName string optional Sanity workspace name. Defaults to the default workspace. sanitymcp_deploy_studio
#
Deploy a Sanity Studio to a hosted app subdomain. 5 params
Deploy a Sanity Studio to a hosted app subdomain.
appHost string required Subdomain hostname for the deployed Sanity Studio. resource object required Resource information indicating which project ID and dataset to target intent string optional Brief description of what you are trying to accomplish. title string optional Title of the release. workspaceName string optional Sanity workspace name. Defaults to the default workspace. sanitymcp_discard_drafts
#
Discard draft versions of one or more documents. 3 params
Discard draft versions of one or more documents.
ids array required Document IDs to discard drafts for resource object required Resource information indicating which project ID and dataset to target intent string optional Brief description of what you are trying to accomplish. sanitymcp_generate_image
#
Generate an image for a document field using an AI instruction. 6 params
Generate an image for a document field using an AI instruction.
documentId string required Sanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published). imagePath string required Path to the image field within the document. instruction string required Natural language instruction for the image transformation. resource object required Resource information indicating which project ID and dataset to target intent string optional Brief description of what you are trying to accomplish. workspaceName string optional Sanity workspace name. Defaults to the default workspace. sanitymcp_get_document
#
Retrieve a single Sanity document by its ID. 3 params
Retrieve a single Sanity document by its ID.
documentId string required Sanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published). resource object required Resource information indicating which project ID and dataset to target intent string optional Brief description of what you are trying to accomplish. sanitymcp_get_project_studios
#
List all Sanity Studios deployed for a project. 2 params
List all Sanity Studios deployed for a project.
resource object required No description. intent string optional Brief description of what you are trying to accomplish. sanitymcp_get_sanity_rules
#
Load one or more Sanity content rules by name. 2 params
Load one or more Sanity content rules by name.
rules array required One or more rule names to load. Use list_sanity_rules to see available rules. intent string optional Brief description of what you are trying to accomplish. sanitymcp_get_schema
#
Retrieve the schema for a specific document type in a workspace. 4 params
Retrieve the schema for a specific document type in a workspace.
resource object required Resource information indicating which project ID and dataset to target intent string optional Brief description of what you are trying to accomplish. type string optional Document schema type name. workspaceName string optional Sanity workspace name. Defaults to the default workspace. sanitymcp_list_datasets
#
List all datasets in a Sanity project. 2 params
List all datasets in a Sanity project.
resource object required No description. intent string optional Brief description of what you are trying to accomplish. sanitymcp_list_embeddings_indices
#
List all embeddings indices available in a Sanity project. 2 params
List all embeddings indices available in a Sanity project.
resource object required Resource information indicating which project ID and dataset to target intent string optional Brief description of what you are trying to accomplish. sanitymcp_list_organizations
#
List all Sanity organizations the authenticated user belongs to. 1 param
List all Sanity organizations the authenticated user belongs to.
intent string optional Brief description of what you are trying to accomplish. sanitymcp_list_projects
#
List all Sanity projects the authenticated user has access to. 1 param
List all Sanity projects the authenticated user has access to.
intent string optional Brief description of what you are trying to accomplish. sanitymcp_list_releases
#
List content releases for a project with optional state filtering and pagination. 5 params
List content releases for a project with optional state filtering and pagination.
resource object required Resource information indicating which project ID and dataset to target intent string optional Brief description of what you are trying to accomplish. limit integer optional Maximum number of items to return. offset integer optional Number of items to skip for pagination. state string optional Filter releases by state: active, archived, or published. sanitymcp_list_sanity_rules
#
List all available Sanity content rule names. 1 param
List all available Sanity content rule names.
intent string optional Brief description of what you are trying to accomplish. sanitymcp_list_workspace_schemas
#
List all schema types defined in a Sanity workspace. 2 params
List all schema types defined in a Sanity workspace.
resource object required Resource information indicating which project ID and dataset to target intent string optional Brief description of what you are trying to accomplish. sanitymcp_migration_guide
#
Retrieve a Sanity migration guide by name. 2 params
Retrieve a Sanity migration guide by name.
guide string required Name of the migration guide to retrieve. intent string optional Brief description of what you are trying to accomplish. sanitymcp_patch_document_from_json
#
Apply set, unset, or append patch operations to a document using JSON. 8 params
Apply set, unset, or append patch operations to a document using JSON.
documentId string required Sanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published). resource object required Resource information indicating which project ID and dataset to target append array optional Append patch operations: adds items to the end of existing array fields. intent string optional Brief description of what you are trying to accomplish. releaseId string optional ID of the release to target. set array optional Set patch operations: replaces field values at the specified document paths. unset array optional Unset patch operations: removes fields or array items at the specified paths. workspaceName string optional Sanity workspace name. Defaults to the default workspace. sanitymcp_patch_document_from_markdown
#
Patch a document field with Markdown content converted to Sanity portable text. 7 params
Patch a document field with Markdown content converted to Sanity portable text.
documentId string required Sanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published). markdown string required Markdown content to patch into the document. path string required Document field path to target. resource object required Resource information indicating which project ID and dataset to target intent string optional Brief description of what you are trying to accomplish. releaseId string optional ID of the release to target. workspaceName string optional Sanity workspace name. Defaults to the default workspace. sanitymcp_publish_documents
#
Publish one or more draft documents to make them publicly visible. 3 params
Publish one or more draft documents to make them publicly visible.
ids array required IDs of the documents to publish resource object required Resource information indicating which project ID and dataset to target intent string optional Brief description of what you are trying to accomplish. sanitymcp_query_documents
#
Execute a GROQ query against the Sanity dataset and return matching documents. 7 params
Execute a GROQ query against the Sanity dataset and return matching documents.
query string required GROQ query string to execute. resource object required Resource information indicating which project ID and dataset to target intent string optional Brief description of what you are trying to accomplish. limit integer optional Maximum number of items to return. params object optional Optional parameters for the GROQ query perspective string optional Query perspective: published, previewDrafts, or raw. single boolean optional Return a single result instead of an array. sanitymcp_read_docs
#
Read a Sanity documentation page by URL or path. 3 params
Read a Sanity documentation page by URL or path.
intent string optional Brief description of what you are trying to accomplish. path string optional Document field path to target. url string optional URL of the Sanity documentation page to read. sanitymcp_search_docs
#
Search Sanity documentation by keyword query. 3 params
Search Sanity documentation by keyword query.
query string required GROQ query string to execute. intent string optional Brief description of what you are trying to accomplish. limit integer optional Maximum number of items to return. sanitymcp_semantic_search
#
Perform a semantic similarity search against a Sanity embeddings index. 5 params
Perform a semantic similarity search against a Sanity embeddings index.
indexName string required Name of the embeddings index to search. query string required GROQ query string to execute. resource object required Resource information indicating which project ID and dataset to target intent string optional Brief description of what you are trying to accomplish. limit integer optional Maximum number of items to return. sanitymcp_transform_image
#
Apply an AI transformation to an image field in a Sanity document. 6 params
Apply an AI transformation to an image field in a Sanity document.
documentId string required Sanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published). imagePath string required Path to the image field within the document. instruction string required Natural language instruction for the image transformation. resource object required Resource information indicating which project ID and dataset to target intent string optional Brief description of what you are trying to accomplish. workspaceName string optional Sanity workspace name. Defaults to the default workspace. sanitymcp_unpublish_documents
#
Unpublish one or more documents to revert them to draft state. 3 params
Unpublish one or more documents to revert them to draft state.
ids array required IDs of the documents to unpublish (published document IDs only) resource object required Resource information indicating which project ID and dataset to target intent string optional Brief description of what you are trying to accomplish. sanitymcp_update_dataset
#
Update the access control mode or description of an existing Sanity dataset. 4 params
Update the access control mode or description of an existing Sanity dataset.
resource object required Resource information indicating which project ID and dataset to target aclMode string optional Dataset access control mode: public or private. description string optional Human-readable description. intent string optional Brief description of what you are trying to accomplish. sanitymcp_version_discard
#
Discard document versions associated with a release. 4 params
Discard document versions associated with a release.
ids array required Document IDs to discard from the release releaseId string required ID of the release to target. resource object required Resource information indicating which project ID and dataset to target intent string optional Brief description of what you are trying to accomplish. sanitymcp_version_replace_document
#
Replace a versioned document with the content of a source document. 6 params
Replace a versioned document with the content of a source document.
id string required Sanity document ID. releaseId string required ID of the release to target. resource object required Resource information indicating which project ID and dataset to target sourceDocumentId string required ID of the source document to replace from. type string required Must be version.replace for this operation. intent string optional Brief description of what you are trying to accomplish. sanitymcp_version_unpublish_document
#
Unpublish a versioned document from a release. 4 params
Unpublish a versioned document from a release.
id string required Sanity document ID. releaseId string required ID of the release to target. resource object required Resource information indicating which project ID and dataset to target intent string optional Brief description of what you are trying to accomplish. sanitymcp_whoami
#
Get the currently authenticated Sanity user profile. 1 param
Get the currently authenticated Sanity user profile.
intent string optional Brief description of what you are trying to accomplish.