# MCP + Headless CMS: Complete developer guide

A [coding agent](https://www.thebcms.com/agents.md) can rewrite a React component in one pass. It still has to guess the content shape unless it can ask the CMS. On a headless project that guess is expensive: the summary might be called description in one project and excerpt in another, and a card built against the wrong name renders an empty paragraph.

MCP, the Model Context Protocol, is how the agent asks. This guide explains the idea, then connects Cursor to one BCMS blog and builds a card from a real entry.

## What is MCP (Model Context Protocol)?

MCP lets a coding agent use tools on a system outside the editor. The agent does not receive a database login. It receives a menu of actions, and it asks the editor to run one.

Four names are enough to follow the rest of this guide:

- The host is the app you work in, such as Cursor, Claude Code, or VS Code.

- The client is the piece of that app that talks to an MCP server.

- A tool is one action the server offers, such as "list templates" or "read this entry."

- A resource is reference material the server can attach, such as a short note about how writes should be formatted. It is not the same thing as loading an entry.

The model never connects to the CMS itself. It asks the host to run a tool. The client sends that request to the [MCP server](https://www.thebcms.com/docs/getting-started/mcp.md). The server reads the CMS and returns the answer to the chat.

### A small architecture

For a headless CMS, the path is short. The editor hosts the client. The client talks to the MCP server. The server reads templates and entries, and it can change them only when the key allows it.

```TXT

flowchart LR
  editor[Cursor]
  client[MCP client]
  server[BCMS MCP server]
  cms[Templates and entries]
  editor --> client --> server --> cms

```

You add a server URL in the editor. After that, the agent can ask the CMS questions while you write the component. The website keeps using its own API client.

## Why MCP Matters for Headless CMS

Headless content is structured data: strings, dates, media, and pointers to other entries. The website reads that schema through an API.[All you need to know: Headless CMS in 2026](https://www.thebcms.com/blog/headless-cms-101.md) explains why the content sits outside the git repository. The agent in the editor sees the repository. It does not see the schema unless a tool returns it.

Field names belong to that schema, and they differ by project. The blog in this guide stores the summary as description, the picture as an image group (a label plus a media file), and the byline as an authors pointer. It does not have excerpt, coverImage, or authorName. A card written for those other names renders an empty paragraph even when the entry is full.

That is the practical case for an AI agents headless CMS setup. Have the agent read the template before it writes JSX. The public site keeps its own read path. [API-first CMS: A developer's guide to modern content architecture](https://www.thebcms.com/blog/api-first-cms.md) is how a site loads those same entries at build time. MCP is an extra client for the person writing the code, not a replacement for the site's API key.

## MCP server vs REST API: What's the difference?

Both reach the same content. They serve different callers.

A REST API, or the BCMS SDK in front of it, is how application code loads content. The website already knows which methods it needs. With @thebcms/client those look like template.getAll(), entry.getAll(), and entry.getById(). The app renders the body, often with BCMSContentManager. Types, caching, and retries live in the project. This path should keep working when nobody has an editor open.

An MCP server is a menu for an agent that does not know the project yet. The agent asks what tools exist, then calls one, such as "describe the blog template" or "read this entry." It learns the real field names before it drafts a component. You do not add a new tool every time you add a template. The same tools accept an id for whichever template you name.

Choose by who is calling:

- Use REST or the SDK for the website, for scripts, and for CI.

- Use MCP while you and an agent are building against the live content model.

- Use both on the same project. Give them separate keys. The site key fetches entries for visitors. The agent key stays on your machine.

REST or the BCMS SDKMCP serverWho calls itThe website, a script, or CIAn agent inside the editorWhat the caller knows up frontThe methods your code importsOnly the tool menu the server advertisesWhat you set upA client, types, and a site keyA server URL and an agent keyWhat it is good atRendering and publishing the siteLearning field names before generating codeWhat it should not replaceThe agent discovering a schemaThe site's data fetching

MCP complements the API. It does not retire it.

## How AI Agents Interact with Headless CMS content

Once the editor is connected, the agent only knows what the tools return. The useful jobs on a CMS are below. Every example is the same BCMS blog: the template named blog, and the entry headless-cms-101.

The server also offers tools that create, update, and delete entries, templates, groups, and widgets. Those names matter later, in the security section. The examples here are read-only.

### Discovering content models

Ask which templates exist, then ask for the blog template. You should get each field's name, type, and whether it is required:

FieldTypeRequiredtitleStringYesslugStringYesdescriptionStringYescategoryEntry pointerNoauthorsEntry pointerNoimageGroup, with a label and a media fileNocreated_atDateNoupdated_atDateNo

description is the summary. image is a group, not a single file field. authors points at author entries. A generated card should use these names and no others.

### Retrieving entries

Ask for one entry and for the English title, slug, and description. For headless-cms-101 that read returns:

```TXT

{
  "title": "All you need to know: Headless CMS in 2026",
  "slug": "headless-cms-101",
  "description": "All you ned to know: Discover the benefits of headless CMS and its value for you. Elevate your understanding with our insights."
}

```

The description is stored with that spelling. Use it as stored. The raw entry keeps each value under a field id, so ask the agent for the named fields rather than pasting the raw object into a component. If the blog is large, ask for one entry. A request for every entry at once can be too big to return.

### Understanding content relationships

category and authors point at other entries. A rich-text link uses a pointer string from get-entry-pointer-link, shaped . Ask the agent to fetch that string. A pointer it invents does not resolve.

### Generating frontend components

With the template and one entry in the chat, the agent can draft a component whose props match those names. The tutorial does that with title, slug, and description only.[Agentic CMS: The future of content management in an AI-agent world](https://www.thebcms.com/blog/agentic-cms.md) is the wider setting: the agent can reach the CMS, and the site still loads entries through @thebcms/client.

### Creating or updating content when authorized

Write tools are on the same menu as the read tools. A sentence in your prompt that says "do not write" does not remove them. Create or update an entry only when you mean to, and read the arguments in the approval dialog before you accept them.

## Hosted vs Custom MCP Servers

You can use an MCP server the CMS vendor runs, or a server you run yourself. Both speak the same protocol to the editor. The difference is who operates the process, and how much of the CMS you choose to expose.

A hosted server is the faster path. The vendor runs the endpoint, ships the tool list, and updates it when the product changes. You create a key and paste a URL into Cursor. You do not deploy anything. The tradeoff is the menu: you get the tools the vendor decided to publish. BCMS works this way. Create a key under Settings → MCP, and the tutorial at the end uses that hosted URL.

A custom server is a small program you run beside the editor. You register only the tools you want, often just the reads. That is the right choice when a CMS has no hosted MCP server, when you want a read-only menu, or when one agent should reach the CMS and another internal system through a single connection. You then own hosting, dependencies, and every API change.

Hosted MCP serverCustom MCP serverWho runs itThe CMS vendorYouSetupA key and a URLA process you write and keep runningMaintenanceThe vendor updates the toolsYou update the processTool menuThe vendor's full set, including writes on BCMSOnly the tools you registerFits whenYou want the editor connected todayYou need a narrower menu, or more than one system

Start with the hosted server unless you have a reason to own the process.

## MCP Security and Best Practices

A hosted MCP key can do whatever tools the server advertises. On BCMS that includes delete. Per-template permission toggles do not hide those tools, so a key that looks read-only in the dashboard can still be asked to write. Treat every MCP key as able to change content.

- Create one key per person and per environment. The value has three parts separated by dots. A key without MCP access is rejected when the editor connects.

- The key sits in the server URL. Shell history, proxy logs, and a committed mcp.json are copies of it. Keep the file at ~/.cursor/mcp.json, outside the repository, or pass the key through an environment variable.

- Do not put the key in a NEXT_PUBLIC_ variable or in any file the browser downloads. The website uses a different key. The [BCMS Next.js guide](https://www.thebcms.com/docs/integrations/next-js.md) shows where that key belongs.

- readOnlyHint is a hint to the client. It does not turn write tools off. If a read-only chat starts proposing edits, disconnect the server or revoke the key.

- [BCMS AI Agent capabilities: What makes an AI Agent useful?](https://www.thebcms.com/blog/ai-agent-capabilities.md) is a checklist for what an agent should be allowed to see. Read one template and one entry before any write, and read the tool arguments before you approve a change.

Rate limits match the rest of the BCMS API and are counted per key.

## Tutorial: How to Connect Cursor to BCMS Using MCP

This walkthrough connects Cursor to the hosted BCMS server, reads the blog template, reads the entry headless-cms-101, and generates a card from title, slug, and description. It does not create or edit content.

### Prerequisites

- A BCMS project that contains the blog template and the entry headless-cms-101.

- Cursor.

- A few minutes to create a key and paste a URL.

### Step 1: Create a BCMS MCP Key

1. In the BCMS dashboard, open Settings → MCP.

2. Create a key and copy the URL BCMS shows you. It has this shape:

https://app.thebcms.com/api/v3/mcp?mcpKey=YOUR_MCP_KEY

3. Store the key in a password manager, or in an environment variable named BCMS_MCP_KEY.

You should see a URL that contains mcpKey, and a key made of three parts separated by dots.

Do not commit the URL, and do not paste the key into a chat. If it has been logged, rotate it in the dashboard. The same style of setup for ChatGPT is in [Connect BCMS MCP to ChatGPT](https://www.thebcms.com/blog/bcms-mcp-and-chatgpt.md).

### Step 2: Configure BCMS MCP in Cursor

Cursor reads ~/.cursor/mcp.json for every project, and .cursor/mcp.json inside one project. Use the home-directory file so the key never lands in git.

1. Open ~/.cursor/mcp.json.

2. Add a server named bcms. This form keeps the key out of the file:

```TXT

{
  "mcpServers": {
    "bcms": {
      "url": "https://app.thebcms.com/api/v3/mcp?mcpKey=${env:BCMS_MCP_KEY}"
    }
  }
}

```

3. Set BCMS_MCP_KEY where Cursor can read it, then reload MCP servers from Cursor's settings.

If Cursor does not substitute the variable, put the full URL in ~/.cursor/mcp.json and nowhere else. More client options are in the [BCMS MCP guide](https://www.thebcms.com/docs/mcp.md) and the [Cursor MCP docs](https://cursor.com/docs/mcp).

You should see a server named bcms in the MCP list. If the tool list is empty, the URL or the variable did not load. Reload once before you change your prompt.

### Step 3: Verify the Connection

Open the agent chat with the BCMS server enabled and paste:

```TXT

What BCMS tools do you have right now? Describe each one in a short phrase. Do not change any content.

```

You should see tools that list templates, read a template, and read an entry. You should also see tools that can create, update, or delete content. Those write tools are part of the hosted server. Leave them unused for the rest of this tutorial, and reject any approval that would change the project.

### Step 4: Retrieve BCMS Content

Ask for the blog model in plain language:

```TXT

Using BCMS, list my templates. Then describe the blog template: every field name, its type, and whether it is required. Do not change anything.

```

You should see required fields title, slug, and description, plus category, authors, image, created_at, and updated_at. image is a group with a label and a media file. authors points at other entries.

Then read the one entry this guide uses:

```TXT

Read the BCMS blog entry whose slug is headless-cms-101. Tell me its English title, slug, and description. Do not change the entry.

```

You should see these values, with the description spelled the way it is stored:

```TXT

Title: All you need to know: Headless CMS in 2026
Slug: headless-cms-101
Description: All you ned to know: Discover the benefits of headless CMS and its value for you. Elevate your understanding with our insights.

```

### Step 5: Generate a Component Using BCMS Content

Keep the two answers above in the chat, then paste:

```TXT

Write a BlogCard component for this blog entry. The props are title, slug, and description only. Link to /blog/ plus the slug. Do not add excerpt, coverImage, or authorName.

```

A component that follows the template looks like this. Rendered in a small Next.js 15.5.29 page, it linked to /blog/headless-cms-101, showed the entry title in the heading, and showed the stored description in the paragraph.

```TSX

export function BlogCard(post: {
  title: string
  slug: string
  description: string
}) {
  return (
    
      <h2>{post.title}</h2>
      <p>{post.description}</p>
    
  )
}

```

The page checked the props. A production site should still load the entry with @thebcms/client.

### Troubleshooting

What you seeWhat to doNo BCMS toolsThe URL or BCMS_MCP_KEY did not load. Check ~/.cursor/mcp.json, then reload MCP servers.HTTP 400 when connectingThe key is not three dot-separated parts. Copy the full value from Settings → MCP.HTTP 401 when connectingThe key id or secret does not match. Create a new key if this one may have leaked.HTTP 403 when connectingMCP access is turned off for that key. Enable it, then reload.HTTP 404 when connectingThe project id inside the key does not match a BCMS project.The entry cannot be foundThe connection is fine and the id or slug is wrong. Ask again using the slug headless-cms-101.Listing every entry failsThe blog is too large for one response. Ask for the single entry by slug.The agent wants to edit contentWrite tools are still available. Reject the approval, then disconnect the server or revoke the key.

## FAQs about MCP + Headless CMS

### What is an MCP server?

An MCP server is a program that offers a menu of tools to an AI app. The app lists those tools, the model picks one, and the server runs it. A headless CMS server's tools read templates and entries, and sometimes create or update them.

### Why connect a headless CMS to an AI coding agent?

The content model lives in the CMS, not in the repository. Connected, the agent can read the real field names and a real entry before it writes a component. Without that, it copies names from some other project and the component renders blank.

### Does MCP replace the CMS API?

No. The website, your scripts, and CI should keep calling the API or SDK. MCP is the interface for the agent in the editor. Use both, with separate keys.

### When would I run my own MCP server?

Run your own when the CMS does not host one, when you want to expose only read tools, or when the agent should reach the CMS and another system together. If the vendor already hosts a server, as BCMS does, start there.

### Can an agent change live content through MCP?

Yes, if the server offers write tools and you approve the call. On the hosted BCMS server those tools are part of the menu. Saying "read only" in the prompt does not remove them. Use a key you can revoke, and do not approve a write you did not ask for.

## Conclusion

MCP gives a coding agent a tool menu instead of a guess about your schema. On a headless CMS, let it read the real template and one real entry before you accept a generated component. The website keeps its API. The agent uses MCP from the editor, with its own key.

BCMS already hosts that server. Create a key, add the URL in Cursor, and ask for the blog template and the headless-cms-101 entry before you ask for a component. Setup notes are at [thebcms.com/agents](https://www.thebcms.com/agents.md), and the endpoint is documented in the [BCMS MCP guide](https://www.thebcms.com/docs/mcp.md).

### Sources

- [MCP specification, 2025-06-18](https://modelcontextprotocol.io/specification/2025-06-18)

- [MCP transports](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports)

- [MCP tools](https://modelcontextprotocol.io/specification/2025-06-18/server/tools)

- [Cursor MCP](https://cursor.com/docs/mcp)

- [Claude Code MCP](https://code.claude.com/docs/en/mcp)

- [BCMS MCP](https://www.thebcms.com/docs/mcp.md)

- [BCMS and Next.js](https://www.thebcms.com/docs/integrations/next-js.md)