Skip to content
SharpWrite
Docs menu

AI agents (MCP)

Let an AI agent read your content and save drafts, while you stay in charge of what goes live. Works on SharpWrite Cloud and on Self-host.

What it is

MCP (Model Context Protocol) is the standard way for AI tools such as Claude to use an app. SharpWrite has an MCP server built in, so you can say "write a changelog entry about today's release" and the agent saves it as a draft. You read it in the app and press Publish yourself.

It uses your own AI tool and your own AI account. On Self-host SharpWrite adds no AI of its own: the agent runs on your side and only talks to your install.

What an agent can and cannot do

  • It can list your content types, list and read entries (drafts and published), save new drafts and change existing drafts.
  • It cannot publish, unpublish or delete anything, and it cannot change a published entry. Live content is never touched.
  • Write access is opt-in. A key can only write if you ticked "Let AI agents write drafts" when you created it. Every other key, including the ones you already have, stays read-only.
  • Rich text from an agent is cleaned like every other save: scripts and unsafe links are removed.
  • Every change is kept in the entry's version history, so you can restore an earlier version. Saving a draft sends no webhook.

1. Create a key

In the app, open MCP, give the key a name (for example "Claude"), tick Let AI agents write drafts if you want it to write, and create it. Copy the key now: it is shown once. Use a separate key per agent so you can revoke one without affecting the others.

2. Connect your agent

The address is your app address followed by /api/mcp: https://app.sharpwritecms.com/api/mcp on Cloud, or your own domain on Self-host. The key goes in an Authorization header.

Claude Code
claude mcp add --transport http sharpwrite https://app.sharpwritecms.com/api/mcp \
  --header "Authorization: Bearer sw_live_YOUR_KEY"

Other MCP clients that support remote (HTTP) servers take the same two things: the address and the header. For a client that only supports local servers, a bridge such as mcp-remote can forward to the address; check that tool's own documentation for its options.

Treat the key like a password: do not paste it into shared chats, public repositories or browser code.

The tools

ToolWhat it doesNeeds a write key
list_content_typesShows your content types and their fields, including your page-builder pages (the type site-pages). An agent should call this first.No
list_entriesLists entries of one type (filter by status or search text). Returns slug, title, status and version.No
get_entryReads one entry in full, including the version number.No
create_draftSaves a new entry as a draft. Required fields must be filled.Yes
update_draftChanges fields of an existing draft. Only the fields sent change; null removes an optional field.Yes
  • Rich text fields are sent as an HTML string (p, h2 to h4, lists, strong, em, links, quotes, code and images). Dates are YYYY-MM-DD.
  • update_draft needs the entry's current version from get_entry. If you or someone else saved in between, the update is refused and the agent reads the entry again, so nobody's edits are overwritten.
  • Pages from the page builder use the type site-pages with the fields title, description and blocks (the widgets). The widgets are checked like they are in the builder, so an unsafe link is refused. Agents can only save drafts of pages too, and cannot change a page once it is published.
  • A draft written by an agent opens normally in the editor; the formatting is rebuilt from its HTML the first time you save it.

Limits and when writing stops

  • Reading always works, as long as the key is valid. Revoking a key stops it immediately.
  • Cloud: saving drafts needs a running trial or paid plan, like editing in the app. When a plan lapses the agent can still read, and the tool says why it cannot write.
  • Self-host: saving drafts needs a valid license, like editing in the admin. Reading and your live API keep working either way.
  • Each key can make about 60 MCP requests a minute. Requests larger than 300 KB are refused.

If something does not work

What you seeWhat to check
401 Missing or invalid API keyThe header must be exactly Authorization: Bearer followed by the key. A revoked key fails too.
"This API key is read-only"Create a new key with Let AI agents write drafts ticked. Existing keys cannot be upgraded.
"This entry is published"Agents only change drafts. Edit published entries in the app, or ask the agent to create a new draft.
"The entry changed since you read it"Someone saved in between. The agent should call get_entry again and retry.
Your plan or license messageWriting is paused until the plan or license is valid again. Reading still works.

Still stuck? See Troubleshooting or the API reference.