# Connect via MCP

> Complete Streamable HTTP JSON-RPC 2.0 specification, client configuration snippets, and full tool reference for all 14 native OvertCMS MCP tools on POST /mcp.

OvertCMS Core ships a **native Streamable HTTP Model Context Protocol (MCP) server** directly on the Agent Plane at `POST /mcp`—no sidecar adapter, proxy, or Node.js bridge required.

---

## Transport & Protocol Specification

| Property | Value |
| --- | --- |
| Endpoint | `POST /mcp` (non-`POST` requests return `405 method_not_allowed`) |
| Protocol | JSON-RPC 2.0 over Streamable HTTP |
| Advertised MCP Version | `2025-03-26` |
| Server Identity | `{ "name": "overt-cms-core", "version": "<core-version>" }` |
| Authentication | `Authorization: Bearer ocms_<live\|test>_<id>_<secret>` (identical Agent Plane middleware: API keys only, IP allowlist, RPM & daily write/media caps, kill switch) |
| Max Request Body | **36 MiB** (`MaxMCPRequestBodyBytes`, accommodating base64 payloads for `cms_upload_media`) |
| Content-Type | `application/json` |

### JSON-RPC 2.0 Methods

| Method | Behavior |
| --- | --- |
| `initialize` | Returns `protocolVersion` (`"2025-03-26"`), `capabilities: { "tools": {} }`, and `serverInfo`. |
| `notifications/initialized` | Standard client handshake notification. If `"id"` is absent, returns **`202 Accepted`** with an empty body; if `"id"` is present, returns `{}`. |
| `ping` | Returns `{}`. |
| `tools/list` | Returns the tool catalog for the caller's API key. **`cms_manage_schema` is hidden without `schema:write`, and `cms_manage_site`, `cms_manage_visibility`, and `cms_manage_redirects` are hidden without `site:write`.** |
| `tools/call` | Executes one of the 14 tools with strict unknown-field argument decoding and exact JSON number preservation. |

### Case-Sensitive `"id"` & Notification Rules

- `"id"` is matched **case-sensitively** (`"id"`, not `"ID"`).
- When `"id"` is **omitted**, the message is treated as a JSON-RPC 2.0 notification and receives **`202 Accepted`** with an empty body.
- When `"id"` is **present**, it must be a JSON string, number, or `null` (objects/arrays/booleans fail with `-32600`).

### Protocol Errors vs Tool Execution Errors

- **JSON-RPC protocol errors** return HTTP `200` with a top-level `"error"` object:
  - `-32700` — JSON parse error or body read failure
  - `-32600` — Invalid JSON-RPC 2.0 envelope, invalid `"id"`, or payload exceeding 36 MiB
  - `-32601` — Unknown JSON-RPC method or unknown tool name
  - `-32602` — Malformed `tools/call` params or empty tool name
- **Domain, authz, and validation errors** (such as `422 validation_error`, `409 version_conflict`, `403 insufficient_scope`, `503 agent_writes_paused`) return HTTP `200` with a JSON-RPC `result` whose `isError` is `true` and whose `content[0].text` contains the canonical OvertCMS `ErrorEnvelope` (`{ "error": { "code", "message", "retryable", "applied", "issues", "details" } }`).
- **Strict argument validation:** Every tool rejects unrecognized argument keys with `invalid_arguments`.

---

## Client Configuration Snippets

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "overtcms": {
      "url": "https://cms.example.dev/mcp",
      "headers": {
        "Authorization": "Bearer ocms_live_0123456789abcdef_your64hexsecret..."
      }
    }
  }
}
```

### Cursor (`.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "overtcms": {
      "type": "http",
      "url": "https://cms.example.dev/mcp",
      "headers": {
        "Authorization": "Bearer ocms_live_0123456789abcdef_your64hexsecret..."
      }
    }
  }
}
```

### Generic HTTP JSON-RPC Client (`curl`)

```bash
curl -s -X POST https://cms.example.dev/mcp \
  -H "Authorization: Bearer ocms_live_0123456789abcdef_..." \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "initialize",
    "params": {}
  }'
```

---

## Complete Reference: All 14 Native MCP Tools

### Tool Summary Matrix

| # | Tool Name | Required Scope(s) | Idempotent? | Purpose |
| --- | --- | --- | --- | --- |
| 1 | `cms_get_context` | `schema:read` | Read-only | Site metadata, fingerprint, accessible post types, components |
| 2 | `cms_get_post_type_schema` | `schema:read` + postType read | Read-only | Full schema & transitive components for one post type |
| 3 | `cms_search_reference_options` | `entries:read` + postType read | Read-only | Search target entries for a reference field (with empty-search rescue) |
| 4 | `cms_query_entries` | `entries:read` + postType read | Read-only | Filter, sort, search, and cursor-paginate entries |
| 5 | `cms_get_entry` | `entries:read` + postType read | Read-only | Fetch one entry by ID or slug |
| 6 | `cms_create_entry` | `entries:write` (+ `entries:publish` for non-draft) | Yes (`idempotencyKey`) | Create entry or validate with `dryRun: true` |
| 7 | `cms_update_entry` | `entries:write` (+ `entries:publish` for scheduled/live schedule edits) | Yes (`idempotencyKey`) | Partial update with `expectedVersion`, `clearFields`, `bodyPatches` |
| 8 | `cms_batch_entries` | `entries:write` (+ per-item publish/delete scopes) | Yes (`idempotencyKey`) | Execute up to 50 operations on one post type |
| 9 | `cms_transition_entry` | `entries:publish` / `entries:delete` / `entries:write` | Yes (`idempotencyKey`) | `publish`, `schedule`, `unpublish`, `archive`, `trash`, `restore` |
| 10 | `cms_upload_media` | `media:write` | Yes (`idempotencyKey`) | Upload via SSRF-safe `url` sideload or direct `dataBase64` |
| 11 | `cms_manage_schema` | **`schema:write`** (`schema_admin` preset) | Yes (`idempotencyKey`) | Create/update/delete components and post types (hidden without scope) |
| 12 | `cms_manage_site` | **`site:write`** (`schema_admin` preset) | Yes (`idempotencyKey`) | Read or update site name, `baseUrl`, `timezone`, `locales`, and editorial AI `instruction` (hidden without scope) |
| 13 | `cms_manage_visibility` | **`site:write`** (`schema_admin` preset) | Yes (`idempotencyKey`) | Read, update, or preview SEO/AEO visibility (`robots.txt`, `sitemap.xml`, RSS, `llms.txt`, `llms-full.txt`, AI crawlers, OG/logo assets, JSON-LD) |
| 14 | `cms_manage_redirects` | **`site:write`** (`schema_admin` preset) | Yes (`idempotencyKey`) | List, create/upsert, or delete HTTP redirect rules (`301`/`302`/`307`/`308`) |

---

### 1. `cms_get_context`

Returns site metadata, `agentWritesPaused`, `schemaVersion`, `schemaFingerprint`, summaries of accessible post types (filtered by `allowedPostTypes`), and all reusable components.

- **Required scope:** `schema:read`
- **Arguments:** `{}` (no parameters accepted)

```json
{
  "jsonrpc": "2.0",
  "id": "ctx-1",
  "method": "tools/call",
  "params": {
    "name": "cms_get_context",
    "arguments": {}
  }
}
```

---

### 2. `cms_get_post_type_schema`

Returns the full `PostTypeSchemaContract` for one post type, including all field definitions, constraints, instructions, populated `searchEndpoint` paths, and the transitive closure of referenced components.

- **Required scope:** `schema:read` + `read` access on `postType`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `postType` | `string` | Yes | Post-type slug (e.g., `"posts"`). |

---

### 3. `cms_search_reference_options`

Searches eligible non-trashed target entries for a `reference` field using accent/case-folded matching, cursor pagination, and empty-search `suggestedOptions` rescue (when `totalEligible <= 50`).

- **Required scope:** `entries:read` + `read` access on `postType` (target results are also filtered by the key's `allowedPostTypes`)

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `postType` | `string` | Yes | Source post-type slug. |
| `fieldKey` | `string` | Yes | Reference field key or dot-path (e.g., `"author"` or `"seo.primaryAuthor"`). |
| `query` | `string` | No | Accent/case-folded search term. |
| `target` | `string` | No | Narrow search to one target post-type slug on polymorphic references. |
| `limit` | `integer` | No | Page size (default `20`, max `100`). |
| `cursor` | `string` | No | Opaque `nextCursor` from a previous call. |

---

### 4. `cms_query_entries`

Lists, searches, filters, and sorts entries in a collection using keyset cursor pagination.

- **Required scope:** `entries:read` + `read` access on `postType`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `postType` | `string` | Yes | Collection post-type slug. |
| `statuses` | `string[]` | No | Filter by lifecycle statuses (`draft`, `scheduled`, `published`, `archived`, `trashed`). |
| `includeTrashed` | `boolean` | No | Include `trashed` entries when `statuses` is omitted. |
| `locale` | `string` | No | Filter by locale code (e.g., `"en"`). |
| `query` | `string` | No | Accent/case-folded search across display label, slug, and text fields. |
| `filters` | `object` | No | Nested map `{ "<field>": { "<op>": "<value>" } }` supporting `eq`, `in`, `contains`, `gte`, `lte`. |
| `sort` | `string` | No | Sort field with optional `-` prefix for descending (default `"-createdAt"`). |
| `limit` | `integer` | No | Page size (default `20`, max `100`). |
| `cursor` | `string` | No | Opaque `nextCursor` matching active `sort`. |

```json
{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "tools/call",
  "params": {
    "name": "cms_query_entries",
    "arguments": {
      "postType": "posts",
      "statuses": ["draft", "published"],
      "filters": {
        "featured": { "eq": "true" }
      },
      "sort": "-updatedAt",
      "limit": 10
    }
  }
}
```

---

### 5. `cms_get_entry`

Fetches a single entry by ID or slug (returning both `draftData` and `publishedData`, `version`, `etag`, and status metadata).

- **Required scope:** `entries:read` + `read` access on `postType`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `postType` | `string` | Yes | Post-type slug. |
| `idOrSlug` | `string` | Yes | Entry UUIDv7 ID or slug. |
| `locale` | `string` | No | Optional locale disambiguator when looking up by slug. |

---

### 6. `cms_create_entry`

Creates a new entry (`draft`, `published`, or `scheduled`) or validates without writing when `dryRun: true`.

- **Required scope:** `entries:write` + `write` access on `postType`. Creating directly as `published` or `scheduled` (or setting `scheduledAt` / `unpublishAt`) additionally requires `entries:publish`.
- **Idempotency:** Supported via `idempotencyKey` (skipped when `dryRun: true`).
- **Schema drift:** Supported via `ifSchemaFingerprint` (returns `schemaWarnings` on non-breaking capability gain, or `409 schema_drift_detected` on breaking drift).

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `postType` | `string` | Yes | Post-type slug. |
| `data` | `object` | Yes | Entry field payload matching the post-type schema. |
| `locale` | `string` | No | Site locale (defaults to site's `defaultLocale`). |
| `translationGroupId` | `string` | No | Shared ID linking localized translations of the same content. |
| `status` | `"draft"` \| `"published"` \| `"scheduled"` | No | Initial status (default `"draft"`). |
| `slug` | `string` | No | Optional explicit slug (must not conflict with `data.<slugField>`). |
| `scheduledAt` | `string` (RFC3339) | No | Required when `status: "scheduled"` (at least 30s in the future). |
| `unpublishAt` | `string` (RFC3339) | No | Optional future auto-unpublish timestamp. |
| `commitMessage` | `string` | No | Human-readable version history message. |
| `dryRun` | `boolean` | No | When `true`, validates everything without writing to the database. |
| `idempotencyKey` | `string` | No | Actor-scoped deduplication key (max 128 chars). |
| `ifSchemaFingerprint` | `string` | No | Cached site or post-type fingerprint for drift detection. |

---

### 7. `cms_update_entry`

Partially updates an entry's `draftData` with mandatory optimistic locking (`expectedVersion` or `expectedEtag`), safe null semantics, `clearFields`, and surgical `bodyPatches`.

- **Required scope:** `entries:write` + `write` access on `postType`. Editing a `scheduled` entry or modifying `unpublishAt`/`clearUnpublishAt` on a `scheduled`/`published` entry additionally requires `entries:publish`.
- **Idempotency & drift:** Supported via `idempotencyKey` and `ifSchemaFingerprint`.

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `postType` | `string` | Yes | Post-type slug. |
| `idOrSlug` | `string` | Yes | Entry ID or slug. |
| `expectedVersion` | `integer` | Conditional | Current entry `version` (required unless `expectedEtag` is supplied). |
| `expectedEtag` | `string` | Conditional | Current entry `etag` (alternative to `expectedVersion`). |
| `slug` | `string` | No | Updated slug. |
| `data` | `object` | No | Partial field updates merged onto existing `draftData`. |
| `clearFields` | `string[]` | No | Top-level field keys to clear explicitly. |
| `bodyPatches` | `object` | No | Map of `{ "<richHtmlField>": [ { op, oldHtml?, newHtml?, anchorHtml?, insertHtml? } ] }`. |
| `nullClears` | `boolean` | No | When `true`, `null` values in `data` clear fields (same as `X-Null-Semantics: clear`). Default `false`. |
| `unpublishAt` | `string` (RFC3339) | No | Updated auto-unpublish timestamp. |
| `clearUnpublishAt` | `boolean` | No | Clears existing `unpublishAt` schedule. |
| `commitMessage` | `string` | No | Version history message. |
| `idempotencyKey` | `string` | No | Actor-scoped deduplication key. |
| `ifSchemaFingerprint` | `string` | No | Cached fingerprint for drift detection. |

---

### 8. `cms_batch_entries`

Executes between **1 and 50** entry operations sequentially on one post type and returns per-item receipts.

- **Required scope:** `entries:write` + `write` access on `postType`, plus `entries:publish` if any item uses `publish`, `schedule`, `unpublish`, `archive`, or non-draft `create`, and `entries:delete` if any item uses `trash`.
- **Idempotency:** Supported via `idempotencyKey`.

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `postType` | `string` | Yes | Post-type slug. |
| `items` | `BatchEntryItem[]` | Yes | 1–50 items (`op`: `create`, `update`, `publish`, `schedule`, `unpublish`, `archive`, `trash`). |
| `idempotencyKey` | `string` | No | Actor-scoped deduplication key for the entire batch. |

---

### 9. `cms_transition_entry`

Transitions an entry's lifecycle state (`publish`, `schedule`, `unpublish`, `archive`, `trash`, or `restore`).

- **Required scope:** `write` access on `postType` plus:
  - `publish`, `schedule`, `unpublish`, `archive` → `entries:publish`
  - `trash` → `entries:delete` (agents can never `force: true` past strong references)
  - `restore` → `entries:write`
- **Idempotency:** Supported via `idempotencyKey`.

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `postType` | `string` | Yes | Post-type slug. |
| `idOrSlug` | `string` | Yes | Entry ID or slug. |
| `action` | `string` | Yes | One of `"publish"`, `"schedule"`, `"unpublish"`, `"archive"`, `"trash"`, `"restore"`. |
| `expectedVersion` | `integer` | Conditional | Optimistic lock version (or pass `expectedEtag`). |
| `expectedEtag` | `string` | Conditional | Optimistic lock ETag. |
| `scheduledAt` | `string` (RFC3339) | Conditional | Required for `action: "schedule"` (> 30s in the future). |
| `unpublishAt` | `string` (RFC3339) | No | Optional future auto-unpublish timestamp (`publish` / `schedule`). |
| `confirmUnpublish` | `boolean` | Conditional | **Required (`true`)** when `unpublish`, `archive`, or `trash` targets a `published` entry. |
| `commitMessage` | `string` | No | Version history message. |
| `idempotencyKey` | `string` | No | Actor-scoped deduplication key. |

---

### 10. `cms_upload_media`

Uploads a new media asset into the site's Media Library via **either** an SSRF-protected remote URL sideload (`url`) **or** direct base64 bytes (`dataBase64`), returning `{ asset, deduplicated }`.

- **Required scope:** `media:write` (also enforced against per-key daily write count and daily media byte quota)
- **Idempotency:** Supported via `idempotencyKey`.

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `url` | `string` | XOR | Remote HTTP/HTTPS URL to SSRF-safe sideload. Provide **exactly one** of `url` or `dataBase64`. |
| `dataBase64` | `string` | XOR | Standard base64-encoded binary payload. Provide **exactly one** of `url` or `dataBase64`. |
| `filename` | `string` | No | Preferred filename (sanitized server-side). |
| `contentType` | `string` | No | Declared MIME type (verified against magic-byte sniffing). |
| `alt` | `string` | No | Default alt text stored on the asset. |
| `caption` | `string` | No | Default caption. |
| `title` | `string` | No | Default title. |
| `credit` | `string` | No | Attribution / photo credit. |
| `focalPoint` | `{ x: number, y: number }` | No | Default focal point coordinates in `[0, 1]`. |
| `isEphemeral` | `boolean` | No | Marks asset for automatic expiration cleanup. |
| `expiresAt` | `string` (RFC3339) | No | Optional expiration timestamp. |
| `idempotencyKey` | `string` | No | Actor-scoped deduplication key. |

---

### 11. `cms_manage_schema`

Creates, updates, or deletes reusable components and post types.

<Warning>
  **Strict Security Boundary:** `cms_manage_schema` is **omitted from `tools/list`** and rejects `tools/call` with `403 insufficient_scope` unless the API key holds the `schema:write` scope (included only in the `schema_admin` preset). Post-type mutations also enforce `write` access in `allowedPostTypes`.
</Warning>

- **Required scope:** `schema:write`
- **Idempotency:** Supported via `idempotencyKey`.

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `action` | `string` | Yes | `"create_component"`, `"update_component"`, `"delete_component"`, `"create_post_type"`, `"update_post_type"`, or `"delete_post_type"`. |
| `slug` | `string` | Yes | Component or post-type slug. |
| `label` | `string` | Conditional | Component label (`create_component` / `update_component`). |
| `singularName` | `string` | Conditional | Post-type singular name (`create_post_type` / `update_post_type`). |
| `pluralName` | `string` | Conditional | Post-type plural name (`create_post_type` / `update_post_type`). |
| `kind` | `"collection"` \| `"singleton"` | No | Post-type kind (default `"collection"`). |
| `instruction` | `string` | No | Component or post-type editorial instruction. |
| `aiWritable` | `boolean` | No | Component `aiWritable` flag (default `true`). |
| `capabilities` | `object` | No | Post-type lifecycle capabilities (`draft`, `publish`, `schedule`, `delete`, `localize`). |
| `urlTemplate` | `string` | No | Post-type URL template (e.g., `"/blog/{slug}"`). |
| `displayField` | `string` | No | Field key used as primary display label. |
| `slugSourceField` | `string` | No | Field key used to auto-generate slugs. |
| `fields` | `FieldDefinition[]` | No | Field list for the component or post type. |
| `clearFields` | `string[]` | No | Metadata fields to clear on update (`["instruction"]` for components; `["instruction", "urlTemplate", "displayField", "slugSourceField"]` for post types). |
| `confirmBreakingChange` | `boolean` | Conditional | Required (`true`) when an update introduces breaking drift or when deleting a post type. |
| `idempotencyKey` | `string` | No | Actor-scoped deduplication key. |

```json
{
  "jsonrpc": "2.0",
  "id": 11,
  "method": "tools/call",
  "params": {
    "name": "cms_manage_schema",
    "arguments": {
      "action": "create_component",
      "slug": "callout",
      "label": "Callout Box",
      "instruction": "Highlight important caveats inside article bodies.",
      "fields": [
        {
          "key": "tone",
          "label": "Tone",
          "type": "select",
          "required": true,
          "requiredOn": "publish",
          "constraints": {
            "options": [
              { "value": "info", "label": "Info" },
              { "value": "warning", "label": "Warning" }
            ]
          }
        },
        {
          "key": "body",
          "label": "Body",
          "type": "text",
          "required": true,
          "requiredOn": "publish",
          "constraints": { "disallowHtml": true }
        }
      ],
      "idempotencyKey": "schema-callout-v1"
    }
  }
}
```

---

### 12. `cms_manage_site`

Reads or updates site-level editorial configuration (`name`, `baseUrl`, `timezone`, `defaultLocale`, `locales`, `instruction`, and `clearFields`). Security and control-plane toggles such as `agentWritesPaused` remain strictly Admin Plane only.

- **Required scope:** `site:write` (hidden from `tools/list` without scope; requires unrestricted `allowedPostTypes` on `update`)
- **Idempotency:** Supported via `idempotencyKey`.

### 13. `cms_manage_visibility`

Reads (`action: "get"`), updates (`action: "update"`), or previews (`action: "preview"`) technical SEO & AEO visibility settings — including `robots.txt`, `sitemap.xml`, RSS, `/llms.txt`, `/llms-full.txt`, AI crawler policies, per-model visibility rules, JSON-LD entity identity, and default OG/logo media asset IDs (which can be uploaded first via `cms_upload_media`).

- **Required scope:** `site:write` (hidden from `tools/list` without scope; requires unrestricted `allowedPostTypes` on `update` and `preview`)
- **Idempotency:** Supported via `idempotencyKey`.

### 14. `cms_manage_redirects`

Lists (`action: "list"`), creates/upserts (`action: "create"`), or deletes (`action: "delete"`) HTTP redirect rules (`301`, `302`, `307`, `308`).

- **Required scope:** `site:write` (hidden from `tools/list` without scope; requires unrestricted `allowedPostTypes`)
- **Idempotency:** Supported via `idempotencyKey`.
