ContentBuilder.js · ContentBox.js · Guide

Let Claude Manage a Website, Safely

Claude works on the user's whole site through your CMS, with no editor open, and every change can be taken back.

How Managing the Site Works

Claude

Calls a tool, for example "edit section 2 of /about".

↓ MCP

Your connector

Checks the user, keeps the page as it was, then changes the stored page.

↓ your code

Your database

Draft pages, live pages, versions, Trash.

Here, your code is the only safety

In live editing, the editor and its Undo stand between Claude and the database. Here nothing does: Claude's tool calls change your stored pages directly. Whatever your tools allow, Claude can do, and a chat cannot press Undo.

So the safety must be built into the tools, and into your CMS itself. The next sections show how.

Put the safety in the CMS, not only in the connector

Use the same code for versions and the Trash in your dashboard, your editor's save and the connector. Then a page deleted from the dashboard is as safe as one Claude deleted, and you write the rules once.

The Rules

✓ Do

  • Keep a copy of the page before every change Claude makes
  • Send content changes to the draft; publish only when the user asks
  • Keep a version on every publish, so the user can see what went live
  • Move deleted pages to a Trash, with their history
  • Let only a person empty the Trash, in your dashboard, with a confirm step
  • Change one section at a time, leaving the rest of the page untouched
  • Let each user reach only their own pages
  • Show versions in your dashboard, with View and Restore
  • Make a restore undoable: keep the current page first
  • Ask first, in your own page, before anything that affects the whole site (its address, deleting or moving it), or leave it out

✕ Don't

  • Offer a tool that deletes a page forever or empties the Trash
  • Offer a tool that deletes files from the user's assets
  • Write Claude's changes straight to the live page
  • Let one tool rewrite a whole page for a small change
  • Rely on Claude to "be careful": a rule in a tool is a rule; a sentence in the instructions is a wish
  • Let a save from an open editor silently overwrite Claude's change, or the other way round
  • Store Claude's keys as they are: store only their fingerprints
  • Let Claude pay for anything: give the user a link to complete the payment
  • Offer tools you have not thought through; each one is a door

A Version Before Every Change

Why before every tool call, not once per request

Your connector sees single tool calls, one by one. Nothing in a call says which request or chat it belongs to, so the connector cannot keep "one version per request". Keeping the page before every change is simpler, and never misses a state.

Label each version with the request

Give every change tool a required request field: the user's request, in their words. All changes for one request then carry the same label, and later the user can say "go back to before I asked for the pricing table". Claude finds the first version with that label.

// Work out the new page first, keep the old one, then save.
async function changeContent(db, user, address, request, change) {
  const page = await findPage(db, user, address);
  const after = change(page.html);  // an error here changes nothing

  await saveVersion(db, page, 'ai', request);

  await db.pages.updateOne(
    { _id: page._id, rev: page.rev },  // not changed meanwhile
    { $set: { html: after }, $inc: { rev: 1 } });
}

async function saveVersion(db, page, kind, label) {
  await db.page_versions.insertOne({
    pageId: page._id, user: page.user,
    kind,  // published, ai, settings, restore, editor
    label, createdAt: new Date(),
    page: { ...page },  // a full copy
  });
}

"Go back to before I asked for the pricing table": Claude finds the version by its label.

Claude goes back to before the pricing table

What to keep

Every published version. Of the others, the newest 100 per page is plenty.

Versions in Your Dashboard

1. Give each page a Versions item in its menu, next to View Draft.

A page menu with Publish Draft, Unpublish, View Draft and Versions

2. In the list, show the kind of each version, the request it belongs to, and when it was kept. View opens it read-only; Restore puts it back into the draft.

The Versions list with Published and Before Claude's change entries

3. Add an All / Published switch. Claude's versions are many, and the user often wants only the publishing history.

The Versions list showing only Published entries

Restoring

  • Keep the current page as a version first, so a restore can be undone too.
  • Content goes back into the draft. The user publishes it when ready.
  • The old address comes back only if no other page uses it now. Otherwise keep the current address and say so.
  • When the newest version is the same as the draft, show "Same as the draft" instead of Restore: restoring it would change nothing.

Putting back only a part

Give Claude a tool that reads one section of an old version. Then "bring back the old header" restores that section alone, and keeps everything else the user changed since.

Draft First, Publish When Asked

Keep two copies of each page: the draft, which Claude and the editor change, and the live page, which visitors see.

  • All of Claude's content changes go to the draft.
  • Visitors see them only after the page is published.
  • Claude publishes only when the user asks for it. Say so in the tool's description and in the instructions.
  • Keep a "Published" version on every publish: that is the history of what went live.
  • Offer View Draft in your dashboard, so the user can check Claude's work before publishing.

Page settings

Settings such as the title, description, address and social image often change on the live page at once, as in a dashboard's Settings dialog. If yours do, keep a version before they change too.

Addresses

Refuse an address that another page already uses, both when Claude changes it and when a version or a page from the Trash is restored.

A Trash Instead of Delete

Deleting a page moves it to the Trash, together with its live copy. Its versions stay.

Restore brings the page back with its history, and live again if it was live. If its address is taken by then, the user restores it under another one.

Only a person empties the Trash, in your dashboard, with a confirm step. Your connector has no tool for it.

async function trashPage(db, user, slug) {
  const page = await db.pages.findOne({ user, slug });
  const live = await db.live.findOne({ user, slug });
  await db.trash.insertOne({
    user, slug, page, live, deletedAt: new Date() });
  await db.pages.deleteOne({ _id: page._id });
  if(live) await db.live.deleteOne({ _id: live._id });
}
The Trash with one deleted page and Restore and Delete forever buttons

Delete forever asks first, and only in the dashboard.

Delete forever asks to confirm

Choosing the Tools

Each tool is a door into your CMS. Offer the ones a user would ask for, and nothing that cannot be taken back. The list shows the page tools; add your other CMS tasks, such as products or blog posts, the same way and with the same rules.

  • Pages: list_pages add_page delete_page (to the Trash) list_trash restore_page
  • Settings: get_page_settings update_page_settings
  • Content: get_outline get_section edit_section replace_section insert_section delete_section get_page_styles get_framework_docs
  • Publishing: publish_page unpublish_page
  • Going back: list_versions get_version_outline get_version_section restore_version
  • Images: list_images get_upload_link check_upload import_image
  • Checking: check_site: titles, descriptions, headings, alt text, large images and broken links, checked on your server, only the problems sent back. On a large site: one line per kind of problem, with a few example pages, and the pages with the most problems. screenshot_page: a picture of the draft (first screen or one section, desktop or phone).

Mark the reading tools

Mark tools that only read with readOnlyHint. claude.ai then lists them as read-only tools, which users can allow as a group, and asks only about the tools that change something.

server.registerTool('get_outline', {
  description: 'The sections of a page.',
  inputSchema: { page: z.string() },
  annotations: { readOnlyHint: true },
}, run);

Leave out

Delete forever, empty the Trash, delete files, write to the live page, change another user's pages, run code on your server.

A checking tool at work: "Show me how the Menu page looks on a phone."

Claude calls screenshot_page at phone width, shows the picture in the chat and describes what it sees. Users check a change without opening the site.

Claude shows and describes the Menu page at phone width

Let Users Choose

Read only, or changes too

On the Allow page, let the user choose: Read only (Claude can look at the site, answer questions and suggest changes) or Full access (Claude can also make changes).

Store the choice with the key. A read-only key gets only the reading tools. This is a rule in your connector, not a request to Claude.

The choice on the Allow page.

The Allow page with Full access and Read only

Tool groups

In the user's settings, let them switch groups of tools on or off, for example Pages, Content, Page settings, Publishing, Images. Someone may want Claude to write but never publish.

Check the switches on every call, so a group switched off stops working at once. Claude apps keep the tool list they received when connecting, so the list itself changes only after the user reconnects.

A panel in the dashboard: the address to add, the switches, and things to ask.

A dashboard panel with the connector address, switches and things to ask

Roles

If several people work on one site, follow each person's role. Claude gets no more than the person who connected it: if an editor may not publish or change settings, neither may Claude through that editor's key.

Check the role inside each tool, the same way your dashboard checks it.

One Section at a Time

A page is a list of sections. Find a section's exact position in the stored page and replace only those characters. Every other section stays byte for byte the same, so a small request never rewrites the whole page.

Small edits

For a text, a link or a class, let Claude send "find this exact piece, replace it with that" inside one section:

  • Each piece must occur exactly once in the section; otherwise refuse and say so.
  • Apply all pieces or none.
edit_section({
  page: '/about',
  section: 2,
  edits: [
    { find: 'Six people', replace: 'Seven people' },
  ],
  request: 'we are seven now',
})

Fonts without the editor

The editor normally adds the font stylesheet for each typography class it uses. When the connector saves a section, do the same, so a section Claude writes shows its fonts even though no editor opened it.

Images and Files

An upload link

claude.ai cannot pass a file the user attached in the chat to a connector. So give Claude a tool that makes a short-lived link to a small upload page on your site. The user opens it, adds files, and tells Claude; Claude then reads what arrived.

The upload page Claude links to (valid for 30 minutes).

An upload page: Add files for Claude

Images already on the site

A tool that lists the user's newest files lets Claude use what is there.

Images from a web address

If you let Claude copy an image from the web, refuse addresses inside your own network, follow only a few redirects, accept images only, and limit the size.

No delete

Removing files stays manual, in your asset manager.

Login and Access

Use your site's own login. When a user adds the connector, Claude opens your login page if needed, then an Allow page that says what Claude will be able to do.

  • Claude gets an access key (for example 1 hour) and a renewal key (for example 90 days). Store only fingerprints of the keys, never the keys.
  • Every tool works only on the pages of the user the key belongs to.
  • Refuse an Allow that comes from another website.
  • After Allow, send the browser back to Claude with a 303 redirect. Some frameworks default to 307, which repeats the form post, and claude.ai refuses it.

The MCP libraries include the standard login handlers (OAuth with PKCE and client registration); you add your login and the Allow page.

When the Editor Is Open

Editors save on their own every few seconds. If Claude changes a page that is open in the editor, the editor's next save would overwrite Claude's change.

Give each page a rev number that goes up on every write. The editor sends the rev it opened. If the page has changed since:

  • refuse the save, and keep the editor's content as a version, so nothing is lost;
  • show a notice and stop saving automatically;
  • reloading the editor gets the latest page.

The editor's notice after Claude changed the open page.

The editor shows: Not saved, this page was changed elsewhere

Instructions for Claude

A connector can give Claude short instructions, sent with the tool list. Use them to explain how your site works and how to work safely. The rules themselves still belong in the tools.

Start with the site's own address. A user with several sites connected then gets changes on the right one.

This connector is for the website https://www.example.com.

DRAFT AND LIVE
- Every page has a draft and a live copy. All content changes go
  to the draft. Visitors see the live copy only after publish_page.
- Publish only when the user asks for it.

SAFETY
- Before every change the page is saved as a version, labelled
  with "request": the user's request, in their words.
- To undo: list_versions, then restore_version for the whole page,
  or get_version_section to put back only part of it.
- delete_page moves the page to the Trash. Files are never deleted.

HOW TO WORK
- list_pages first. Read a section with get_section before
  changing it.
- Small changes: edit_section with the exact text from get_section.
- New content matches what is already there: read an existing
  section first.

Keep the Framework Guides in Step

Claude writes markup following the framework guides that come with the editor: the classes for layout and typography, and the attributes for animation and light and dark modes. Give them to Claude through a tool, so they are read only when needed.

Record which editor version the guides describe.

The rule

The editor your site runs, and its runtime and asset files, must be that version or newer.

Otherwise Claude writes markup for features your site does not have yet: a page with scroll animation or light and dark modes then looks broken in the editor and on the site. When you update the guides, update the editor too.

Token Cost

Every tool call costs the user's chat some tokens: what Claude sends to the tool, and what the tool sends back. The tool list and instructions are sent on every turn.

  • A list of about 25 tools with instructions adds roughly 5,000 tokens to every turn. That is normal for connectors of this size.
  • Return short answers: an outline of one line per section, one section at a time.
  • Plan for large sites. A page list or a site checkup that is small on 20 pages becomes huge on 800: on a site with 844 pages, listing every page cost about 25,000 tokens per call. Above a set size, return a summary (page groups, the pages that need attention) and a search option, so Claude asks only for the pages it needs. The same list then costs about 1,600 tokens.
  • Load long guides only when needed, one topic at a time.

A statistics page for developers shows which tools are worth making cheaper: by tool, by request, and every call.

Connector statistics: calls, tokens written and read, by tool

© 2026 InnovaStudio

This site is built with Site Builder Kit