How to use Claude Code with a headless CMS

By: Irina Shvaya | October 14, 2026
This article is part of our Claude Code Guide: what Claude Code is, how to use it safely on a business website, and how to budget for and choose help. Want it set up for your team? See Claude Code consulting.

With a headless CMS, Claude Code works on two separate things. The front end, the site visitors see, is code in a git repository, so Claude edits it like any project and a person reviews the diff. The content lives in the CMS, and Claude reaches it through the vendor's MCP server. Sanity, Contentful, Storyblok and Strapi all publish official MCP servers as of October 2026, and all four can write content. Several can publish or delete it too.

That split decides the workflow. Code changes go through branches, previews and pull requests. Content changes go through the CMS's own safety nets: drafts, non-production environments or datasets, and your Claude Code ask rules on publish and delete tools. This guide compares the four servers using only what each vendor documents, then gives a setup that keeps a person in charge of what goes live.

Key Takeaways

  • A headless CMS stores content and serves it through an API to a separate front end. Claude Code edits the front end as code and reaches content through MCP (Model Context Protocol), an open standard for connecting AI tools to other systems.
  • Sanity's hosted server is at https://mcp.sanity.io; its changelog marks the remote server GA in December 2025. Its create tool makes drafts unless you target a release, and it has a separate publish tool.
  • Contentful offers a remote server at https://mcp.contentful.com/mcp (EU: https://mcp.eu.contentful.com/mcp) and a local one. The remote one adds a per-environment allow-list through the Contentful MCP app.
  • Storyblok's server at https://mcp.storyblok.com/mcp covers the Management API only. Storyblok itself says results are "non-deterministic" and points repeatable, high-volume work to its CLI.
  • Strapi's MCP server is built in from version 5.47.0, off by default, runs on your own Strapi server at /mcp, and is gated by Admin token permissions.

Code vs content: two workflows

Front end (code)Content (CMS)
Where it livesA git repositoryThe CMS's database, reached by API
How Claude changes itEdits filesCalls MCP tools
Undogit, and Claude Code's checkpoints for file editsThe CMS's version history; Claude Code's checkpoints can't undo remote changes
Review stepDiff, preview deploy, pull requestDrafts, a non-production environment or dataset, and ask rules
Typical jobsComponents, templates, metadata, sitemaps, redirectsBulk edits, content models, migrations, audits

Schema changes sit in between. Some CMSs define content models in code, others in the CMS, and several MCP servers can change models directly. Treat a model change like code: plan it, test it on a copy, and have a person approve it.

The four MCP servers compared

CMSServerSign-inStatus labelNotable quirk
SanityHosted at mcp.sanity.ioOAuth (default) or tokenGA, per its December 2025 changelog entryCreates drafts by default; image generation tools use AI credits
ContentfulHosted at mcp.contentful.com/mcp, or local open sourceOAuth 2.1 (remote) or a personal access token (local)None shownRemote server needs the Contentful MCP app installed in each space and environment
StoryblokHosted at mcp.storyblok.com/mcpOAuth or a personal access tokenNone shownManagement API only; can't read published content
StrapiBuilt into your Strapi server at /mcpAdmin tokenNone shown; listed as a free featureNeeds Strapi 5.47.0 or later; off until you enable it

"None shown" means the vendor's docs page doesn't label the server beta, preview or GA. Check the page again before a big job, since these servers change often.

What each server can do

The details below come from each vendor's own docs. They matter most for one question: which tools can publish or delete, so you know what to put behind an ask rule.

Sanity

Sanity's MCP docs say agents "can execute GROQ queries, manage releases, and patch documents with full awareness of your schema." For Claude Code, Sanity gives claude mcp add Sanity -t http https://mcp.sanity.io --scope user, or npx sanity@latest mcp configure, which detects Claude Code and sets it up using your logged-in Sanity CLI user.

Useful safety details: create_documents creates drafts unless you pass a release, Sanity says patches are saved "to the draft or release version, never directly to published content," and publishing is a separate tool, publish_documents. Sanity says scheduling, publishing and deleting a release aren't available through MCP and must be done in Sanity Studio or its HTTP API. Other tools can deploy a schema or a Studio, create datasets and manage CORS origins, so keep those behind ask rules too. Most tools are standard API calls that don't use AI credits; the exceptions are generate_image and transform_image, which you can switch off in your client.

Contentful

Contentful's MCP docs describe a remote, hosted server and a local, open-source one that "expose the same core toolset." Claude Code: claude mcp add --transport http contentful https://mcp.contentful.com/mcp, then a browser sign-in where you choose spaces and environments. EU customers use the EU endpoint instead.

The remote server has two permission layers: your own Contentful permissions, and an allow-list in the Contentful MCP app where admins pick which tool categories (entries, assets, content types, environments and so on) work in each environment, each as read-only or read/write. The local server has only one: every call runs as the owner of the personal access token. The write tools are broad, including publish_entry, delete_entry, create_content_type and delete_environment. The allow-list works by category, not by single tool, so set production categories to read-only, as Contentful suggests starting out, and use ask rules for individual publish and delete tools.

Storyblok

Storyblok's server "exposes the Management API and makes it available to any MCP-compatible AI client." Its setup page gives claude mcp add --transport http Storyblok https://mcp.storyblok.com/mcp, then /mcp to sign in. Instead of one tool per endpoint, it uses a search, describe and execute flow: reads go through execute_readonly, create and update calls through execute_mutating, and delete calls through execute_destructive, which "Requires explicit confirmation from the user before use." That split makes ask rules simple: put the mutating and destructive tools behind them.

Storyblok's own advice is worth repeating: "results are non-deterministic and unsuited for repeatable, high-volume work." Use the MCP for one-off changes and exploring, and Storyblok's CLI for repeatable jobs. That fits Claude Code well: have Claude write a CLI or API script you can review and re-run, rather than making hundreds of MCP calls. Storyblok's older GitHub repository for the server is archived; use the endpoint on its docs page.

Strapi

Strapi's MCP docs say it "includes a built-in Model Context Protocol (MCP) server" that can "create, read, update, delete, publish, and unpublish content directly through Strapi's Content Manager." It needs Strapi 5.47.0 or later, is off by default, and is enabled in your server configuration. Because it runs on your own Strapi server, the endpoint is your server's address plus /mcp, such as http://localhost:1337/mcp in development.

Strapi's Claude Code example passes the Admin token in a header: claude mcp add strapi-mcp --transport http http://localhost:1337/mcp -H "Authorization: Bearer YOUR_ADMIN_TOKEN". Each session gets that token's permissions, and Strapi only shows tools the token can use: a token without delete on a content type gets no delete tool for it. So create a token with only the content types and actions the job needs. Publish and unpublish tools appear only on content types with Draft and Publish turned on. Known limits include dynamic zone fields passed as untyped arrays. Strapi's page is inconsistent on media: its limitations list says the server can't upload new files, while a separate Media Library section describes write tools from version 5.54.0. Test media handling on your version before relying on it. Audit logging of MCP actions is an Enterprise feature from 5.52.0.

A safe setup for any headless CMS

  1. Point Claude at a non-production copy. A Sanity dataset, a Contentful environment, a Storyblok space or a local Strapi instance that isn't your live content.
  2. Grant the narrowest access. Pick only the spaces or environments needed at sign-in, or a token with limited permissions.
  3. Add ask rules on publish and delete tools. Claude Code permission rules can name one MCP tool, in the form mcp__ plus the server name, two underscores, and the tool name. Ask rules make Claude Code stop and ask, even in auto mode. Our guide to MCP servers for website teams covers rule scoping.
  4. Keep tokens out of shared files. Claude Code's default local scope keeps a server's settings private. If a team shares a project .mcp.json, use its environment variable expansion for tokens instead of writing them in.
  5. Write the rules down. Your CLAUDE.md should name the content model, the environment to use, and "never publish or delete without asking." Our guide to writing a CLAUDE.md for a website covers the format.
  6. Ask for a report before changes. List the entries that would change and how, review, then apply.
  7. Review in the CMS. Check drafts and version history before anything is published.

One more risk: content is input. If an entry contains text that looks like instructions, an agent reading it could act on it. Anthropic notes that servers which fetch external content can expose you to prompt injection. Our guide to prompt injection risks on websites explains how to reduce it.

Good jobs for Claude Code on a headless site

JobRouteWhat a person checks
Fill missing SEO fields across entriesMCP, as draftsEvery title and description before publishing
Migrate content from another platformA reviewed script, run on a copyCounts match; a sample of entries reads correctly
Change a content modelCode or MCP, on a non-production copyExisting entries still validate; the front end still renders
Build or fix front-end componentsCode in gitThe diff and a preview deploy
Audit content for broken links or stale factsRead-only MCP queriesWhich findings are real

For moves between platforms, see moving content with Claude Code. If your front end is Next.js, Claude Code for Next.js sites covers that side, and our headless CMS hub covers choosing a CMS in the first place.

When to use the CMS's own tools instead

  • Repeatable bulk jobs. A reviewed script using the vendor's CLI or API is easier to test and re-run than many MCP calls. Storyblok recommends exactly this.
  • Editorial work. Writers and editors should keep using the CMS's editor, with its previews and workflows.
  • Publishing and scheduling. Leave these in the CMS, in a person's hands. Sanity, for one, leaves scheduling and publishing a release to Sanity Studio or its API.

Conclusion

A headless CMS is a good match for Claude Code, because the front end is ordinary code and all four major CMSs here publish official MCP servers for content. Keep the two workflows separate: code through git and reviewed pull requests, content through drafts and non-production environments, with narrow tokens and ask rules on every publish and delete tool. If you'd like help building a headless site or moving content into one, see our Claude Code development services. More guides are in our Claude Code Guide.

Frequently asked questions

Which headless CMS works best with Claude Code?

All four covered here have official MCP servers. The choice is about your content model, editors and budget more than the AI tooling. Compare their permission controls: Contentful's per-environment allow-list and Sanity's drafts-by-default behavior are both useful safety nets.

Can Claude Code publish content in my CMS?

Through Sanity, Contentful and Strapi's MCP servers, yes, they include publish tools. Storyblok's execute_mutating tool runs Management API writes, so treat it the same way. Put those tools behind ask rules and keep publishing a human decision.

Do I need a separate environment for Claude?

It's the safest setup. Use a non-production dataset, environment, space or local instance, and move approved changes to production through your normal process.

Is Storyblok's MCP good for bulk edits?

Storyblok says no: it calls MCP results non-deterministic and unsuited for repeatable, high-volume work, and recommends its CLI for that. Have Claude write a script you can review and re-run.

Where do I put the CMS token?

Not in a prompt or CLAUDE.md. Keep it in your private Claude Code configuration or an environment variable, give it the narrowest permissions the job needs, and revoke it when the job is done.

Put this into action with eSEOspace

We help businesses grow with seo, geo & aeo that actually performs. Explore the services behind this guide:

Book a free strategy call →

Get a FREE Audit

We'll perform a comprehensive SEO, AEO, GEO & CRO audit of your website — completely free — and show you exactly how to outrank your competitors.

Don't have a site yet? Get in touch →

Get a FREE GEO/AEO/SEO Audit

We'll analyze your site's SEO, GEO, AEO & CRO — completely free — and show you exactly how to get found across Google and AI answers.

Don't have a site yet? Get in touch →

You Might Also like to Read