Connect An Agent Over MCP

FOLD has an MCP server with the same operations as the CLI. An agent connected to it can create a draft, write files, build a preview and return the preview URL, within the access its token allows.

Connect A Hosted Client

In your MCP client, choose Streamable HTTP and set the URL to your FOLD's MCP address. The client signs in through its own authorization flow. Call sites_list first to find the sites the signed-in account can use, then pass the chosen site ID to every other tool.

Connect A Local Client

Start pnpm dev and export the FOLD_TOKEN it prints in the shell where you run the agent. For the Pi coding agent, add this to your project's .pi/mcp.json, with the port FOLD printed.

{
  "mcpServers": {
    "fold": {
      "url": "http://localhost:8787/mcp",
      "headers": { "Authorization": "Bearer ${FOLD_TOKEN}" },
      "exposure": "deferred"
    }
  }
}

Open Pi from the project directory and run /mcp to see the FOLD connection. Then ask it to create a draft, write index.md, build a preview and return the preview URL.

Tools

Task Tools
Read sites and generations sites_list
Find, create and edit drafts drafts_list, draft_create, draft_read, draft_write, draft_delete
Build and check a preview draft_preview, release_preview, operation_get
Find releases and read their source releases_list, content_list, content_read
List, compare and reuse media media_list, media_compare, draft_attach_media
Request, check and decide a review review_request, review_status, reviews_list, review_decide
Send review notices by email notices_get, notices_set, notices_confirm, notices_clear
Publish and roll back release_publish, release_rollback
Read forms and submissions form_get, submissions_list
Use the asset library asset_create, asset_get, asset_search, asset_edit, asset_replace, asset_versions, asset_attach, asset_publish, asset_unpublish, asset_status
Run the FOLD authoring agent agent_submit, agent_result

What A Token Allows

Scope Allows
fold:read Finding sites. Checked on every request
fold:write Reading and editing drafts, building previews, requesting reviews, running the authoring agent, editing and attaching assets
fold:publish Publishing and rolling back, deciding reviews, review notices, publishing assets. Also needs the publisher role on the site
fold:submissions Reading form submissions. Also needs the publisher role on the site

A client sees only the tools its scopes allow. Each tool is marked so a client can tell a read from a change. The tools that change what visitors see, or replace or remove content, are marked destructive: release_publish, release_rollback, review_decide, draft_write, draft_delete, notices_clear, asset_publish and asset_unpublish.

Next: Run the FOLD authoring agent