Agents overview
Let an AI agent write and manage content, under the same rules you follow.
Graft is built so that an AI agent can do the content work a person would do in a CMS dashboard: draft a page, fix a typo across fifty documents, upload an image, or look up why a compile failed. Graft has no admin dashboard that the agent would have to click through. Instead, it offers the agent the same operations you use from the command line, as tools.
Agents reach those tools through the Model Context Protocol (MCP), the open standard that Claude Code, Cursor, and most other agents use to call tools. You run one command, register it with your agent, and the agent can start working.
Connect an agent in one step
For an agent running on your machine, such as Claude Code or Cursor, serve the project over MCP:
graft mcp
Then register it with your agent, usually in an .mcp.json file. For an agent
running elsewhere, Graft also serves MCP over HTTP at POST /api/mcp.
Connecting agents covers both, with the exact
configuration for each client.
What an agent can do
| To… | The agent calls |
|---|---|
| Learn your collections and fields | list_collections, describe_schema |
| Read and search content | list_content, get_content, search_content |
| Write or delete a document | write_content, delete_content (each compiles in the same call) |
| Upload an image or file | put_asset |
| Call your typed functions | list_functions, describe_function, run_function |
| Find ready-made features to add | list_registry, describe_item |
| Understand an error | explain_error |
MCP tools lists every tool with its inputs and results. Beyond tools, an agent can attach documents directly as context, and pick from ready-made workflows such as "author a document" or "fix an error". See Resources & prompts.
What keeps an agent in bounds
An agent gets no special access. Everything it does goes through the same checks as a person using the CLI or your app:
- Every write is checked against your schema, and a bad document is refused with a message saying what to fix.
- MDX that could run code is refused by default. See MDX safety.
- Functions apply their own rules.
run_functiongoes through the same handler asPOST /api/fn/<name>, so access rules, rate limits, and the audit log apply exactly as they do for your app's users. - Deletes wait for a human. If a local
graft mcpserver (stdio) has opted into asking in-band and the agent's client supports it, the client asks you to confirm and the delete completes in one call. Otherwise the firstdelete_contentcall files an approval request and stops. A person approves it withgraft approve, and only then does the agent's retry succeed. See Audit & approvals.
Errors the agent can act on
Every Graft error includes a fix: the next step, written plainly. An agent
reads it and recovers without searching the docs. explain_error returns the
full entry from the Error reference for any code.
Graft's test suite checks this on every change. It simulates an agent that
knows nothing about the project except what the tools tell it. The simulated
agent discovers the schema, writes a page, hits a validation error, recovers
using explain_error, and reads the page back. If a change to a tool or an
error message breaks that path, the build fails.
A second, public endpoint for your docs
A project can also serve a read-only MCP endpoint at POST /mcp, with no
authentication, so agents can read your published documentation. It is a
separate server, not a setting on the private one, so turning it on cannot
expose anything else. Public docs MCP explains what it serves
and how to set it up.
Next steps
- Connecting agents gets your agent connected.
- MCP tools lists every tool an agent can call.
- Audit & approvals covers the human checks on destructive actions.