Skip to content
← All posts

Connecting Statamic to AI Assistants with MCP

The Model Context Protocol lets AI assistants interact with your Statamic site directly. Here is how Statamic MCP gives Claude, Cursor, and ChatGPT access to your content model.

· 9 min read · Sylvester Damgaard
Connecting Statamic to AI Assistants with MCP

Update: This post describes Statamic MCP v1. Version 2 shipped with a completely new architecture: 11 router-based tools, OAuth 2.1, scoped API tokens, and a full CP dashboard. The concepts below still apply, but the setup and tool structure have changed.

AI assistants are good at writing code, but they are blind to your application's runtime state. Claude can write a Statamic collection tag, but it doesn't know what collections you have, what fields are in your blueprints, or what entries exist. Every time you ask it to help with a template, you have to paste in your blueprint YAML, explain your content structure, and correct the assumptions it makes about your field handles.

The Model Context Protocol (MCP) changes this. MCP is an open standard that lets AI assistants connect to external tools and data sources through a structured API. Instead of pasting context into a chat window, the assistant can query your Statamic site directly.

I built Statamic MCP to give AI assistants first-class access to Statamic's content model.

What MCP Does

MCP defines a communication protocol between an AI "host" (like Claude Desktop, Cursor, or VS Code Copilot) and a "server" (your application). The server exposes tools that the AI can call, and resources that the AI can read.

For Statamic MCP, the tools and resources map directly to Statamic's content API:

Resources (read-only context the AI can access):

  • Collection definitions and their blueprints

  • Taxonomy definitions and terms

  • Global sets and their values

  • Navigation structures

  • Asset container configurations

  • User roles and permissions

  • Site configuration and locales

Tools (actions the AI can perform):

  • List and read entries from any collection

  • Create, update, and delete entries

  • Search entries with full-text queries

  • Read and write global set values

  • Manage taxonomy terms

  • Query asset metadata

When an AI assistant has access to these tools, it can answer questions like "show me all blog posts tagged with 'infrastructure' from the last 6 months" by actually querying your site, not by guessing based on your description.

Setting It Up

Statamic MCP installs as a Statamic addon:

bash
composer require cboxdk/statamic-mcp

After installation, you create an API token in the Statamic control panel. The addon adds an MCP section to the CP sidebar where you can manage tokens, configure permissions, and monitor usage.

Each token has scoped permissions. You might create a read-only token for AI assistants that only need to understand your content model, and a read-write token for assistants that should be able to create draft entries.

Claude Desktop Configuration

To connect Claude Desktop to your Statamic site, add the server to your Claude configuration:

json
{
  "mcpServers": {
    "statamic": {
      "command": "npx",
      "args": ["-y", "@cboxdk/statamic-mcp-client"],
      "env": {
        "STATAMIC_URL": "https://your-site.test",
        "STATAMIC_MCP_TOKEN": "your-token-here"
      }
    }
  }
}

Once connected, Claude can browse your collections, read blueprints, and understand your content structure without you explaining it.

Cursor and VS Code

For Cursor, the configuration is similar. The MCP client runs as a stdio server that the editor connects to. When you ask Cursor to "create a template for the events collection," it can query Statamic MCP to discover the events blueprint, see what fields are available, and generate a template that uses the correct field handles.

The Control Panel Dashboard

Statamic MCP adds a dashboard to the control panel that shows:

  • Connected clients: Which AI assistants are currently connected and their last activity

  • API token management: Create, revoke, and scope tokens

  • Usage logs: A timeline of tool calls showing what each assistant accessed or modified

  • Permission matrix: A visual overview of what each token can access

The usage logs are particularly useful for auditing. When an AI assistant creates or modifies entries, the log shows exactly which tool was called, with what parameters, and what changed. This gives content managers visibility into AI-assisted content creation.

Scoped Permissions

Not every AI assistant should have full access to your site. Statamic MCP implements granular permission scoping at the token level:

yaml
token_permissions:
  read_only_assistant:
    collections:
      read: [blog, pages, docs]
      write: []
    taxonomies:
      read: [tags, categories]
      write: []
    globals:
      read: [site_settings]
      write: []

  content_assistant:
    collections:
      read: [blog, pages]
      write: [blog]  # Can create/edit blog posts only
    taxonomies:
      read: [tags, categories]
      write: [tags]  # Can create new tags
    globals:
      read: [site_settings]
      write: []

Write permissions require an additional confirmation step in the AI assistant's interface. When Claude wants to update an entry, it presents the changes and asks for your approval before executing the tool call.

Real-World Usage

Here are the workflows where Statamic MCP has been most useful in my own projects:

Blueprint-aware templating. Instead of copying blueprint YAML into chat, I ask Claude to "create an Antlers template for the services collection." It queries the blueprint, sees the fields (title, description, icon, price_tiers, cta_link), and generates a template using the correct handles with appropriate markup.

Content migration. When restructuring a collection's blueprint, I ask Claude to "read all entries in the docs collection and show me which ones have empty 'sidebar_nav' fields." It queries the entries directly and gives me a list, which is faster than writing a one-off Artisan command.

Documentation generation. Claude can read a collection's blueprint and entries, then generate documentation describing the content model. Useful for onboarding new developers or content editors to a project.

Bulk content operations. Creating 20 redirect entries from a spreadsheet. Updating the meta_description field across all pages. Tagging entries based on content analysis. These are tasks that an AI assistant with write access can do in seconds, with the changes logged and auditable.

Supported AI Clients

Statamic MCP works with any AI client that supports the MCP standard:

  • Claude Desktop (Anthropic) via stdio transport

  • Cursor via stdio transport

  • VS Code with GitHub Copilot MCP extension

  • ChatGPT via the MCP gateway (requires Pro plan)

  • Windsurf via stdio transport

  • Any custom client implementing the MCP specification

The protocol is transport-agnostic. Statamic MCP supports both stdio (for local development) and HTTP/SSE (for remote servers). The transport is configured per token, so a local development token uses stdio while a production token could use HTTP with TLS.

Full setup guides for each client, permission configuration, and the complete tool reference are in the Statamic MCP docs.


// Sylvester Damgaard