Connectors

Sanity

Let Lyna AI query and edit your Sanity content, manage releases and deploy schemas while it builds your content screens.

Connect your Sanity account so Lyna AI can read your real content and schema, build screens that match them, and save content changes as drafts for you to publish.

What it lets you do

  • Run GROQ queries with knowledge of your schema.
  • Create and edit documents, saved as drafts or release versions.
  • Create content releases.
  • Deploy schemas, and manage datasets and CORS origins.
  • Upload assets and work with the Media Library.
  • Search semantically, and look up the Sanity docs.
ItemDetail
What it asks forA sign-in on Sanity's page.
Who pays the providerYou, through your own Sanity plan. Image generation and transformation use AI credits.
Do actions change real data?Yes, as drafts or release versions. An edit never goes straight to published content.
Where it runsOn Sanity's servers.
Who uses itLyna AI while it builds, in Build mode. Your published app can use it too: Use a connector in your app.

What you need before you start

  • A Sanity account with access to your project and dataset, and the role the task needs (see below).
  • Some roles exist only on the Growth and Enterprise plans. Administrator and Viewer exist on every plan.
  • Edit access to your Lyna project.

Permissions in Sanity

A sign-in works with your own role. A token you add yourself is limited to the role of that token (see Ways to connect). Whatever the role, edits land on a draft or a release version, never directly on published content.

TaskWhat you need
Read documents in every datasetViewer or higher
Write drafts, with no way to publishContributor (Growth and Enterprise)
Read and write documents in every datasetEditor or Developer (Growth and Enterprise), or Administrator
Change an existing datasetEditor or Administrator
Create a datasetAdministrator. An Editor cannot
Change every project settingAdministrator

See Sanity's roles.

Ways to connect

On the connector's page. A sign-in on Sanity's own page. Lyna stores it encrypted. Only the owner can sign in again.

Who owns the account? The person who signed in. Every call goes out as that person's Sanity account, whoever typed the request.

Who can use it? Only you, in the projects you link it to, until you change it. On the connector's page, Who can use it also offers Only this project and The whole workspace. See Who can use a connection.

A token limited to one role. In Connectors, choose Add custom, then Custom server. Give it a name, paste https://mcp.sanity.io in Server address, set How it signs in to Key or token, paste the value, and choose Add and test. The calls are then limited to the role of that token, which you create at sanity.io/manage.

Set it up

  1. Open the connector

    Open the + menu of the chat and choose Connectors. Find Sanity with the search field or under Content and media, then open its page.

  2. Connect

    Choose Connect. The New connection page opens and reads "Sign in with your Sanity account to connect." Choose Connect at the bottom of the page. Sharing, just above, sets who can use it.

  3. Sign in

    A new window opens on Sanity's own page. If your browser blocks the window, the page goes to the sign-in in the same tab and brings you back after. Sign in and approve the access.

  4. Read the result

    The page tests the connection and shows the result. Connected means Lyna can use it.

This connector shows no field to fill in: everything you give, you give on Sanity's own page.

Check it works

After you choose Connect, the page tests the connection and shows the result. Run it again at any time with Test connection. Connected proves that Sanity's server answered, accepted your sign-in and listed its tools. A pass does not prove access to every piece of data. It works with your role and permissions on each project and dataset, and a missing tool can point to a missing permission.

To check for real, ask for something you know exists:

  • "Who am I signed in as on Sanity? List 3 documents from my main dataset."

What to ask Lyna AI

Type these in the chat, in Build mode, and adjust the names to yours. Once it is connected, Use Sanity on its page starts a message for you.

What you build or doWhat to typeWhat happens
Build from your schema"Read my Sanity schema and build a blog index page from the post type."Lyna AI reads the schema and builds the page.
Fill content gaps"Find every post with no description and draft one for each, in a new release."After your approval, drafts wait in the release. Nothing is published.
Understand a project"List the datasets of my Sanity project and tell me which one has the most documents."It reads the datasets and answers in the chat.
Add a content type"Add an FAQ type to my schema and deploy it."After your approval, the schema changes in your project.
Search by meaning"Find the articles about onboarding, even those that do not use the word."It runs a semantic search and lists them.
Translate a page"Draft a French version of the About page."After your approval, it saves a draft for you to review in Sanity Studio.
Add images"Upload this image and attach it to the Spring post."After your approval, the asset is in your project and the draft points to it.

Approvals and tool switches

Before a call, Lyna AI shows the tool and what it asks. You choose Deny, Allow once, Always allow this tool or Always allow this connector. A tool its server marks as read-only does not ask. A changed or new tool asks again, and Ask again on the connector's page takes a choice back.

Under What Lyna AI can use, each tool has a switch. Lyna AI stops using a tool you turn off, in your chats in this project.

Stay safe

What a connector answers reaches the AI as data, never as instructions. Read each approval before you accept it.

  • Treat that token as a secret. A personal token shares your role and links you to the changes in the revision history.
  • Your content stays unpublished until you publish it. Review the drafts in Sanity Studio first.
  • Custom validation rules are skipped through this connector, so check drafts before you publish.

Limits

  • A sign-in usually expires after 7 days, then you sign in again.
  • It cannot schedule, publish, archive or delete a release. Use Sanity Studio or the HTTP Actions API.
  • Edits go up to 25 documents per call, and a query result over 64 KiB is rejected.
  • A file upload is limited to 50 MiB.
  • See Sanity MCP server.
  • Connector tools run in Build mode. Plan and Ask do not run them.

Troubleshooting

What you seeWhat it means and what to do
Needs sign-inYour sign-in ended, or you revoked it at Sanity. Choose Connect and sign in again.
The sign-in window does not openYour browser blocked it, so the page goes to the sign-in in the same tab. If nothing happens, allow pop-ups for Lyna and choose Connect again.
No answer from the sign-in window yetIf the window is still open, finish there. If you closed it, choose Connect again.
The sign-in was cancelled.You closed or declined Sanity's page. Choose Connect and approve the access.
The service refused the sign-in.Check that you used the right account and that your organization allows this access, then choose Connect.
The sign-in took too long. Start it again.Choose Connect and sign in again.
The sign-in worked, but the server did not answer.Choose Test connection.
Not tested yetNo test has answered. Choose Test connection.
Connection failedThe page says why next to it. If the server did not answer, choose Test connection.
A call fails with a permission errorConnected does not prove access to every piece of data. Sanity refused the call with the rights of the account you connected. Check Permissions in Sanity above, then try again.
New tools to reviewThe server changed its list of tools, so Lyna stops using it until you decide. Read the list, then choose Approve new tools.
Turned offLyna AI does not use it. Choose Turn on.
It needs a new sign-in. Only the person who connected it can give one.Someone else connected it, and that sign-in ended. Ask that person to choose Connect.
The person who connected it left the workspaceThe connection holds no key or sign-in. Choose Connect to use it again.
A tool is missing or failsIt may be a permission on that project or dataset. Ask who you are signed in as first.
A 401 error with a tokenThe token may have expired or been revoked. Create a new one, then change it with Edit server under More options.

Disconnect

Turn off stops Lyna from using the connector and keeps your settings. Remove from this project, under More options, takes it out of this project only, and shows when another project uses it. Delete connection, in the same menu, removes it from every project, with what it stored, and says first how many projects lose it. If you used a token, delete it at sanity.io/manage as well.

Need help?

Ask the team, read what changed, or learn from the blog.