# MCP server

One MCP server serves every organisation. Its address is `https://<admin host>/mcp/`. AI apps connect with OAuth, as a person. They read what that person can read, on the sites whose organisation allows it. See [AI apps](/md/help/organisation/ai/ai-apps/). With the scope `write`, and where the organisation allows it, an app also makes drafts, adds redirects and publishes to staging. It never publishes live.

## Transport

- The transport is **Streamable HTTP**, without a stream. Send `POST /mcp/` with one JSON-RPC 2.0 message, or a batch. The answer is JSON. `GET` answers 405.
- The protocol versions are `2025-06-18`, `2025-03-26` and `2024-11-05`. The server answers with the version that was asked for, or with the newest.
- The methods are `initialize`, `ping`, `tools/list` and `tools/call`. `initialize` comes with `instructions`, which say how to use the tools together. A notification, without an `id`, gets `202` and no body.
- CORS is open. Send `Authorization: Bearer <token>` on every call.

## Signing in (OAuth 2.1)

| Step | What it is |
| --- | --- |
| Protected resource | `/.well-known/oauth-protected-resource`, also at `…/mcp`. RFC 9728. |
| Authorization server | `/.well-known/oauth-authorization-server`, also at `openid-configuration`. RFC 8414. |
| Registration | `POST /oauth/register/`, RFC 7591, with `client_name` and `redirect_uris`. A redirect is https, or http on localhost. At most 30 an hour per address. |
| Authorize | `/oauth/authorize/`, with `response_type=code`. Only PKCE `S256` works. `resource` must be this server. The person signs in, sees the sites, and confirms that it is them. |
| Token | `POST /oauth/token/`, with `authorization_code` or `refresh_token`. A code works once, for 10 minutes. |
| Revoke | `POST /oauth/revoke/`, RFC 7009. |

- The scopes are `read` and `write`. `write` comes from **Also let it make changes** on the consent screen, or later from **+ Write** next to the app under Profile → AI apps. Both need an organisation whose **What they may do** is **Read and make changes**. The grant is read on every call, so a change holds from the next call, without a new token.
- Access tokens (`lba_…`) last an hour. Refresh tokens (`lbr_…`) last 30 days, and change with every use. If an old refresh token is used again, the connection ends.
- Without a valid token, `/mcp/` answers `401` with `WWW-Authenticate: Bearer resource_metadata="…", scope="read"`.
- The person needs a confirmed e-mail address, and two-factor or a passkey. A blocked account or a demo account cannot connect.

## Tools

Every tool that reads a site takes `site`. That is an `id` from `list_sites`, or the host name. A site that the person cannot use gets one message, whether it exists or not.

| Tool | Parameters | What it gives |
| --- | --- | --- |
| `who_am_i` |  | The person, the app and the scope. |
| `list_sites` |  | The sites it can use: id, name, host, organisation, languages, and what it may read there. |
| `search_help` | `query`, `module` (`help`, `docs`), `lang` (`en`) | Articles of the help and these docs, with their `ai_context`. |
| `get_help_article` | `url` | An article as Markdown. Only from the documentation host. |
| `search_content` | `site`, `query` | Pages, posts, media, menus, forms and more that match. Each has its `kind`, its `id` when it has one, and an admin link. |
| `list_pages` | `site`, `type` (`page`, `blog`, `record`), `state` (`live`, `draft`, `changed`), `query`, `under`, `lang`, `offset`, `limit` (at most 200) | `home` (the home page of that language, or that there is none yet), counts per type and status, and the items: `id`, `type`, `title`, `address`, `status`, `changed`, `children`. |
| `get_theme` | `site` | The theme's draft: `colours`, `dark_mode`, `fonts` per role with their `source` (the library, a system font, or the theme's own CSS), `fonts_seen_live` (the faces the live site loads, as the frontend reports them), `fonts_available`, `tokens` with `token_ranges`, `variables`, `custom_css` and its revision. |
| `get_layout` | `site`, `lang` | The header and footer as blocks, `zone_types` with their fields, `navigation`, and every menu with its id, revision and items. |
| `preview_page` | `site`, `page` (id or address, `/` by default), `version`, `lang`, `environment` (`design` or `staging`), `screenshots`, `scroll` | What your design environment draws for a page (staging when you have none, or with `environment: staging`): the inside of `<body>` (no scripts, at most 60,000 characters), `stylesheets`, and `sections` with their type, classes and `drawn_by` (your template or the parent theme). `version` shows a version of the design theme before it is chosen. With a screenshot service on the site (Integrations), two pictures come along as images: the top of the page at 1280 and at 390 pixels wide. `scroll` takes them that many pixels down instead, to see a sticky header or side bar; this needs engine 1.171.0 on staging. `screenshots: false` leaves them out. `chosen` is the version chosen there. `preview_served` and `served` say what the preview and the ordinary address drew: the theme and the cache, which engine 1.171.0 sends. When `served` differs from what is chosen, a visitor still sees the old one. |
| `get_design_format` | `site` | `steps` that keep a design whole (your own mockup is the source), `engine_classes` for sections and `data.design`, `section_types_in_use`, what a design may hold as staging's engine reads it (`rules`), and a made-up `example` for the syntax. See [Themes without code](/md/docs/themes/without-code/). |
| `get_design` | `site`, `environment` (`design`, `staging`, `live`; your design environment by default when you have one, else `staging`), `version`, `assets` | The design an environment draws, or a version of the site's design: `files` (`layout.html`, `theme.css`, `sections/…`), `assets` (images and fonts by size and hash; with `assets: true` they come as base64 in `files`, up to about 6 MB), `parent`, `engine` and `current`. Pass `current` as `expected_current`. `versions` lists the site's design versions, newest first, with `chosen_on`. `proposals` gives your latest design proposals with their status and, when declined, the reason. A theme with code, made by a developer, is only named. |
| `list_media` | `site`, `query`, `folder`, `kind` (`image`, `document`, `video`, `other`), `used_by` (a page id or address), `used_in_section` (a section type), `used`, `lang`, `offset`, `limit` (at most 100) | Files of Media, newest first. Each has `id`, `ref`, `name`, `folder`, `address`, `mime`, `bytes`, `width`, `height`, `alt` in `lang`, and `used`: how many places use it. `query` looks in the name, folder, alt text and caption; `folder` takes the folders below it too; `used_in_section` gives the files that blocks of that type use, such as `hero`, in the pages' drafts. `used: false` gives the files nothing uses. |
| `get_media` | `site`, `id` (id, ref or address), `lang` | One file: what `list_media` gives, plus `alt_all` (every language), `alt_by_ai`, `caption`, `copyright`, `source`, `serve`, `made`, `used_by` (pages and site parts, with ids) and an `admin` link. Names of people are never given. |
| `get_page` | `site`, `page` (id or address), `version` (`draft`, `live`), `lang` | A page: its title, address, description, status and text. |
| `get_insights` | `site`, `part`, `days` (7, 30, 90) | `visitors`, `bots`, `not_found`, `search_console`, `crux`, `rum`, `carbon` or `health`. Only from what Lightbolt stored. When nothing is there, it gives an `admin_url` to set it up. |
| `get_admin_link` | `site`, `about` or `page` | The screen for it in the admin, for the person to open. |
| `get_dashboard_link` | `site`, `dashboard`, `period` (a preset, or `custom` with `from` and `to`), `compare`, `who` | A lasting `/go/<id>/` link to a dashboard: `url`, `what`, and the period as dates. It is not read-only, because it keeps the link. It is idempotent, so the same request gives the same link. |
| `list_redirects` | `site`, `query`, `limit` | Redirects. |
| `list_tickets` | `site`, `status`, `limit` | Tickets, with a link. |
| `get_form_stats` | `site`, `days` | Per form, how many answers and how many suspect ones, per day. It never gives the answers. |
| `site_searches` | `site`, `days` (7, 30, 90, 400), `only` (`nothing_found`, `not_clicked`) | What visitors search for on the site. Per term: searches, nothing found, clicks, and a `verdict`. Only terms searched 3 times or more. These are anonymous counts. |
| `pages_to_improve` | `site`, `limit` (at most 20), `lang` | The pages to work on first. Each has its `reasons` (`fewer_clicks`, `not_clicked`, `fix`, `old`, `look`), and its editor link. There is no combined score. |

### Changes (scope `write`)

| Tool | Parameters | What it does |
| --- | --- | --- |
| `list_block_types` | `site` | The blocks a page can hold: `richtext`, and the section types with their `fields` (name, type, options, rows), plus `field_types` and `design`. Read only. |
| `update_page` | `site`, `page`, `lang`, `revision` (from `get_page`), `title`, `description`, `ai_context`, `intro`, `operations`, `note`, `publish_staging` | A new draft revision. `operations` run in order: `set` (`index`, `fields`), `replace` (`index`, `block`), `insert` (`index`, `block`), `remove` (`index`), `move` (`index`, `to`). A stale `revision` changes nothing. |
| `create_page` | `site`, `type` (`page`, `blog`), `title`, `under`, `address`, `blocks`, `description`, `ai_context`, `intro`, `note`, `publish_staging` | A new page or blog post as a draft, in the main language, not in a menu. |
| `create_form` | `site`, `name`, `lang`, `fields` (`label`, `type`, `required`, `placeholder`, `options`), `mail_to`, `mail_subject`, `success`, `note`, `publish_staging` | A new form as a draft. |
| `place_form` | `site`, `page`, `form` (id or name), `lang`, `revision`, `position` (`end`, `start` or an index), `text`, `note`, `publish_staging` | The form as a block on the page, as a new draft. |
| `add_redirects` | `site`, `redirects` (`from`, `to`, `code` 301 or 302), `note` | Up to 100 redirects, at once. `to` is a path, a full address or a page id. Each refused one says why. |
| `update_theme` | `site`, `revision` (from `get_theme`), `colours`, `dark_mode`, `fonts`, `tokens`, `variables`, `logo`, `logo_dark` (an image in Media: its `ref` or address), `note` | The theme as a new draft, with only what is passed, published to your design environment. A font is a family from `fonts_available`. What cannot be used is left out, with a line in `notes`. So is text on the background below 4.5:1. |
| `update_layout` | `site`, `zone` (`header`, `footer`), `lang`, `revision` (from `get_layout`), `blocks`, `navigation`, `note` | That zone as a new draft, published to your design environment. Only the section types of `zone_types`. |
| `update_menu` | `site`, `menu` (id or name), `new_name`, `revision`, `items` (`title`, `target`, `depth` 0 to 3), `note`, `publish_staging` | All items of a menu, or a new menu with `new_name`. A target is a page id, a path or a full address. |
| `set_custom_css` | `site`, `css`, `replace`, `revision`, `note` | Adds to the site's own CSS, or replaces it with `replace`, published to your design environment. Checked within the site's size limit. No `@import`, no `url()` to another host. Never JavaScript. |
| `upload_image` | `site`, `name` (with its type, such as `hero.webp`), `image` (`{"base64": …}`) or `url` (https), `alt` (text, or per language), `decorative`, `folder` | An image (jpg, png, gif, webp, avif, svg; at most 10 MB) into Media, in `ai/<app>` under the image folder (`folder` is a subfolder of that), with its alt text and *Via <app>* as source. `alt` is required unless `decorative` is true. Gives `ref` (`cms:media/m_…`) for a block's image field or the logo. Needs `media:write`. |
| `add_font` | `site`, `family` | Adds a font from the free library (Fontsource) by its family name, so `update_theme` can use it. Needs `theme:write`. |
| `publish_design` | `site`, `files` (path to text, or `{"base64": …}` for an image or font), `name`, `parent`, `note`, `mockup`, `base_version`, `remove`, `expected_current`, `activate` | A new version of the site's theme without code (`ai-<site id>`), checked as the engine checks it, kept under the organisation's themes, looked at by the engine on the home page and a page of each other kind (blog overview, post, search, a form, a record), and chosen in your design environment. `routes` says per page how it went (`ok`, `refused`, `error`, `missing`, `not_checked` with the reason). `design_warnings` names what will not show as designed: section types without a template, text blocks, fixed text in a template, an empty main menu, default colours, fixed colours in `theme.css`, fonts the CSS asks for but the site does not load, no logo, and items without their number. Menu, colours, fonts and logo are judged as they are in your design environment. With `mockup` (the mockup's HTML), `mockup_differences` compares it with the home page as it was drawn there. It names headings whose marked words lost their accent, missing headings and buttons, the header's button and menu, and fonts the mockup does not load itself. Each point of `design_warnings` and `mockup_differences` has a `code` that stays the same (such as `fixed_colours` or `items_without_number`), a `severity` and, where it applies, `file` or `files`, `route` or `routes`, and `cause`. `fix` means it will not show as designed. `check` means it may be what you meant, such as steps without numbers. `base_version` builds on a version: its files, with the `files` you pass over them and without those in `remove`. `expected_current` refuses with `staging_changed` when your design environment has something else now. `activate: false` keeps the version without choosing it; `current` says what is chosen, `current_in` where (your design environment), and `staging_has` what staging has. A refusal gives `problems`, or the engine's reason. Needs `theme:write`. |
| `activate_design_version` | `site`, `version`, `expected_current` | Chooses a version of the site's design in your design environment: one kept with `activate: false`, or an older one to go back to. Only when it still has `expected_current` (from `get_design`); otherwise `staging_changed` with `current`. Gives `was` and `current`. Never staging or live. Needs `theme:write`. |
| `propose_design` | `site`, `note` | Puts forward what your design environment has that staging has not: the design version, colours, fonts and logo, header, footer and own CSS. Whoever may publish the theme on staging looks at it under the site's Theme, side by side with staging, with the files that changed and the design's warnings. They put it on staging in one step, or decline it with a reason. `get_design` gives the answer in `proposals`. A newer proposal replaces an open one of yours. It only goes on the staging it was made from. Never live. Needs `theme:write`. |

- `get_page` (version `draft`) gives `revision` and `blocks`, each with its `index`. A block is `{"type": "richtext", "html": "…"}` or `{"type": "<section type>", "data": {…}}`. It is cleaned like the editor cleans it.
- Where a change goes, the organisation chooses under **Where do changes go?**: draft and staging (the start), or only a draft. `publish_staging: false` asks for only a draft; `true` never overrides only a draft. A site without staging, or a person without the right to publish there, gets a draft.
- A change answers with `revision`, `status`, `editor` and, when it went to staging, `see_it`: the address on staging. `status` says it in words, such as *On staging (not live)* or *Draft only, not on staging: …* with the reason.
- `insert`, `remove` and `move` need `content.sections:write`. Other rights: `content:write`, `forms:write`, `redirects:write`, `theme:write` (theme and layout), `navigation:write` (menus) and `code:write` (CSS). Publishing needs the matching `…:publish` right on staging.
- A revision made this way has the note *Via <app>*.

A result comes as `content`, with text or JSON, and as `structuredContent`. A tool error is a result with `isError: true`, and a sentence that says what to do.

When the person can fix it themselves, the error also has:

- `reason`: `app_may_not_change`, `organisation_does_not_allow` or `roles_do_not_allow`;
- `help_url`: the section of the help with the steps. Read it with `get_help_article`, so the steps are always the help's current ones;
- `fix_url`: the person's own screen where they do it;
- `who_can`: names of owners who can allow it, when it is theirs to do.

### Your design environment

Design changes through MCP never go to staging or live. `publish_design`, `activate_design_version`, `update_theme`, `update_layout` and `set_custom_css` go to the person's own design environment of the site. It is made at their first design change: an environment `design-<name>`, with a test address under the test domain. With a wildcard certificate for that domain, HTTPS works at once. Otherwise Plesk gives it a certificate, usually within a quarter of an hour; until then `certificate` in the answers says so, and `preview_page` gives `certificate_pending`. It asks for the test password, as staging does.

- **Content follows staging.** Pages, menus, forms and media come over when staging changes. The theme, header, footer and own CSS are the environment's own. Unused for 30 days, it stops following until the next design change, which brings it up to date.
- **Just made:** its frontend needs a few seconds to know it. `publish_design` waits for that, up to about 45 seconds; if it is not ready yet, `not_ready` says to call `preview_page` in a minute.
- **Engine:** it runs staging's engine version.
- **Nobody publishes there by hand.** It is not in the lists of environments to publish to.
- **To staging:** `propose_design` puts it forward. Whoever may publish the theme on staging looks at it under the site's Theme → Design proposals. They put it on staging in one step, or decline it with a reason.
- **Removing:** the person or the site's managers remove it under Domains and environments. Its design versions stay.

`update_menu` and page changes go as before.

## Limits and errors

- Each connection can make 120 calls a minute, and 2,000 an hour. Over that, it gets `429` with `Retry-After`. It can make at most 200 changes an hour.
- The JSON-RPC errors are:
  - `-32700`: not JSON;
  - `-32600`: an invalid request;
  - `-32601`: an unknown method;
  - `-32001`: not signed in;
  - `-32002`: too many calls.
- Each tool checks the rights of the person on that site. The organisation setting **AI apps** comes on top of that.

## Good to know

- Every `tools/call` is counted per day, organisation, app, tool and outcome: `ok`, the `reason` of the error, `refused` or `failed`. Nothing else is kept, and only for 90 days. An organisation sees its own under **Organisation → Security → Usage**; platform staff see all under **Platform → MCP**.
- `/.well-known/` must reach PHP on the server. Some hosting answers it from the web server itself.
- Platform staff set the instructions, the tool descriptions and the address of the help search, under **Platform → MCP**, with their history.
- Every connection and disconnection is in the **Activity** of the organisation. So is a refresh token that was used again.

*Also called: model context protocol, AI connector, Claude connector, ChatGPT connector, MCP endpoint, remote MCP.*

Last changed 26 November 2026
