@se-studio/contentful-cms 3.11.2 → 3.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/cli/local-cli-allowed.d.ts +1 -1
- package/dist/cli/local-cli-allowed.d.ts.map +1 -1
- package/dist/cli/local-cli-allowed.js +1 -0
- package/dist/cli/local-cli-allowed.js.map +1 -1
- package/dist/cli/program.d.ts.map +1 -1
- package/dist/cli/program.js +2 -0
- package/dist/cli/program.js.map +1 -1
- package/dist/commands/patterns.d.ts +4 -0
- package/dist/commands/patterns.d.ts.map +1 -0
- package/dist/commands/patterns.js +107 -0
- package/dist/commands/patterns.js.map +1 -0
- package/dist/contentful/cda-page.d.ts +27 -0
- package/dist/contentful/cda-page.d.ts.map +1 -0
- package/dist/contentful/cda-page.js +111 -0
- package/dist/contentful/cda-page.js.map +1 -0
- package/dist/contentful/cma-user-agent.d.ts +1 -1
- package/dist/editor-pack/capabilities.d.ts +2 -0
- package/dist/editor-pack/capabilities.d.ts.map +1 -1
- package/dist/editor-pack/capabilities.js +4 -0
- package/dist/editor-pack/capabilities.js.map +1 -1
- package/dist/editor-pack/generate.d.ts.map +1 -1
- package/dist/editor-pack/generate.js +10 -0
- package/dist/editor-pack/generate.js.map +1 -1
- package/dist/generated/help-topics.d.ts +1 -1
- package/dist/generated/help-topics.d.ts.map +1 -1
- package/dist/generated/help-topics.js +2 -2
- package/dist/generated/help-topics.js.map +1 -1
- package/dist/generated/hosted-guide.d.ts +1 -1
- package/dist/generated/hosted-guide.d.ts.map +1 -1
- package/dist/generated/hosted-guide.js +1 -1
- package/dist/generated/hosted-guide.js.map +1 -1
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/hosted/next/routes/health.d.ts.map +1 -1
- package/dist/hosted/next/routes/health.js +4 -0
- package/dist/hosted/next/routes/health.js.map +1 -1
- package/dist/mcp/tools/cms-edit.d.ts +1 -1
- package/dist/mcp/tools/cms-edit.d.ts.map +1 -1
- package/dist/mcp/tools/cms-edit.js +1 -1
- package/dist/mcp/tools/media.d.ts.map +1 -1
- package/dist/mcp/tools/media.js +4 -2
- package/dist/mcp/tools/media.js.map +1 -1
- package/dist/media-pipeline/config.d.ts +21 -0
- package/dist/media-pipeline/config.d.ts.map +1 -1
- package/dist/media-pipeline/config.js +60 -0
- package/dist/media-pipeline/config.js.map +1 -1
- package/dist/media-pipeline/index.d.ts +1 -1
- package/dist/media-pipeline/index.d.ts.map +1 -1
- package/dist/media-pipeline/index.js +1 -1
- package/dist/media-pipeline/index.js.map +1 -1
- package/dist/patterns/census.d.ts +8 -0
- package/dist/patterns/census.d.ts.map +1 -0
- package/dist/patterns/census.js +197 -0
- package/dist/patterns/census.js.map +1 -0
- package/dist/patterns/cluster.d.ts +19 -0
- package/dist/patterns/cluster.d.ts.map +1 -0
- package/dist/patterns/cluster.js +353 -0
- package/dist/patterns/cluster.js.map +1 -0
- package/dist/patterns/markdown.d.ts +3 -0
- package/dist/patterns/markdown.d.ts.map +1 -0
- package/dist/patterns/markdown.js +88 -0
- package/dist/patterns/markdown.js.map +1 -0
- package/dist/patterns/types.d.ts +70 -0
- package/dist/patterns/types.d.ts.map +1 -0
- package/dist/patterns/types.js +2 -0
- package/dist/patterns/types.js.map +1 -0
- package/dist/patterns/write.d.ts +7 -0
- package/dist/patterns/write.d.ts.map +1 -0
- package/dist/patterns/write.js +16 -0
- package/dist/patterns/write.js.map +1 -0
- package/dist/project/doctor.d.ts.map +1 -1
- package/dist/project/doctor.js +8 -0
- package/dist/project/doctor.js.map +1 -1
- package/docs/editor-tasks/clone-page.md +2 -0
- package/docs/editor-tasks/media-pipeline-prepare.md +4 -1
- package/docs/editor-tasks/media-reuse-and-upload.md +1 -1
- package/docs/help/index.md +1 -0
- package/docs/help/patterns.md +33 -0
- package/docs/mcp/e2e-test-prompt.md +1 -0
- package/docs/mcp/hosted-guide.md +4 -1
- package/package.json +1 -1
- package/skills/core/SKILL.md +5 -4
- package/skills/editor-tasks/SKILL.md +4 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const HOSTED_GUIDE_TEMPLATE = "# cms-edit MCP guide\n\nUse this guide when editing Contentful draft content through a hosted MCP connector (Claude Desktop Integrations + OAuth, or Grok Build).\n\n{{SITE_INTRO}}\n\n## Safety rules\n\ncms-edit **cannot and will not**:\n\n- Publish or unpublish entries\n- Archive or delete published entries\n\nAll `save` operations create **drafts only**. A human must review and publish in Contentful.\n\n**Assets:** cms-edit **can upload** draft assets via **staged upload** (hosted) or `--url` (public HTTPS last resort). **`--base64` is not supported on hosted MCP.** Always **search and reuse existing assets first** (`index sync`, then `asset search` or `list --type media`). Use `--if-exists-by-filename` when uploading to avoid duplicates.\n\n## MCP tools\n\n| Tool | Purpose |\n|------|---------|\n| `cms_edit` | Run any cms-edit command via an `args` array |\n| `cms_edit_request_staged_upload` | Presigned URL. `kind=asset` (default): binaries. `kind=text`: HtmlComponent fields then `set --staged`. `kind=json`: `create from-json --staged`. |\n| `cms_edit_version` | Check the installed cms-edit version (no session required) |\n| `cms_edit_help` | Guide topics (`overview`, `workflow`, `commands`, `troubleshooting`, `hosted`) **or** playbooks (`create-from-json`, `fields-html-component`, `fields-component`, \u2026) |\n\n## Customer editor pack (read first)\n\nWhen a site editor pack is deployed, these MCP resources provide **site-specific** context. Read them before creating or editing content:\n\n| Resource | Purpose |\n|----------|---------|\n| `cms-edit://customer/index` | List of all customer resources |\n| `cms-edit://customer/tasks-index` | Intent \u2192 task playbook map (filtered for this site) |\n| `cms-edit://customer/capabilities` | Machine-readable list of what this site supports |\n| `cms-edit://customer/checklist` | First-session onboarding steps |\n| `cms-edit://customer/overview` | Site name, space, staging URL, handoff rules |\n| `cms-edit://customer/routing` | Article/tag URL rules for this site |\n| `cms-edit://customer/production-site` | Production URL and how to fetch page markdown (do not guess `.md` URLs) |\n| `cms-edit://customer/components-index` | Component types and when to use each |\n| `cms-edit://customer/collections-index` | Collection types |\n| `cms-edit://customer/brand` | Brand voice and terminology (if configured) |\n| `cms-edit://customer/articles` | Article/publication playbook (if configured) |\n| `cms-edit://customer/defaults` | Featured image rules and article types (if configured) |\n| `cms-edit://customer/site-facts` | Optional canonical business facts (if configured) |\n| `cms-edit://customer/task-*` | Capability playbooks (e.g. `task-media-reuse-and-upload`) |\n\n**Workflow:** read `tasks-index` \u2192 `capabilities` \u2192 `checklist` \u2192 `overview` \u2192 `routing` \u2192 `production-site` \u2192 pick a `task-*` playbook for your goal \u2192 `components-index` \u2192 then use `cms_edit` commands.\n\n## MCP prompts\n\n| Prompt | Purpose |\n|--------|---------|\n| `cms_edit_verify` | Check version and connectivity |\n| `cms_edit_explore` | List site content and open a page |\n| `cms_edit_edit_page` | Edit a page through diff \u2192 save |\n| `cms_edit_edit_article` | Edit an article through diff \u2192 save |\n| `cms_edit_index_sync` | Build/refresh local index (assets, media, templates, taxonomy) |\n| `cms_edit_create_page` | Create a page with template selection |\n| `cms_edit_create_article` | Create an article (requires article type; featured image rules) |\n| `cms_edit_create_from_doc` | Create a page from a freeform document (infer \u2192 confirm \u2192 dry-run) |\n| `cms_edit_create_article_from_doc` | Create an article from a freeform document |\n| `cms_edit_taxonomy` | Import taxonomy entries (`create \u2026 --if-not-exists`) |\n| `cms_edit_bulk_seo` | Update SEO meta descriptions (read `task-seo-descriptions`) |\n| `cms_edit_bulk_find_replace` | Bulk find-replace in rich text across entries |\n| `cms_edit_bulk_article_tags` | Update tags on one or more articles |\n| `cms_edit_import_authors` | Create person/author entries from a list or sheet |\n| `cms_edit_media` | Find existing assets or upload new ones (reuse-first) |\n\nRead the full guide anytime via the `cms-edit://guide` resource or `cms_edit_help`.\n\n## End-to-end QA prompt\n\nFor release QA after cms-edit or editor-pack upgrades, use a **copy-paste Claude Desktop test script** (phases: connector \u2192 customer resources \u2192 discovery \u2192 session \u2192 schema \u2192 media \u2192 dry-run writes \u2192 negatives). See [e2e-test-prompt.md](./e2e-test-prompt.md) to author one per customer site. Example: Brightline `docs/cms-edit/MCP-E2E-TEST.md`.\n\n## Core workflow\n\nStandard editing flow: **open \u2192 snapshot \u2192 read \u2192 set/rtf \u2192 diff \u2192 save**\n\nEach step is a separate `cms_edit` call. Sessions persist in Redis between calls (hosted) or on disk (local). MCP auto-uses session `_mcp`.\n\n### 1. Open a page\n\n```\n[\"open\", \"--page-slug\", \"/\"]\n[\"open\", \"--page-slug\", \"/pricing\"]\n[\"open\", \"--id\", \"<entry-id>\"]\n[\"open\", \"--include-chrome\", \"--page-slug\", \"/pricing\"]\n```\n\nDefault `open` / `peek` fetch the page or article tree and the template entry, but **not** template menu/footer/navigation. Edit nav with `[\"nav\", \"open\", \"--nav-id\", \"<id>\"]` or `--nav-name` (not `--id`). Use `--include-chrome` only when you need those trees. Template `menu` is site-wide; `page.menu` overrides one page. Nested nav items are often shared \u2014 ask global vs page-specific before `set`.\n\n**Homepage (all SE Studio sites):** Contentful stores the marketing homepage slug as `index`. The live site URL is `/`. In cms-edit, `--page-slug /` and `--page-slug /index` are equivalent (both resolve to `index`). Read `cms-edit://customer/routing` for site-specific exceptions (e.g. Pedestal uses `home`).\n\n### 2. Snapshot \u2014 see the content tree\n\n```\n[\"snapshot\"]\n```\n\nOutput shows `@c0`, `@c1`, \u2026 refs for each component. Use these refs in `read`, `set`, and `rtf`.\n\n### 3. Read fields\n\n```\n[\"read\", \"@c1\"]\n[\"read\", \"@c1\", \"heading\"]\n```\n\n### 4. Edit fields\n\n```\n[\"set\", \"@c1\", \"heading\", \"New heading text\"]\n[\"rtf\", \"@c1\", \"body\", \"--content\", \"# Title\\n\\nParagraph text.\"]\n```\n\nFor rich text, prefer `--content` with inline markdown. Use `--base64` when special characters cause issues.\n\n### 5. Review and save\n\n```\n[\"diff\"]\n[\"save\"]\n```\n\nAlways run `diff` before `save`. To abandon changes: `[\"discard\"]`.\n\n## When to use Contentful UI\n\n| Task | Where |\n|------|-------|\n| Edit copy, add sections, create pages/articles | **Agent + cms-edit** (drafts) |\n| Upload new images and files | **Agent + cms-edit** \u2014 search/reuse first; raster/video via `cms_edit_media` import |\n| Publish approved drafts | **Contentful UI** |\n| Edit copy directly in Contentful | **Avoid** \u2014 use cms-edit instead |\n\ncms-edit saves **drafts only**. A colleague must **publish in Contentful** for changes to go live.\n\n## Asset upload (hosted MCP)\n\nHosted connectors have **no server filesystem** and **reject `asset upload --base64`**. Raster/video: staged intake then **media pipeline**. SVG/PDF/Lottie: staged then `asset upload --staged`.\n\n| Source | When | Example |\n|--------|------|---------|\n| **Staged + pipeline** | jpeg/png/webp/gif/mp4 | `cms_edit_media` prepare `stagedUploadIds` \u2192 import (required for video) |\n| **`--url`** | Pipeline-ready **images** only, or SVG/PDF | `[\"asset\", \"upload\", \"--url\", \"https://\u2026.blob.vercel-storage.com/ready.jpg\"]` |\n| **Staged consume** | SVG/PDF/Lottie | `asset upload --staged` |\n\n**After upload:** note the returned asset `id`, attach to the entry (`asset set @root media <id>` for person portraits), then `diff` \u2192 `save`. Upload alone does not update entries.\n\n**PNG** when transparency matters.\n\nFull workflow: `cms-edit://customer/task-media-reuse-and-upload`.\n\n### Common pitfalls (agents)\n\n| Issue | Do this |\n|-------|---------|\n| Singular Media on a component (`visual`) | `set @cN visual <mediaId> --link` \u2014 **not** `add \u2026 --target visual` |\n| Shared Drive folder has extra files | Import with `sourceNames` or `onlyWithOverrides` after catalog |\n| Prepare says no media / empty folder | Share folder **Viewer** with `media-pipeline-reader@se-media-pipeline.iam.gserviceaccount.com`, then re-prepare once |\n| MCP tool times out ~180s | `read` / `diff` / re-`catalog` before retrying the same write \u2014 server may already have saved |\n| `preview urls` has no Live Preview URL | Not a failed save. For **draft-only** pages use **siteLivePreview** (`/preview?id=`). Staging `showsDrafts` is false unless `DRAFT_ONLY`. |\n| Reuse-first import matches old fileNames | dry-run first; set `overrides[].fileName` for unique names when duplication is required |\n\n### Staged upload\n\nKeeps binary **and large text/JSON** out of MCP tool args. The agent uploads via `curl`, then passes only a short `uploadId`.\n\n1. `cms_edit_request_staged_upload` with `fileName`, `mimeType`, optional `kind` (`asset` \\| `text` \\| `json`), optional `byteLength`, optional `title`. If the wrapper schema has no `kind`, use `cms_edit` `[\"staged-upload\", \"request\", \"--kind\", \"json\", \"--file-name\", \"...\", \"--mime\", \"application/json\"]` (or `--kind text` for HtmlComponent fields).\n2. Run the returned `curlCommand` in a shell (POST multipart to `uploadUrl`)\n3. Follow `consumeArgs`:\n - **asset:** media prepare for jpeg/png/webp/gif/mp4; **asset upload --staged** for SVG/PDF/Lottie\n - **text:** `set @ref field --staged <id>` (insert ref and field id)\n - **json:** `create from-json --staged <id>` (add `--dry-run --strict` first). Dry-run does not consume the slot.\n4. For pipeline jobs: wait \u2192 catalog \u2192 **import** (required for video). Then link and save\n\nHosted **inline** `--json` / `--content` / `--*-base64` is capped at **8192 bytes**. Staged files: **4 MB**. Rate limit: **1000 upload URLs per user per hour**. TTL: **60 minutes**.\n\n## Featured images (articles)\n\nRead `cms-edit://customer/defaults` when present. Otherwise:\n\n1. **Custom** \u2014 set `featuredImage` or `featuredImageAssetFilename` on the article when the editor provides a specific image\n2. **Article type** \u2014 if omitted, cms-edit inherits the linked **articleType** `featuredImage`\n3. **Site default** \u2014 from `editor.defaults` in the site config (also in `defaults.json` in the editor pack)\n\nRun `[\"index\", \"sync\"]` before resolving assets by filename.\n\n## JSON payloads (filesystem vs no filesystem)\n\nHosted MCP cannot see your disk. **Do not** put 10\u201350k strings in `cms_edit` args.\n\n- **Over 8k:** write the file, `kind=json` or `kind=text`, curl, `--staged`\n- **Tiny JSON only:** `--json` on the tool call\n- Never `--file` or stdin for content\n\n## Create content\n\n### Create a page\n\n```\n[\"schema\", \"component\"]\n[\"help\", \"create-from-json\"]\n[\"create\", \"from-json\", \"--json\", \"{...}\", \"--dry-run\", \"--strict\"]\n[\"create\", \"from-json\", \"--json\", \"{...}\"]\n```\n\nUse `\"components\"` (not `\"content\"`) and nested `\"type\"` (not `\"componentType\"`). Peek a live entry or `schema <ct>` before authoring field ids.\n\nEmpty `components` fails validation. Incremental `add`/`set` is for tiny patches only.\n\n### Create an article\n\nEvery article requires an **articleType**:\n\n```\n[\"index\", \"sync\"]\n[\"list\", \"--type\", \"articleType\"]\n[\"create\", \"article\", \"--slug\", \"resources/blog/my-post\", \"--title\", \"My Post\", \"--article-type-slug\", \"resources/blog\"]\n```\n\nOr `create from-json` with `\"type\": \"article\"` and `articleTypeSlug` / `articleTypeId`.\n\nUse MCP prompt `cms_edit_create_article` for guided creation.\n\n## Common sequences\n\n### List all pages\n\n```\n[\"list\", \"--type\", \"page\"]\n```\n\n### Refresh local index (assets, media, templates, taxonomy)\n\nRun before asset filename search, media-by-filename list, or fast template/taxonomy lookup:\n\n```\n[\"index\", \"sync\"]\n[\"index\", \"status\"]\n[\"list\", \"--type\", \"template\"]\n```\n\nAsset search and media-by-filename list **require** the index. Template/taxonomy list prefers the index when built.\n\n### Explore the homepage\n\n```\n[\"open\", \"--page-slug\", \"/\"]\n[\"snapshot\"]\n[\"read\", \"@c1\"]\n```\n\n### Edit copy on a page\n\n```\n[\"open\", \"--page-slug\", \"{{EXAMPLE_SLUG}}\"]\n[\"snapshot\"]\n[\"read\", \"@c1\", \"heading\"]\n[\"set\", \"@c1\", \"heading\", \"Updated heading\"]\n[\"diff\"]\n[\"save\"]\n```\n\n## Field discovery\n\n```\n[\"schema\", \"component\"]\n[\"list\", \"--type\", \"page\"]\n[\"search\", \"pricing\"]\n```\n\n## Grok Build setup\n\nGrok connects to the same hosted MCP URL as Claude. Add to `~/.grok/config.toml`:\n\n```toml\n[mcp_servers.cms-edit-brightline]\nurl = \"https://brightline.content.se.studio/api/mcp\"\nenabled = true\n```\n\nReplace the server name and host with your site's deployment. The URL **must** end with `/api/mcp` (not the site root).\n\n**Connect:**\n\n1. In Grok, run `/mcps` and select your cms-edit server\n2. Press **`i`** to initiate OAuth (not just enable the toggle)\n3. Sign in with Contentful when the browser opens\n4. Verify with `grok mcp doctor <server-name>` or call `cms_edit_version`\n\nOAuth is two steps: Grok obtains an MCP token, then you sign in with Contentful to link your account. If the browser flashes and closes immediately, reconnect after upgrading cms-edit (loopback redirect handling).\n\n## Hosted connector rules\n\n{{HOSTED_RULES}}\n\n## Session tips\n\n- After `open`, subsequent MCP commands share session `_mcp` automatically (stored in Redis on hosted).\n- Use `--session <name>` only when juggling multiple pages \u2014 pass it **before** the subcommand on every call: `[\"--session\", \"my-work\", \"open\", \"--page-slug\", \"/\"]`.\n- Snapshot JSON includes `sessionName` and `sessionKey` for debugging.\n- If you see \"No active session\", check `/api/health` (Redis must be ok), then run `open` again. Set `LOG_CMS_SESSION=1` on Vercel and search runtime logs for `[cms-edit:session]` (`redis save ok` / `redis load hit` / `requireSession miss`).\n\n### peek vs open vs read\n\n| Goal | MCP args |\n|------|----------|\n| Edit workflow (session) | `[\"open\", \"--page-slug\", \"/\"]` then `[\"read\", \"@c0\"]` |\n| Preview tree + fields, no session | `[\"peek\", \"--page-slug\", \"/pricing\"]` or `[\"peek\", \"--id\", \"<entry-id>\"]` (JSON includes `rootFields`) |\n| Read fields by entry ID, no session | `[\"read\", \"<entry-id>\", \"--id\"]` or `[\"read\", \"<entry-id>\", \"--id\", \"heading\"]` |\n| Debug session persistence | `[\"diagnose\"]` \u2014 reports store, userId, active session key |\n\n- **`peek` is one-shot** \u2014 prints tree and **root field values** (`rootFields` in JSON). No session is created; do not chain `read @ref` afterward.\n- **`open` / `nav open` persist** the session. `preview urls /slug` follows that slug even if leftover `_mcp` is another page (JSON may include `sessionRootIgnored`).\n- **Use flat lookup flags** for `open` and `peek` \u2014 same as CLI (`--page-slug`, `--id`, etc.). See `help lookup`. `nav open` uses `--nav-id` or `--nav-name` only.\n- **`read @root`** only works after `open` (uses the active session). The hint in peek output is for terminal users who already ran `open`.\n- **Do not invent flags** \u2014 there is no `--read`, `--then`, or chained peek+read syntax. One command per `cms_edit` call.\n\n## Troubleshooting\n\n| Problem | What to do |\n|---------|------------|\n| **401 / connection failed** | Reconnect: Claude \u2192 Settings \u2192 Integrations, or Grok `/mcps` \u2192 press `i`. Complete Contentful sign-in. If Grok says \u201CFailed to get tools after auth\u201D or `auth required`, check Vercel `[cms-edit:oauth] auth_failure`. `invalid_refresh_token` is a rotated/missing MCP refresh UUID (fixed in **3.6.1+** by not rotating). `missing_contentful_token` / `invalid_contentful_token` means the CMA cache is gone \u2014 **3.5.3+** returns `invalid_token` so Grok re-runs Contentful sign-in. If it still loops, delete that server\u2019s entry from `~/.grok/mcp_credentials.json` and press `i` again. Set `LOG_CMS_OAUTH=1` for connect success traces. |\n| **No cms_edit tool** | Confirm the integration is connected under Settings \u2192 Integrations |\n| **No active session** | Do not pass `--space` on hosted. Check `/api/health` \u2014 `redis` must be ok. MCP uses `_mcp` session automatically. Manual session: `[\"--session\", \"name\", \"open\", \"--page-slug\", \"/\"]`. Fallback: `[\"read\", \"<entry-id>\", \"--id\"]` |\n| **Wrong space** | Your Contentful account must have access to this deployment's space |\n| **Check version** | Call `cms_edit_version` or `curl /api/health` and read `cmsEdit` |\n\n## Articles\n\n**Recent articles** (by publication `date`, not last-updated):\n\n```json\n[\"list\", \"--type\", \"article\", \"--sort\", \"date\", \"-n\", \"10\"]\n```\n\nAlternative: `[\"search\", \"<keyword>\", \"--type\", \"article\"]` (also sorts by date).\n\n**Draft articles** \u2014 `peek` and `open` load drafts via CMA (not published-only). To discover drafts:\n\n```json\n[\"list\", \"--type\", \"article\", \"--sort\", \"date\"]\n[\"search\", \"<title>\", \"--type\", \"article\"]\n[\"list\", \"--type\", \"article\", \"--slug\", \"<slug>\"]\n```\n\nThen open: `[\"peek\", \"--article-slug\", \"<slug>\"]` or `[\"open\", \"--id\", \"<entry-id>\"]`. Use `--article-slug`, not `--page-slug`.\n\n**Published-only** is opt-in: `list --published` and `resolve --published` use the Delivery API index and omit never-published drafts.\n\nAfter upgrading cms-edit, run `[\"index\", \"sync\"]` once so the local index includes article `date` values (schema v4).\n\n**Index freshness on hosted MCP:** The catalog index is shared via Redis (gzipped SQLite blob). `index status` on a cold instance may show **not built** until `list`, `open`, or another index command runs \u2014 that is normal. Committed writes (`save`, `create page`, `asset upload`, \u2026) mark the index dirty; the next discovery command refreshes it. In-session `set` edits do not trigger a sync.\n\n## Command reference (cms_edit args)\n\n**Discovery:** `list --type <type>`, `search <query>`, `schema <contentType>`, `index sync`, `index status`\n\n**Reading:** `open --page-slug <slug>`, `open --id <id>`, `peek --page-slug <slug>`, `peek --id <id>`, `snapshot`, `read <ref>`, `read <ref> <field>`, `read <id> --id [field]`\n\n**Diagnostics:** `diagnose` \u2014 session store, userId, active session (after open/read issues)\n\n**Editing:** `set <ref> <field> <value>`, `rtf <ref> <field> --content \"<md>\"`, `diff`, `save`, `discard`\n\n**Creating:** `create from-json --json \u2026 --dry-run --strict`, `export from-json`, `apply from-json --json \u2026`, `create page` / `create article` for empty shells, `add` for tiny inserts\n\n**Other:** `health`, `version`, `guide [topic]`\n";
|
|
1
|
+
export declare const HOSTED_GUIDE_TEMPLATE = "# cms-edit MCP guide\n\nUse this guide when editing Contentful draft content through a hosted MCP connector (Claude Desktop Integrations + OAuth, or Grok Build).\n\n{{SITE_INTRO}}\n\n## Safety rules\n\ncms-edit **cannot and will not**:\n\n- Publish or unpublish entries\n- Archive or delete published entries\n\nAll `save` operations create **drafts only**. A human must review and publish in Contentful.\n\n**Assets:** Always **search and reuse** first (`index sync`, then `asset search`). Raster/video go through **`cms_edit_media`** (staged upload or Drive \u2192 prepare \u2192 import). Never `asset upload` jpeg/png/webp/gif/mp4, and never convert those files with local ffmpeg. SVG/PDF/Lottie: staged upload then `asset upload --staged`. **`--base64` is not supported on hosted MCP.**\n\n## MCP tools\n\n| Tool | Purpose |\n|------|---------|\n| `cms_edit` | Run any cms-edit command via an `args` array |\n| `cms_edit_request_staged_upload` | Presigned URL. `kind=asset` (default): binaries. `kind=text`: HtmlComponent fields then `set --staged`. `kind=json`: `create from-json --staged`. |\n| `cms_edit_version` | Check the installed cms-edit version (no session required) |\n| `cms_edit_help` | Guide topics (`overview`, `workflow`, `commands`, `troubleshooting`, `hosted`) **or** playbooks (`create-from-json`, `fields-html-component`, `fields-component`, \u2026) |\n\n## Customer editor pack (read first)\n\nWhen a site editor pack is deployed, these MCP resources provide **site-specific** context. Read them before creating or editing content:\n\n| Resource | Purpose |\n|----------|---------|\n| `cms-edit://customer/index` | List of all customer resources |\n| `cms-edit://customer/tasks-index` | Intent \u2192 task playbook map (filtered for this site) |\n| `cms-edit://customer/capabilities` | Machine-readable list of what this site supports |\n| `cms-edit://customer/checklist` | First-session onboarding steps |\n| `cms-edit://customer/overview` | Site name, space, staging URL, handoff rules |\n| `cms-edit://customer/routing` | Article/tag URL rules for this site |\n| `cms-edit://customer/production-site` | Production URL and how to fetch page markdown (do not guess `.md` URLs) |\n| `cms-edit://customer/components-index` | Component types and when to use each |\n| `cms-edit://customer/collections-index` | Collection types |\n| `cms-edit://customer/brand` | Brand voice and terminology (if configured) |\n| `cms-edit://customer/articles` | Article/publication playbook (if configured) |\n| `cms-edit://customer/defaults` | Featured image rules and article types (if configured) |\n| `cms-edit://customer/site-facts` | Optional canonical business facts (if configured) |\n| `cms-edit://customer/task-*` | Capability playbooks (e.g. `task-media-reuse-and-upload`) |\n\n**Workflow:** read `tasks-index` \u2192 `capabilities` \u2192 `checklist` \u2192 `overview` \u2192 `routing` \u2192 `production-site` \u2192 pick a `task-*` playbook for your goal \u2192 `components-index` \u2192 then use `cms_edit` commands.\n\n## MCP prompts\n\n| Prompt | Purpose |\n|--------|---------|\n| `cms_edit_verify` | Check version and connectivity |\n| `cms_edit_explore` | List site content and open a page |\n| `cms_edit_edit_page` | Edit a page through diff \u2192 save |\n| `cms_edit_edit_article` | Edit an article through diff \u2192 save |\n| `cms_edit_index_sync` | Build/refresh local index (assets, media, templates, taxonomy) |\n| `cms_edit_create_page` | Create a page with template selection |\n| `cms_edit_create_article` | Create an article (requires article type; featured image rules) |\n| `cms_edit_create_from_doc` | Create a page from a freeform document (infer \u2192 confirm \u2192 dry-run) |\n| `cms_edit_create_article_from_doc` | Create an article from a freeform document |\n| `cms_edit_taxonomy` | Import taxonomy entries (`create \u2026 --if-not-exists`) |\n| `cms_edit_bulk_seo` | Update SEO meta descriptions (read `task-seo-descriptions`) |\n| `cms_edit_bulk_find_replace` | Bulk find-replace in rich text across entries |\n| `cms_edit_bulk_article_tags` | Update tags on one or more articles |\n| `cms_edit_import_authors` | Create person/author entries from a list or sheet |\n| `cms_edit_media` | Find existing assets or upload new ones (reuse-first) |\n\nRead the full guide anytime via the `cms-edit://guide` resource or `cms_edit_help`.\n\n## End-to-end QA prompt\n\nFor release QA after cms-edit or editor-pack upgrades, use a **copy-paste Claude Desktop test script** (phases: connector \u2192 customer resources \u2192 discovery \u2192 session \u2192 schema \u2192 media \u2192 dry-run writes \u2192 negatives). See [e2e-test-prompt.md](./e2e-test-prompt.md) to author one per customer site. Example: Brightline `docs/cms-edit/MCP-E2E-TEST.md`.\n\n## Core workflow\n\nStandard editing flow: **open \u2192 snapshot \u2192 read \u2192 set/rtf \u2192 diff \u2192 save**\n\nEach step is a separate `cms_edit` call. Sessions persist in Redis between calls (hosted) or on disk (local). MCP auto-uses session `_mcp`.\n\n### 1. Open a page\n\n```\n[\"open\", \"--page-slug\", \"/\"]\n[\"open\", \"--page-slug\", \"/pricing\"]\n[\"open\", \"--id\", \"<entry-id>\"]\n[\"open\", \"--include-chrome\", \"--page-slug\", \"/pricing\"]\n```\n\nDefault `open` / `peek` fetch the page or article tree and the template entry, but **not** template menu/footer/navigation. Edit nav with `[\"nav\", \"open\", \"--nav-id\", \"<id>\"]` or `--nav-name` (not `--id`). Use `--include-chrome` only when you need those trees. Template `menu` is site-wide; `page.menu` overrides one page. Nested nav items are often shared \u2014 ask global vs page-specific before `set`.\n\n**Homepage (all SE Studio sites):** Contentful stores the marketing homepage slug as `index`. The live site URL is `/`. In cms-edit, `--page-slug /` and `--page-slug /index` are equivalent (both resolve to `index`). Read `cms-edit://customer/routing` for site-specific exceptions (e.g. Pedestal uses `home`).\n\n### 2. Snapshot \u2014 see the content tree\n\n```\n[\"snapshot\"]\n```\n\nOutput shows `@c0`, `@c1`, \u2026 refs for each component. Use these refs in `read`, `set`, and `rtf`.\n\n### 3. Read fields\n\n```\n[\"read\", \"@c1\"]\n[\"read\", \"@c1\", \"heading\"]\n```\n\n### 4. Edit fields\n\n```\n[\"set\", \"@c1\", \"heading\", \"New heading text\"]\n[\"rtf\", \"@c1\", \"body\", \"--content\", \"# Title\\n\\nParagraph text.\"]\n```\n\nFor rich text, prefer `--content` with inline markdown. Use `--base64` when special characters cause issues.\n\n### 5. Review and save\n\n```\n[\"diff\"]\n[\"save\"]\n```\n\nAlways run `diff` before `save`. To abandon changes: `[\"discard\"]`.\n\n## When to use Contentful UI\n\n| Task | Where |\n|------|-------|\n| Edit copy, add sections, create pages/articles | **Agent + cms-edit** (drafts) |\n| Upload new images and files | **Agent + cms-edit** \u2014 search/reuse first; raster/video via `cms_edit_media` import |\n| Publish approved drafts | **Contentful UI** |\n| Edit copy directly in Contentful | **Avoid** \u2014 use cms-edit instead |\n\ncms-edit saves **drafts only**. A colleague must **publish in Contentful** for changes to go live.\n\n## Asset upload (hosted MCP)\n\nHosted connectors have **no server filesystem** and **reject `asset upload --base64`**. Raster/video: staged intake then **media pipeline**. SVG/PDF/Lottie: staged then `asset upload --staged`.\n\n| Source | When | Example |\n|--------|------|---------|\n| **Staged + pipeline** | jpeg/png/webp/gif/mp4 | `cms_edit_media` prepare `stagedUploadIds` \u2192 import (required for video) |\n| **`--url`** | Pipeline-ready **images** only, or SVG/PDF | `[\"asset\", \"upload\", \"--url\", \"https://\u2026.blob.vercel-storage.com/ready.jpg\"]` |\n| **Staged consume** | SVG/PDF/Lottie | `asset upload --staged` |\n\n**After upload:** note the returned asset `id`, attach to the entry (`asset set @root media <id>` for person portraits), then `diff` \u2192 `save`. Upload alone does not update entries.\n\n**PNG** when transparency matters.\n\nFull workflow: `cms-edit://customer/task-media-reuse-and-upload`.\n\n### Common pitfalls (agents)\n\n| Issue | Do this |\n|-------|---------|\n| Singular Media on a component (`visual`) | `set @cN visual <mediaId> --link` \u2014 **not** `add \u2026 --target visual` |\n| Shared Drive folder has extra files | Import with `sourceNames` or `onlyWithOverrides` after catalog |\n| Prepare says no media / empty folder | Share folder **Viewer** with `media-pipeline-reader@se-media-pipeline.iam.gserviceaccount.com`, then re-prepare once |\n| MCP tool times out ~180s | `read` / `diff` / re-`catalog` before retrying the same write \u2014 server may already have saved |\n| `preview urls` has no Live Preview URL | Not a failed save. For **draft-only** pages use **siteLivePreview** (`/preview?id=`). Staging `showsDrafts` is false unless `DRAFT_ONLY`. |\n| Reuse-first import matches old fileNames | dry-run first; set `overrides[].fileName` for unique names when duplication is required |\n\n### Staged upload\n\nKeeps binary **and large text/JSON** out of MCP tool args. The agent uploads via `curl`, then passes only a short `uploadId`.\n\n1. `cms_edit_request_staged_upload` with `fileName`, `mimeType`, optional `kind` (`asset` \\| `text` \\| `json`), optional `byteLength`, optional `title`. If the wrapper schema has no `kind`, use `cms_edit` `[\"staged-upload\", \"request\", \"--kind\", \"json\", \"--file-name\", \"...\", \"--mime\", \"application/json\"]` (or `--kind text` for HtmlComponent fields).\n2. Run the returned `curlCommand` in a shell (POST multipart to `uploadUrl`)\n3. Follow `consumeArgs`:\n - **asset:** media prepare for jpeg/png/webp/gif/mp4; **asset upload --staged** for SVG/PDF/Lottie\n - **text:** `set @ref field --staged <id>` (insert ref and field id)\n - **json:** `create from-json --staged <id>` (add `--dry-run --strict` first). Dry-run does not consume the slot.\n4. For pipeline jobs: wait \u2192 catalog \u2192 **import** (required for video). Then link and save\n\nHosted **inline** `--json` / `--content` / `--*-base64` is capped at **8192 bytes**. Staged files: **4 MB**. Rate limit: **1000 upload URLs per user per hour**. TTL: **60 minutes**.\n\n## Featured images (articles)\n\nRead `cms-edit://customer/defaults` when present. Otherwise:\n\n1. **Custom** \u2014 set `featuredImage` or `featuredImageAssetFilename` on the article when the editor provides a specific image\n2. **Article type** \u2014 if omitted, cms-edit inherits the linked **articleType** `featuredImage`\n3. **Site default** \u2014 from `editor.defaults` in the site config (also in `defaults.json` in the editor pack)\n\nRun `[\"index\", \"sync\"]` before resolving assets by filename.\n\n## JSON payloads (filesystem vs no filesystem)\n\nHosted MCP cannot see your disk. **Do not** put 10\u201350k strings in `cms_edit` args.\n\n- **Over 8k:** write the file, `kind=json` or `kind=text`, curl, `--staged`\n- **Tiny JSON only:** `--json` on the tool call\n- Never `--file` or stdin for content\n\n## Create content\n\n### Create a page\n\n```\n[\"schema\", \"component\"]\n[\"help\", \"create-from-json\"]\n[\"create\", \"from-json\", \"--json\", \"{...}\", \"--dry-run\", \"--strict\"]\n[\"create\", \"from-json\", \"--json\", \"{...}\"]\n```\n\nUse `\"components\"` (not `\"content\"`) and nested `\"type\"` (not `\"componentType\"`). Peek a live entry or `schema <ct>` before authoring field ids.\n\nEmpty `components` fails validation. Incremental `add`/`set` is for tiny patches only.\n\n### Create an article\n\nEvery article requires an **articleType**:\n\n```\n[\"index\", \"sync\"]\n[\"list\", \"--type\", \"articleType\"]\n[\"create\", \"article\", \"--slug\", \"resources/blog/my-post\", \"--title\", \"My Post\", \"--article-type-slug\", \"resources/blog\"]\n```\n\nOr `create from-json` with `\"type\": \"article\"` and `articleTypeSlug` / `articleTypeId`.\n\nUse MCP prompt `cms_edit_create_article` for guided creation.\n\n## Common sequences\n\n### List all pages\n\n```\n[\"list\", \"--type\", \"page\"]\n```\n\n### Refresh local index (assets, media, templates, taxonomy)\n\nRun before asset filename search, media-by-filename list, or fast template/taxonomy lookup:\n\n```\n[\"index\", \"sync\"]\n[\"index\", \"status\"]\n[\"list\", \"--type\", \"template\"]\n```\n\nAsset search and media-by-filename list **require** the index. Template/taxonomy list prefers the index when built.\n\n### Explore the homepage\n\n```\n[\"open\", \"--page-slug\", \"/\"]\n[\"snapshot\"]\n[\"read\", \"@c1\"]\n```\n\n### Edit copy on a page\n\n```\n[\"open\", \"--page-slug\", \"{{EXAMPLE_SLUG}}\"]\n[\"snapshot\"]\n[\"read\", \"@c1\", \"heading\"]\n[\"set\", \"@c1\", \"heading\", \"Updated heading\"]\n[\"diff\"]\n[\"save\"]\n```\n\n## Field discovery\n\n```\n[\"schema\", \"component\"]\n[\"list\", \"--type\", \"page\"]\n[\"search\", \"pricing\"]\n```\n\n## Grok Build setup\n\nGrok connects to the same hosted MCP URL as Claude. Add to `~/.grok/config.toml`:\n\n```toml\n[mcp_servers.cms-edit-brightline]\nurl = \"https://brightline.content.se.studio/api/mcp\"\nenabled = true\n```\n\nReplace the server name and host with your site's deployment. The URL **must** end with `/api/mcp` (not the site root).\n\n**Connect:**\n\n1. In Grok, run `/mcps` and select your cms-edit server\n2. Press **`i`** to initiate OAuth (not just enable the toggle)\n3. Sign in with Contentful when the browser opens\n4. Verify with `grok mcp doctor <server-name>` or call `cms_edit_version`\n\nOAuth is two steps: Grok obtains an MCP token, then you sign in with Contentful to link your account. If the browser flashes and closes immediately, reconnect after upgrading cms-edit (loopback redirect handling).\n\n## Hosted connector rules\n\n{{HOSTED_RULES}}\n\n## Session tips\n\n- After `open`, subsequent MCP commands share session `_mcp` automatically (stored in Redis on hosted).\n- Use `--session <name>` only when juggling multiple pages \u2014 pass it **before** the subcommand on every call: `[\"--session\", \"my-work\", \"open\", \"--page-slug\", \"/\"]`.\n- Snapshot JSON includes `sessionName` and `sessionKey` for debugging.\n- If you see \"No active session\", check `/api/health` (Redis must be ok), then run `open` again. Set `LOG_CMS_SESSION=1` on Vercel and search runtime logs for `[cms-edit:session]` (`redis save ok` / `redis load hit` / `requireSession miss`).\n\n### peek vs open vs read\n\n| Goal | MCP args |\n|------|----------|\n| Edit workflow (session) | `[\"open\", \"--page-slug\", \"/\"]` then `[\"read\", \"@c0\"]` |\n| Preview tree + fields, no session | `[\"peek\", \"--page-slug\", \"/pricing\"]` or `[\"peek\", \"--id\", \"<entry-id>\"]` (JSON includes `rootFields`) |\n| Read fields by entry ID, no session | `[\"read\", \"<entry-id>\", \"--id\"]` or `[\"read\", \"<entry-id>\", \"--id\", \"heading\"]` |\n| Debug session persistence | `[\"diagnose\"]` \u2014 reports store, userId, active session key |\n\n- **`peek` is one-shot** \u2014 prints tree and **root field values** (`rootFields` in JSON). No session is created; do not chain `read @ref` afterward.\n- **`open` / `nav open` persist** the session. `preview urls /slug` follows that slug even if leftover `_mcp` is another page (JSON may include `sessionRootIgnored`).\n- **Use flat lookup flags** for `open` and `peek` \u2014 same as CLI (`--page-slug`, `--id`, etc.). See `help lookup`. `nav open` uses `--nav-id` or `--nav-name` only.\n- **`read @root`** only works after `open` (uses the active session). The hint in peek output is for terminal users who already ran `open`.\n- **Do not invent flags** \u2014 there is no `--read`, `--then`, or chained peek+read syntax. One command per `cms_edit` call.\n\n## Troubleshooting\n\n| Problem | What to do |\n|---------|------------|\n| **401 / connection failed** | Reconnect: Claude \u2192 Settings \u2192 Integrations, or Grok `/mcps` \u2192 press `i`. Complete Contentful sign-in. If Grok says \u201CFailed to get tools after auth\u201D or `auth required`, check Vercel `[cms-edit:oauth] auth_failure`. `invalid_refresh_token` is a rotated/missing MCP refresh UUID (fixed in **3.6.1+** by not rotating). `missing_contentful_token` / `invalid_contentful_token` means the CMA cache is gone \u2014 **3.5.3+** returns `invalid_token` so Grok re-runs Contentful sign-in. If it still loops, delete that server\u2019s entry from `~/.grok/mcp_credentials.json` and press `i` again. Set `LOG_CMS_OAUTH=1` for connect success traces. |\n| **No cms_edit tool** | Confirm the integration is connected under Settings \u2192 Integrations |\n| **No active session** | Do not pass `--space` on hosted. Check `/api/health` \u2014 `redis` must be ok. MCP uses `_mcp` session automatically. Manual session: `[\"--session\", \"name\", \"open\", \"--page-slug\", \"/\"]`. Fallback: `[\"read\", \"<entry-id>\", \"--id\"]` |\n| **Wrong space** | Your Contentful account must have access to this deployment's space |\n| **Check version** | Call `cms_edit_version` or `curl /api/health` and read `cmsEdit` |\n| **staged GET failed 405** | Pipeline cannot download staged files. Host must export GET `/api/staged-upload` (`@se-studio/contentful-cms` with staged GET). Bump + redeploy the host. Do not retry prepare or use the Contentful UI. |\n| **staged GET failed 404** | GET is mounted; the slot is missing, expired, or not POSTed yet. Re-stage (POST) and prepare once. Not a host bump. |\n| **pipeline_unconfigured** | `/api/health` `checks.mediaPipeline.ok` is false. Ops set `MEDIA_PIPELINE_*` on the host. Do not ask the user for a pipeline key. |\n\n## Articles\n\n**Recent articles** (by publication `date`, not last-updated):\n\n```json\n[\"list\", \"--type\", \"article\", \"--sort\", \"date\", \"-n\", \"10\"]\n```\n\nAlternative: `[\"search\", \"<keyword>\", \"--type\", \"article\"]` (also sorts by date).\n\n**Draft articles** \u2014 `peek` and `open` load drafts via CMA (not published-only). To discover drafts:\n\n```json\n[\"list\", \"--type\", \"article\", \"--sort\", \"date\"]\n[\"search\", \"<title>\", \"--type\", \"article\"]\n[\"list\", \"--type\", \"article\", \"--slug\", \"<slug>\"]\n```\n\nThen open: `[\"peek\", \"--article-slug\", \"<slug>\"]` or `[\"open\", \"--id\", \"<entry-id>\"]`. Use `--article-slug`, not `--page-slug`.\n\n**Published-only** is opt-in: `list --published` and `resolve --published` use the Delivery API index and omit never-published drafts.\n\nAfter upgrading cms-edit, run `[\"index\", \"sync\"]` once so the local index includes article `date` values (schema v4).\n\n**Index freshness on hosted MCP:** The catalog index is shared via Redis (gzipped SQLite blob). `index status` on a cold instance may show **not built** until `list`, `open`, or another index command runs \u2014 that is normal. Committed writes (`save`, `create page`, `asset upload`, \u2026) mark the index dirty; the next discovery command refreshes it. In-session `set` edits do not trigger a sync.\n\n## Command reference (cms_edit args)\n\n**Discovery:** `list --type <type>`, `search <query>`, `schema <contentType>`, `index sync`, `index status`\n\n**Reading:** `open --page-slug <slug>`, `open --id <id>`, `peek --page-slug <slug>`, `peek --id <id>`, `snapshot`, `read <ref>`, `read <ref> <field>`, `read <id> --id [field]`\n\n**Diagnostics:** `diagnose` \u2014 session store, userId, active session (after open/read issues)\n\n**Editing:** `set <ref> <field> <value>`, `rtf <ref> <field> --content \"<md>\"`, `diff`, `save`, `discard`\n\n**Creating:** `create from-json --json \u2026 --dry-run --strict`, `export from-json`, `apply from-json --json \u2026`, `create page` / `create article` for empty shells, `add` for tiny inserts\n\n**Other:** `health`, `version`, `guide [topic]`\n";
|
|
2
2
|
//# sourceMappingURL=hosted-guide.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-guide.d.ts","sourceRoot":"","sources":["../../src/generated/hosted-guide.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"hosted-guide.d.ts","sourceRoot":"","sources":["../../src/generated/hosted-guide.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,qBAAqB,42mBAAkimB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Generated by scripts/generate-embedded-assets.mjs — do not edit manually.
|
|
2
|
-
export const HOSTED_GUIDE_TEMPLATE = "# cms-edit MCP guide\n\nUse this guide when editing Contentful draft content through a hosted MCP connector (Claude Desktop Integrations + OAuth, or Grok Build).\n\n{{SITE_INTRO}}\n\n## Safety rules\n\ncms-edit **cannot and will not**:\n\n- Publish or unpublish entries\n- Archive or delete published entries\n\nAll `save` operations create **drafts only**. A human must review and publish in Contentful.\n\n**Assets:** cms-edit **can upload** draft assets via **staged upload** (hosted) or `--url` (public HTTPS last resort). **`--base64` is not supported on hosted MCP.** Always **search and reuse existing assets first** (`index sync`, then `asset search` or `list --type media`). Use `--if-exists-by-filename` when uploading to avoid duplicates.\n\n## MCP tools\n\n| Tool | Purpose |\n|------|---------|\n| `cms_edit` | Run any cms-edit command via an `args` array |\n| `cms_edit_request_staged_upload` | Presigned URL. `kind=asset` (default): binaries. `kind=text`: HtmlComponent fields then `set --staged`. `kind=json`: `create from-json --staged`. |\n| `cms_edit_version` | Check the installed cms-edit version (no session required) |\n| `cms_edit_help` | Guide topics (`overview`, `workflow`, `commands`, `troubleshooting`, `hosted`) **or** playbooks (`create-from-json`, `fields-html-component`, `fields-component`, …) |\n\n## Customer editor pack (read first)\n\nWhen a site editor pack is deployed, these MCP resources provide **site-specific** context. Read them before creating or editing content:\n\n| Resource | Purpose |\n|----------|---------|\n| `cms-edit://customer/index` | List of all customer resources |\n| `cms-edit://customer/tasks-index` | Intent → task playbook map (filtered for this site) |\n| `cms-edit://customer/capabilities` | Machine-readable list of what this site supports |\n| `cms-edit://customer/checklist` | First-session onboarding steps |\n| `cms-edit://customer/overview` | Site name, space, staging URL, handoff rules |\n| `cms-edit://customer/routing` | Article/tag URL rules for this site |\n| `cms-edit://customer/production-site` | Production URL and how to fetch page markdown (do not guess `.md` URLs) |\n| `cms-edit://customer/components-index` | Component types and when to use each |\n| `cms-edit://customer/collections-index` | Collection types |\n| `cms-edit://customer/brand` | Brand voice and terminology (if configured) |\n| `cms-edit://customer/articles` | Article/publication playbook (if configured) |\n| `cms-edit://customer/defaults` | Featured image rules and article types (if configured) |\n| `cms-edit://customer/site-facts` | Optional canonical business facts (if configured) |\n| `cms-edit://customer/task-*` | Capability playbooks (e.g. `task-media-reuse-and-upload`) |\n\n**Workflow:** read `tasks-index` → `capabilities` → `checklist` → `overview` → `routing` → `production-site` → pick a `task-*` playbook for your goal → `components-index` → then use `cms_edit` commands.\n\n## MCP prompts\n\n| Prompt | Purpose |\n|--------|---------|\n| `cms_edit_verify` | Check version and connectivity |\n| `cms_edit_explore` | List site content and open a page |\n| `cms_edit_edit_page` | Edit a page through diff → save |\n| `cms_edit_edit_article` | Edit an article through diff → save |\n| `cms_edit_index_sync` | Build/refresh local index (assets, media, templates, taxonomy) |\n| `cms_edit_create_page` | Create a page with template selection |\n| `cms_edit_create_article` | Create an article (requires article type; featured image rules) |\n| `cms_edit_create_from_doc` | Create a page from a freeform document (infer → confirm → dry-run) |\n| `cms_edit_create_article_from_doc` | Create an article from a freeform document |\n| `cms_edit_taxonomy` | Import taxonomy entries (`create … --if-not-exists`) |\n| `cms_edit_bulk_seo` | Update SEO meta descriptions (read `task-seo-descriptions`) |\n| `cms_edit_bulk_find_replace` | Bulk find-replace in rich text across entries |\n| `cms_edit_bulk_article_tags` | Update tags on one or more articles |\n| `cms_edit_import_authors` | Create person/author entries from a list or sheet |\n| `cms_edit_media` | Find existing assets or upload new ones (reuse-first) |\n\nRead the full guide anytime via the `cms-edit://guide` resource or `cms_edit_help`.\n\n## End-to-end QA prompt\n\nFor release QA after cms-edit or editor-pack upgrades, use a **copy-paste Claude Desktop test script** (phases: connector → customer resources → discovery → session → schema → media → dry-run writes → negatives). See [e2e-test-prompt.md](./e2e-test-prompt.md) to author one per customer site. Example: Brightline `docs/cms-edit/MCP-E2E-TEST.md`.\n\n## Core workflow\n\nStandard editing flow: **open → snapshot → read → set/rtf → diff → save**\n\nEach step is a separate `cms_edit` call. Sessions persist in Redis between calls (hosted) or on disk (local). MCP auto-uses session `_mcp`.\n\n### 1. Open a page\n\n```\n[\"open\", \"--page-slug\", \"/\"]\n[\"open\", \"--page-slug\", \"/pricing\"]\n[\"open\", \"--id\", \"<entry-id>\"]\n[\"open\", \"--include-chrome\", \"--page-slug\", \"/pricing\"]\n```\n\nDefault `open` / `peek` fetch the page or article tree and the template entry, but **not** template menu/footer/navigation. Edit nav with `[\"nav\", \"open\", \"--nav-id\", \"<id>\"]` or `--nav-name` (not `--id`). Use `--include-chrome` only when you need those trees. Template `menu` is site-wide; `page.menu` overrides one page. Nested nav items are often shared — ask global vs page-specific before `set`.\n\n**Homepage (all SE Studio sites):** Contentful stores the marketing homepage slug as `index`. The live site URL is `/`. In cms-edit, `--page-slug /` and `--page-slug /index` are equivalent (both resolve to `index`). Read `cms-edit://customer/routing` for site-specific exceptions (e.g. Pedestal uses `home`).\n\n### 2. Snapshot — see the content tree\n\n```\n[\"snapshot\"]\n```\n\nOutput shows `@c0`, `@c1`, … refs for each component. Use these refs in `read`, `set`, and `rtf`.\n\n### 3. Read fields\n\n```\n[\"read\", \"@c1\"]\n[\"read\", \"@c1\", \"heading\"]\n```\n\n### 4. Edit fields\n\n```\n[\"set\", \"@c1\", \"heading\", \"New heading text\"]\n[\"rtf\", \"@c1\", \"body\", \"--content\", \"# Title\\n\\nParagraph text.\"]\n```\n\nFor rich text, prefer `--content` with inline markdown. Use `--base64` when special characters cause issues.\n\n### 5. Review and save\n\n```\n[\"diff\"]\n[\"save\"]\n```\n\nAlways run `diff` before `save`. To abandon changes: `[\"discard\"]`.\n\n## When to use Contentful UI\n\n| Task | Where |\n|------|-------|\n| Edit copy, add sections, create pages/articles | **Agent + cms-edit** (drafts) |\n| Upload new images and files | **Agent + cms-edit** — search/reuse first; raster/video via `cms_edit_media` import |\n| Publish approved drafts | **Contentful UI** |\n| Edit copy directly in Contentful | **Avoid** — use cms-edit instead |\n\ncms-edit saves **drafts only**. A colleague must **publish in Contentful** for changes to go live.\n\n## Asset upload (hosted MCP)\n\nHosted connectors have **no server filesystem** and **reject `asset upload --base64`**. Raster/video: staged intake then **media pipeline**. SVG/PDF/Lottie: staged then `asset upload --staged`.\n\n| Source | When | Example |\n|--------|------|---------|\n| **Staged + pipeline** | jpeg/png/webp/gif/mp4 | `cms_edit_media` prepare `stagedUploadIds` → import (required for video) |\n| **`--url`** | Pipeline-ready **images** only, or SVG/PDF | `[\"asset\", \"upload\", \"--url\", \"https://….blob.vercel-storage.com/ready.jpg\"]` |\n| **Staged consume** | SVG/PDF/Lottie | `asset upload --staged` |\n\n**After upload:** note the returned asset `id`, attach to the entry (`asset set @root media <id>` for person portraits), then `diff` → `save`. Upload alone does not update entries.\n\n**PNG** when transparency matters.\n\nFull workflow: `cms-edit://customer/task-media-reuse-and-upload`.\n\n### Common pitfalls (agents)\n\n| Issue | Do this |\n|-------|---------|\n| Singular Media on a component (`visual`) | `set @cN visual <mediaId> --link` — **not** `add … --target visual` |\n| Shared Drive folder has extra files | Import with `sourceNames` or `onlyWithOverrides` after catalog |\n| Prepare says no media / empty folder | Share folder **Viewer** with `media-pipeline-reader@se-media-pipeline.iam.gserviceaccount.com`, then re-prepare once |\n| MCP tool times out ~180s | `read` / `diff` / re-`catalog` before retrying the same write — server may already have saved |\n| `preview urls` has no Live Preview URL | Not a failed save. For **draft-only** pages use **siteLivePreview** (`/preview?id=`). Staging `showsDrafts` is false unless `DRAFT_ONLY`. |\n| Reuse-first import matches old fileNames | dry-run first; set `overrides[].fileName` for unique names when duplication is required |\n\n### Staged upload\n\nKeeps binary **and large text/JSON** out of MCP tool args. The agent uploads via `curl`, then passes only a short `uploadId`.\n\n1. `cms_edit_request_staged_upload` with `fileName`, `mimeType`, optional `kind` (`asset` \\| `text` \\| `json`), optional `byteLength`, optional `title`. If the wrapper schema has no `kind`, use `cms_edit` `[\"staged-upload\", \"request\", \"--kind\", \"json\", \"--file-name\", \"...\", \"--mime\", \"application/json\"]` (or `--kind text` for HtmlComponent fields).\n2. Run the returned `curlCommand` in a shell (POST multipart to `uploadUrl`)\n3. Follow `consumeArgs`:\n - **asset:** media prepare for jpeg/png/webp/gif/mp4; **asset upload --staged** for SVG/PDF/Lottie\n - **text:** `set @ref field --staged <id>` (insert ref and field id)\n - **json:** `create from-json --staged <id>` (add `--dry-run --strict` first). Dry-run does not consume the slot.\n4. For pipeline jobs: wait → catalog → **import** (required for video). Then link and save\n\nHosted **inline** `--json` / `--content` / `--*-base64` is capped at **8192 bytes**. Staged files: **4 MB**. Rate limit: **1000 upload URLs per user per hour**. TTL: **60 minutes**.\n\n## Featured images (articles)\n\nRead `cms-edit://customer/defaults` when present. Otherwise:\n\n1. **Custom** — set `featuredImage` or `featuredImageAssetFilename` on the article when the editor provides a specific image\n2. **Article type** — if omitted, cms-edit inherits the linked **articleType** `featuredImage`\n3. **Site default** — from `editor.defaults` in the site config (also in `defaults.json` in the editor pack)\n\nRun `[\"index\", \"sync\"]` before resolving assets by filename.\n\n## JSON payloads (filesystem vs no filesystem)\n\nHosted MCP cannot see your disk. **Do not** put 10–50k strings in `cms_edit` args.\n\n- **Over 8k:** write the file, `kind=json` or `kind=text`, curl, `--staged`\n- **Tiny JSON only:** `--json` on the tool call\n- Never `--file` or stdin for content\n\n## Create content\n\n### Create a page\n\n```\n[\"schema\", \"component\"]\n[\"help\", \"create-from-json\"]\n[\"create\", \"from-json\", \"--json\", \"{...}\", \"--dry-run\", \"--strict\"]\n[\"create\", \"from-json\", \"--json\", \"{...}\"]\n```\n\nUse `\"components\"` (not `\"content\"`) and nested `\"type\"` (not `\"componentType\"`). Peek a live entry or `schema <ct>` before authoring field ids.\n\nEmpty `components` fails validation. Incremental `add`/`set` is for tiny patches only.\n\n### Create an article\n\nEvery article requires an **articleType**:\n\n```\n[\"index\", \"sync\"]\n[\"list\", \"--type\", \"articleType\"]\n[\"create\", \"article\", \"--slug\", \"resources/blog/my-post\", \"--title\", \"My Post\", \"--article-type-slug\", \"resources/blog\"]\n```\n\nOr `create from-json` with `\"type\": \"article\"` and `articleTypeSlug` / `articleTypeId`.\n\nUse MCP prompt `cms_edit_create_article` for guided creation.\n\n## Common sequences\n\n### List all pages\n\n```\n[\"list\", \"--type\", \"page\"]\n```\n\n### Refresh local index (assets, media, templates, taxonomy)\n\nRun before asset filename search, media-by-filename list, or fast template/taxonomy lookup:\n\n```\n[\"index\", \"sync\"]\n[\"index\", \"status\"]\n[\"list\", \"--type\", \"template\"]\n```\n\nAsset search and media-by-filename list **require** the index. Template/taxonomy list prefers the index when built.\n\n### Explore the homepage\n\n```\n[\"open\", \"--page-slug\", \"/\"]\n[\"snapshot\"]\n[\"read\", \"@c1\"]\n```\n\n### Edit copy on a page\n\n```\n[\"open\", \"--page-slug\", \"{{EXAMPLE_SLUG}}\"]\n[\"snapshot\"]\n[\"read\", \"@c1\", \"heading\"]\n[\"set\", \"@c1\", \"heading\", \"Updated heading\"]\n[\"diff\"]\n[\"save\"]\n```\n\n## Field discovery\n\n```\n[\"schema\", \"component\"]\n[\"list\", \"--type\", \"page\"]\n[\"search\", \"pricing\"]\n```\n\n## Grok Build setup\n\nGrok connects to the same hosted MCP URL as Claude. Add to `~/.grok/config.toml`:\n\n```toml\n[mcp_servers.cms-edit-brightline]\nurl = \"https://brightline.content.se.studio/api/mcp\"\nenabled = true\n```\n\nReplace the server name and host with your site's deployment. The URL **must** end with `/api/mcp` (not the site root).\n\n**Connect:**\n\n1. In Grok, run `/mcps` and select your cms-edit server\n2. Press **`i`** to initiate OAuth (not just enable the toggle)\n3. Sign in with Contentful when the browser opens\n4. Verify with `grok mcp doctor <server-name>` or call `cms_edit_version`\n\nOAuth is two steps: Grok obtains an MCP token, then you sign in with Contentful to link your account. If the browser flashes and closes immediately, reconnect after upgrading cms-edit (loopback redirect handling).\n\n## Hosted connector rules\n\n{{HOSTED_RULES}}\n\n## Session tips\n\n- After `open`, subsequent MCP commands share session `_mcp` automatically (stored in Redis on hosted).\n- Use `--session <name>` only when juggling multiple pages — pass it **before** the subcommand on every call: `[\"--session\", \"my-work\", \"open\", \"--page-slug\", \"/\"]`.\n- Snapshot JSON includes `sessionName` and `sessionKey` for debugging.\n- If you see \"No active session\", check `/api/health` (Redis must be ok), then run `open` again. Set `LOG_CMS_SESSION=1` on Vercel and search runtime logs for `[cms-edit:session]` (`redis save ok` / `redis load hit` / `requireSession miss`).\n\n### peek vs open vs read\n\n| Goal | MCP args |\n|------|----------|\n| Edit workflow (session) | `[\"open\", \"--page-slug\", \"/\"]` then `[\"read\", \"@c0\"]` |\n| Preview tree + fields, no session | `[\"peek\", \"--page-slug\", \"/pricing\"]` or `[\"peek\", \"--id\", \"<entry-id>\"]` (JSON includes `rootFields`) |\n| Read fields by entry ID, no session | `[\"read\", \"<entry-id>\", \"--id\"]` or `[\"read\", \"<entry-id>\", \"--id\", \"heading\"]` |\n| Debug session persistence | `[\"diagnose\"]` — reports store, userId, active session key |\n\n- **`peek` is one-shot** — prints tree and **root field values** (`rootFields` in JSON). No session is created; do not chain `read @ref` afterward.\n- **`open` / `nav open` persist** the session. `preview urls /slug` follows that slug even if leftover `_mcp` is another page (JSON may include `sessionRootIgnored`).\n- **Use flat lookup flags** for `open` and `peek` — same as CLI (`--page-slug`, `--id`, etc.). See `help lookup`. `nav open` uses `--nav-id` or `--nav-name` only.\n- **`read @root`** only works after `open` (uses the active session). The hint in peek output is for terminal users who already ran `open`.\n- **Do not invent flags** — there is no `--read`, `--then`, or chained peek+read syntax. One command per `cms_edit` call.\n\n## Troubleshooting\n\n| Problem | What to do |\n|---------|------------|\n| **401 / connection failed** | Reconnect: Claude → Settings → Integrations, or Grok `/mcps` → press `i`. Complete Contentful sign-in. If Grok says “Failed to get tools after auth” or `auth required`, check Vercel `[cms-edit:oauth] auth_failure`. `invalid_refresh_token` is a rotated/missing MCP refresh UUID (fixed in **3.6.1+** by not rotating). `missing_contentful_token` / `invalid_contentful_token` means the CMA cache is gone — **3.5.3+** returns `invalid_token` so Grok re-runs Contentful sign-in. If it still loops, delete that server’s entry from `~/.grok/mcp_credentials.json` and press `i` again. Set `LOG_CMS_OAUTH=1` for connect success traces. |\n| **No cms_edit tool** | Confirm the integration is connected under Settings → Integrations |\n| **No active session** | Do not pass `--space` on hosted. Check `/api/health` — `redis` must be ok. MCP uses `_mcp` session automatically. Manual session: `[\"--session\", \"name\", \"open\", \"--page-slug\", \"/\"]`. Fallback: `[\"read\", \"<entry-id>\", \"--id\"]` |\n| **Wrong space** | Your Contentful account must have access to this deployment's space |\n| **Check version** | Call `cms_edit_version` or `curl /api/health` and read `cmsEdit` |\n\n## Articles\n\n**Recent articles** (by publication `date`, not last-updated):\n\n```json\n[\"list\", \"--type\", \"article\", \"--sort\", \"date\", \"-n\", \"10\"]\n```\n\nAlternative: `[\"search\", \"<keyword>\", \"--type\", \"article\"]` (also sorts by date).\n\n**Draft articles** — `peek` and `open` load drafts via CMA (not published-only). To discover drafts:\n\n```json\n[\"list\", \"--type\", \"article\", \"--sort\", \"date\"]\n[\"search\", \"<title>\", \"--type\", \"article\"]\n[\"list\", \"--type\", \"article\", \"--slug\", \"<slug>\"]\n```\n\nThen open: `[\"peek\", \"--article-slug\", \"<slug>\"]` or `[\"open\", \"--id\", \"<entry-id>\"]`. Use `--article-slug`, not `--page-slug`.\n\n**Published-only** is opt-in: `list --published` and `resolve --published` use the Delivery API index and omit never-published drafts.\n\nAfter upgrading cms-edit, run `[\"index\", \"sync\"]` once so the local index includes article `date` values (schema v4).\n\n**Index freshness on hosted MCP:** The catalog index is shared via Redis (gzipped SQLite blob). `index status` on a cold instance may show **not built** until `list`, `open`, or another index command runs — that is normal. Committed writes (`save`, `create page`, `asset upload`, …) mark the index dirty; the next discovery command refreshes it. In-session `set` edits do not trigger a sync.\n\n## Command reference (cms_edit args)\n\n**Discovery:** `list --type <type>`, `search <query>`, `schema <contentType>`, `index sync`, `index status`\n\n**Reading:** `open --page-slug <slug>`, `open --id <id>`, `peek --page-slug <slug>`, `peek --id <id>`, `snapshot`, `read <ref>`, `read <ref> <field>`, `read <id> --id [field]`\n\n**Diagnostics:** `diagnose` — session store, userId, active session (after open/read issues)\n\n**Editing:** `set <ref> <field> <value>`, `rtf <ref> <field> --content \"<md>\"`, `diff`, `save`, `discard`\n\n**Creating:** `create from-json --json … --dry-run --strict`, `export from-json`, `apply from-json --json …`, `create page` / `create article` for empty shells, `add` for tiny inserts\n\n**Other:** `health`, `version`, `guide [topic]`\n";
|
|
2
|
+
export const HOSTED_GUIDE_TEMPLATE = "# cms-edit MCP guide\n\nUse this guide when editing Contentful draft content through a hosted MCP connector (Claude Desktop Integrations + OAuth, or Grok Build).\n\n{{SITE_INTRO}}\n\n## Safety rules\n\ncms-edit **cannot and will not**:\n\n- Publish or unpublish entries\n- Archive or delete published entries\n\nAll `save` operations create **drafts only**. A human must review and publish in Contentful.\n\n**Assets:** Always **search and reuse** first (`index sync`, then `asset search`). Raster/video go through **`cms_edit_media`** (staged upload or Drive → prepare → import). Never `asset upload` jpeg/png/webp/gif/mp4, and never convert those files with local ffmpeg. SVG/PDF/Lottie: staged upload then `asset upload --staged`. **`--base64` is not supported on hosted MCP.**\n\n## MCP tools\n\n| Tool | Purpose |\n|------|---------|\n| `cms_edit` | Run any cms-edit command via an `args` array |\n| `cms_edit_request_staged_upload` | Presigned URL. `kind=asset` (default): binaries. `kind=text`: HtmlComponent fields then `set --staged`. `kind=json`: `create from-json --staged`. |\n| `cms_edit_version` | Check the installed cms-edit version (no session required) |\n| `cms_edit_help` | Guide topics (`overview`, `workflow`, `commands`, `troubleshooting`, `hosted`) **or** playbooks (`create-from-json`, `fields-html-component`, `fields-component`, …) |\n\n## Customer editor pack (read first)\n\nWhen a site editor pack is deployed, these MCP resources provide **site-specific** context. Read them before creating or editing content:\n\n| Resource | Purpose |\n|----------|---------|\n| `cms-edit://customer/index` | List of all customer resources |\n| `cms-edit://customer/tasks-index` | Intent → task playbook map (filtered for this site) |\n| `cms-edit://customer/capabilities` | Machine-readable list of what this site supports |\n| `cms-edit://customer/checklist` | First-session onboarding steps |\n| `cms-edit://customer/overview` | Site name, space, staging URL, handoff rules |\n| `cms-edit://customer/routing` | Article/tag URL rules for this site |\n| `cms-edit://customer/production-site` | Production URL and how to fetch page markdown (do not guess `.md` URLs) |\n| `cms-edit://customer/components-index` | Component types and when to use each |\n| `cms-edit://customer/collections-index` | Collection types |\n| `cms-edit://customer/brand` | Brand voice and terminology (if configured) |\n| `cms-edit://customer/articles` | Article/publication playbook (if configured) |\n| `cms-edit://customer/defaults` | Featured image rules and article types (if configured) |\n| `cms-edit://customer/site-facts` | Optional canonical business facts (if configured) |\n| `cms-edit://customer/task-*` | Capability playbooks (e.g. `task-media-reuse-and-upload`) |\n\n**Workflow:** read `tasks-index` → `capabilities` → `checklist` → `overview` → `routing` → `production-site` → pick a `task-*` playbook for your goal → `components-index` → then use `cms_edit` commands.\n\n## MCP prompts\n\n| Prompt | Purpose |\n|--------|---------|\n| `cms_edit_verify` | Check version and connectivity |\n| `cms_edit_explore` | List site content and open a page |\n| `cms_edit_edit_page` | Edit a page through diff → save |\n| `cms_edit_edit_article` | Edit an article through diff → save |\n| `cms_edit_index_sync` | Build/refresh local index (assets, media, templates, taxonomy) |\n| `cms_edit_create_page` | Create a page with template selection |\n| `cms_edit_create_article` | Create an article (requires article type; featured image rules) |\n| `cms_edit_create_from_doc` | Create a page from a freeform document (infer → confirm → dry-run) |\n| `cms_edit_create_article_from_doc` | Create an article from a freeform document |\n| `cms_edit_taxonomy` | Import taxonomy entries (`create … --if-not-exists`) |\n| `cms_edit_bulk_seo` | Update SEO meta descriptions (read `task-seo-descriptions`) |\n| `cms_edit_bulk_find_replace` | Bulk find-replace in rich text across entries |\n| `cms_edit_bulk_article_tags` | Update tags on one or more articles |\n| `cms_edit_import_authors` | Create person/author entries from a list or sheet |\n| `cms_edit_media` | Find existing assets or upload new ones (reuse-first) |\n\nRead the full guide anytime via the `cms-edit://guide` resource or `cms_edit_help`.\n\n## End-to-end QA prompt\n\nFor release QA after cms-edit or editor-pack upgrades, use a **copy-paste Claude Desktop test script** (phases: connector → customer resources → discovery → session → schema → media → dry-run writes → negatives). See [e2e-test-prompt.md](./e2e-test-prompt.md) to author one per customer site. Example: Brightline `docs/cms-edit/MCP-E2E-TEST.md`.\n\n## Core workflow\n\nStandard editing flow: **open → snapshot → read → set/rtf → diff → save**\n\nEach step is a separate `cms_edit` call. Sessions persist in Redis between calls (hosted) or on disk (local). MCP auto-uses session `_mcp`.\n\n### 1. Open a page\n\n```\n[\"open\", \"--page-slug\", \"/\"]\n[\"open\", \"--page-slug\", \"/pricing\"]\n[\"open\", \"--id\", \"<entry-id>\"]\n[\"open\", \"--include-chrome\", \"--page-slug\", \"/pricing\"]\n```\n\nDefault `open` / `peek` fetch the page or article tree and the template entry, but **not** template menu/footer/navigation. Edit nav with `[\"nav\", \"open\", \"--nav-id\", \"<id>\"]` or `--nav-name` (not `--id`). Use `--include-chrome` only when you need those trees. Template `menu` is site-wide; `page.menu` overrides one page. Nested nav items are often shared — ask global vs page-specific before `set`.\n\n**Homepage (all SE Studio sites):** Contentful stores the marketing homepage slug as `index`. The live site URL is `/`. In cms-edit, `--page-slug /` and `--page-slug /index` are equivalent (both resolve to `index`). Read `cms-edit://customer/routing` for site-specific exceptions (e.g. Pedestal uses `home`).\n\n### 2. Snapshot — see the content tree\n\n```\n[\"snapshot\"]\n```\n\nOutput shows `@c0`, `@c1`, … refs for each component. Use these refs in `read`, `set`, and `rtf`.\n\n### 3. Read fields\n\n```\n[\"read\", \"@c1\"]\n[\"read\", \"@c1\", \"heading\"]\n```\n\n### 4. Edit fields\n\n```\n[\"set\", \"@c1\", \"heading\", \"New heading text\"]\n[\"rtf\", \"@c1\", \"body\", \"--content\", \"# Title\\n\\nParagraph text.\"]\n```\n\nFor rich text, prefer `--content` with inline markdown. Use `--base64` when special characters cause issues.\n\n### 5. Review and save\n\n```\n[\"diff\"]\n[\"save\"]\n```\n\nAlways run `diff` before `save`. To abandon changes: `[\"discard\"]`.\n\n## When to use Contentful UI\n\n| Task | Where |\n|------|-------|\n| Edit copy, add sections, create pages/articles | **Agent + cms-edit** (drafts) |\n| Upload new images and files | **Agent + cms-edit** — search/reuse first; raster/video via `cms_edit_media` import |\n| Publish approved drafts | **Contentful UI** |\n| Edit copy directly in Contentful | **Avoid** — use cms-edit instead |\n\ncms-edit saves **drafts only**. A colleague must **publish in Contentful** for changes to go live.\n\n## Asset upload (hosted MCP)\n\nHosted connectors have **no server filesystem** and **reject `asset upload --base64`**. Raster/video: staged intake then **media pipeline**. SVG/PDF/Lottie: staged then `asset upload --staged`.\n\n| Source | When | Example |\n|--------|------|---------|\n| **Staged + pipeline** | jpeg/png/webp/gif/mp4 | `cms_edit_media` prepare `stagedUploadIds` → import (required for video) |\n| **`--url`** | Pipeline-ready **images** only, or SVG/PDF | `[\"asset\", \"upload\", \"--url\", \"https://….blob.vercel-storage.com/ready.jpg\"]` |\n| **Staged consume** | SVG/PDF/Lottie | `asset upload --staged` |\n\n**After upload:** note the returned asset `id`, attach to the entry (`asset set @root media <id>` for person portraits), then `diff` → `save`. Upload alone does not update entries.\n\n**PNG** when transparency matters.\n\nFull workflow: `cms-edit://customer/task-media-reuse-and-upload`.\n\n### Common pitfalls (agents)\n\n| Issue | Do this |\n|-------|---------|\n| Singular Media on a component (`visual`) | `set @cN visual <mediaId> --link` — **not** `add … --target visual` |\n| Shared Drive folder has extra files | Import with `sourceNames` or `onlyWithOverrides` after catalog |\n| Prepare says no media / empty folder | Share folder **Viewer** with `media-pipeline-reader@se-media-pipeline.iam.gserviceaccount.com`, then re-prepare once |\n| MCP tool times out ~180s | `read` / `diff` / re-`catalog` before retrying the same write — server may already have saved |\n| `preview urls` has no Live Preview URL | Not a failed save. For **draft-only** pages use **siteLivePreview** (`/preview?id=`). Staging `showsDrafts` is false unless `DRAFT_ONLY`. |\n| Reuse-first import matches old fileNames | dry-run first; set `overrides[].fileName` for unique names when duplication is required |\n\n### Staged upload\n\nKeeps binary **and large text/JSON** out of MCP tool args. The agent uploads via `curl`, then passes only a short `uploadId`.\n\n1. `cms_edit_request_staged_upload` with `fileName`, `mimeType`, optional `kind` (`asset` \\| `text` \\| `json`), optional `byteLength`, optional `title`. If the wrapper schema has no `kind`, use `cms_edit` `[\"staged-upload\", \"request\", \"--kind\", \"json\", \"--file-name\", \"...\", \"--mime\", \"application/json\"]` (or `--kind text` for HtmlComponent fields).\n2. Run the returned `curlCommand` in a shell (POST multipart to `uploadUrl`)\n3. Follow `consumeArgs`:\n - **asset:** media prepare for jpeg/png/webp/gif/mp4; **asset upload --staged** for SVG/PDF/Lottie\n - **text:** `set @ref field --staged <id>` (insert ref and field id)\n - **json:** `create from-json --staged <id>` (add `--dry-run --strict` first). Dry-run does not consume the slot.\n4. For pipeline jobs: wait → catalog → **import** (required for video). Then link and save\n\nHosted **inline** `--json` / `--content` / `--*-base64` is capped at **8192 bytes**. Staged files: **4 MB**. Rate limit: **1000 upload URLs per user per hour**. TTL: **60 minutes**.\n\n## Featured images (articles)\n\nRead `cms-edit://customer/defaults` when present. Otherwise:\n\n1. **Custom** — set `featuredImage` or `featuredImageAssetFilename` on the article when the editor provides a specific image\n2. **Article type** — if omitted, cms-edit inherits the linked **articleType** `featuredImage`\n3. **Site default** — from `editor.defaults` in the site config (also in `defaults.json` in the editor pack)\n\nRun `[\"index\", \"sync\"]` before resolving assets by filename.\n\n## JSON payloads (filesystem vs no filesystem)\n\nHosted MCP cannot see your disk. **Do not** put 10–50k strings in `cms_edit` args.\n\n- **Over 8k:** write the file, `kind=json` or `kind=text`, curl, `--staged`\n- **Tiny JSON only:** `--json` on the tool call\n- Never `--file` or stdin for content\n\n## Create content\n\n### Create a page\n\n```\n[\"schema\", \"component\"]\n[\"help\", \"create-from-json\"]\n[\"create\", \"from-json\", \"--json\", \"{...}\", \"--dry-run\", \"--strict\"]\n[\"create\", \"from-json\", \"--json\", \"{...}\"]\n```\n\nUse `\"components\"` (not `\"content\"`) and nested `\"type\"` (not `\"componentType\"`). Peek a live entry or `schema <ct>` before authoring field ids.\n\nEmpty `components` fails validation. Incremental `add`/`set` is for tiny patches only.\n\n### Create an article\n\nEvery article requires an **articleType**:\n\n```\n[\"index\", \"sync\"]\n[\"list\", \"--type\", \"articleType\"]\n[\"create\", \"article\", \"--slug\", \"resources/blog/my-post\", \"--title\", \"My Post\", \"--article-type-slug\", \"resources/blog\"]\n```\n\nOr `create from-json` with `\"type\": \"article\"` and `articleTypeSlug` / `articleTypeId`.\n\nUse MCP prompt `cms_edit_create_article` for guided creation.\n\n## Common sequences\n\n### List all pages\n\n```\n[\"list\", \"--type\", \"page\"]\n```\n\n### Refresh local index (assets, media, templates, taxonomy)\n\nRun before asset filename search, media-by-filename list, or fast template/taxonomy lookup:\n\n```\n[\"index\", \"sync\"]\n[\"index\", \"status\"]\n[\"list\", \"--type\", \"template\"]\n```\n\nAsset search and media-by-filename list **require** the index. Template/taxonomy list prefers the index when built.\n\n### Explore the homepage\n\n```\n[\"open\", \"--page-slug\", \"/\"]\n[\"snapshot\"]\n[\"read\", \"@c1\"]\n```\n\n### Edit copy on a page\n\n```\n[\"open\", \"--page-slug\", \"{{EXAMPLE_SLUG}}\"]\n[\"snapshot\"]\n[\"read\", \"@c1\", \"heading\"]\n[\"set\", \"@c1\", \"heading\", \"Updated heading\"]\n[\"diff\"]\n[\"save\"]\n```\n\n## Field discovery\n\n```\n[\"schema\", \"component\"]\n[\"list\", \"--type\", \"page\"]\n[\"search\", \"pricing\"]\n```\n\n## Grok Build setup\n\nGrok connects to the same hosted MCP URL as Claude. Add to `~/.grok/config.toml`:\n\n```toml\n[mcp_servers.cms-edit-brightline]\nurl = \"https://brightline.content.se.studio/api/mcp\"\nenabled = true\n```\n\nReplace the server name and host with your site's deployment. The URL **must** end with `/api/mcp` (not the site root).\n\n**Connect:**\n\n1. In Grok, run `/mcps` and select your cms-edit server\n2. Press **`i`** to initiate OAuth (not just enable the toggle)\n3. Sign in with Contentful when the browser opens\n4. Verify with `grok mcp doctor <server-name>` or call `cms_edit_version`\n\nOAuth is two steps: Grok obtains an MCP token, then you sign in with Contentful to link your account. If the browser flashes and closes immediately, reconnect after upgrading cms-edit (loopback redirect handling).\n\n## Hosted connector rules\n\n{{HOSTED_RULES}}\n\n## Session tips\n\n- After `open`, subsequent MCP commands share session `_mcp` automatically (stored in Redis on hosted).\n- Use `--session <name>` only when juggling multiple pages — pass it **before** the subcommand on every call: `[\"--session\", \"my-work\", \"open\", \"--page-slug\", \"/\"]`.\n- Snapshot JSON includes `sessionName` and `sessionKey` for debugging.\n- If you see \"No active session\", check `/api/health` (Redis must be ok), then run `open` again. Set `LOG_CMS_SESSION=1` on Vercel and search runtime logs for `[cms-edit:session]` (`redis save ok` / `redis load hit` / `requireSession miss`).\n\n### peek vs open vs read\n\n| Goal | MCP args |\n|------|----------|\n| Edit workflow (session) | `[\"open\", \"--page-slug\", \"/\"]` then `[\"read\", \"@c0\"]` |\n| Preview tree + fields, no session | `[\"peek\", \"--page-slug\", \"/pricing\"]` or `[\"peek\", \"--id\", \"<entry-id>\"]` (JSON includes `rootFields`) |\n| Read fields by entry ID, no session | `[\"read\", \"<entry-id>\", \"--id\"]` or `[\"read\", \"<entry-id>\", \"--id\", \"heading\"]` |\n| Debug session persistence | `[\"diagnose\"]` — reports store, userId, active session key |\n\n- **`peek` is one-shot** — prints tree and **root field values** (`rootFields` in JSON). No session is created; do not chain `read @ref` afterward.\n- **`open` / `nav open` persist** the session. `preview urls /slug` follows that slug even if leftover `_mcp` is another page (JSON may include `sessionRootIgnored`).\n- **Use flat lookup flags** for `open` and `peek` — same as CLI (`--page-slug`, `--id`, etc.). See `help lookup`. `nav open` uses `--nav-id` or `--nav-name` only.\n- **`read @root`** only works after `open` (uses the active session). The hint in peek output is for terminal users who already ran `open`.\n- **Do not invent flags** — there is no `--read`, `--then`, or chained peek+read syntax. One command per `cms_edit` call.\n\n## Troubleshooting\n\n| Problem | What to do |\n|---------|------------|\n| **401 / connection failed** | Reconnect: Claude → Settings → Integrations, or Grok `/mcps` → press `i`. Complete Contentful sign-in. If Grok says “Failed to get tools after auth” or `auth required`, check Vercel `[cms-edit:oauth] auth_failure`. `invalid_refresh_token` is a rotated/missing MCP refresh UUID (fixed in **3.6.1+** by not rotating). `missing_contentful_token` / `invalid_contentful_token` means the CMA cache is gone — **3.5.3+** returns `invalid_token` so Grok re-runs Contentful sign-in. If it still loops, delete that server’s entry from `~/.grok/mcp_credentials.json` and press `i` again. Set `LOG_CMS_OAUTH=1` for connect success traces. |\n| **No cms_edit tool** | Confirm the integration is connected under Settings → Integrations |\n| **No active session** | Do not pass `--space` on hosted. Check `/api/health` — `redis` must be ok. MCP uses `_mcp` session automatically. Manual session: `[\"--session\", \"name\", \"open\", \"--page-slug\", \"/\"]`. Fallback: `[\"read\", \"<entry-id>\", \"--id\"]` |\n| **Wrong space** | Your Contentful account must have access to this deployment's space |\n| **Check version** | Call `cms_edit_version` or `curl /api/health` and read `cmsEdit` |\n| **staged GET failed 405** | Pipeline cannot download staged files. Host must export GET `/api/staged-upload` (`@se-studio/contentful-cms` with staged GET). Bump + redeploy the host. Do not retry prepare or use the Contentful UI. |\n| **staged GET failed 404** | GET is mounted; the slot is missing, expired, or not POSTed yet. Re-stage (POST) and prepare once. Not a host bump. |\n| **pipeline_unconfigured** | `/api/health` `checks.mediaPipeline.ok` is false. Ops set `MEDIA_PIPELINE_*` on the host. Do not ask the user for a pipeline key. |\n\n## Articles\n\n**Recent articles** (by publication `date`, not last-updated):\n\n```json\n[\"list\", \"--type\", \"article\", \"--sort\", \"date\", \"-n\", \"10\"]\n```\n\nAlternative: `[\"search\", \"<keyword>\", \"--type\", \"article\"]` (also sorts by date).\n\n**Draft articles** — `peek` and `open` load drafts via CMA (not published-only). To discover drafts:\n\n```json\n[\"list\", \"--type\", \"article\", \"--sort\", \"date\"]\n[\"search\", \"<title>\", \"--type\", \"article\"]\n[\"list\", \"--type\", \"article\", \"--slug\", \"<slug>\"]\n```\n\nThen open: `[\"peek\", \"--article-slug\", \"<slug>\"]` or `[\"open\", \"--id\", \"<entry-id>\"]`. Use `--article-slug`, not `--page-slug`.\n\n**Published-only** is opt-in: `list --published` and `resolve --published` use the Delivery API index and omit never-published drafts.\n\nAfter upgrading cms-edit, run `[\"index\", \"sync\"]` once so the local index includes article `date` values (schema v4).\n\n**Index freshness on hosted MCP:** The catalog index is shared via Redis (gzipped SQLite blob). `index status` on a cold instance may show **not built** until `list`, `open`, or another index command runs — that is normal. Committed writes (`save`, `create page`, `asset upload`, …) mark the index dirty; the next discovery command refreshes it. In-session `set` edits do not trigger a sync.\n\n## Command reference (cms_edit args)\n\n**Discovery:** `list --type <type>`, `search <query>`, `schema <contentType>`, `index sync`, `index status`\n\n**Reading:** `open --page-slug <slug>`, `open --id <id>`, `peek --page-slug <slug>`, `peek --id <id>`, `snapshot`, `read <ref>`, `read <ref> <field>`, `read <id> --id [field]`\n\n**Diagnostics:** `diagnose` — session store, userId, active session (after open/read issues)\n\n**Editing:** `set <ref> <field> <value>`, `rtf <ref> <field> --content \"<md>\"`, `diff`, `save`, `discard`\n\n**Creating:** `create from-json --json … --dry-run --strict`, `export from-json`, `apply from-json --json …`, `create page` / `create article` for empty shells, `add` for tiny inserts\n\n**Other:** `health`, `version`, `guide [topic]`\n";
|
|
3
3
|
//# sourceMappingURL=hosted-guide.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-guide.js","sourceRoot":"","sources":["../../src/generated/hosted-guide.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,MAAM,CAAC,MAAM,qBAAqB,GAAG,
|
|
1
|
+
{"version":3,"file":"hosted-guide.js","sourceRoot":"","sources":["../../src/generated/hosted-guide.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,MAAM,CAAC,MAAM,qBAAqB,GAAG,+hmBAA+hmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../../../src/hosted/next/routes/health.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../../../src/hosted/next/routes/health.ts"],"names":[],"mappings":"AAyBA,wBAAsB,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAwF7D"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { loadEditorPackManifest } from '../../../editor-pack/load.js';
|
|
2
|
+
import { mediaPipelineHealthCheck, stagedUploadHealthCheck, } from '../../../media-pipeline/config.js';
|
|
2
3
|
import { buildCustomerPlaybookIndex } from '../../customer-playbooks.js';
|
|
3
4
|
import { GETTING_STARTED_INFO, getMcpResourceUrl, getVersionInfo, handleOAuthHealthCheck, loadHostedDeploymentFromEnv, } from '../../index.js';
|
|
4
5
|
import { getHostedEditorPackPath } from '../editor-pack-path.js';
|
|
@@ -13,6 +14,8 @@ export async function GET(request) {
|
|
|
13
14
|
redis: { ok: false, detail: 'Not checked' },
|
|
14
15
|
oauth: { ok: false, detail: 'Not checked' },
|
|
15
16
|
editorPack: { ok: false, detail: 'Not checked', path: '' },
|
|
17
|
+
stagedUpload: { ok: false, detail: 'Not checked' },
|
|
18
|
+
mediaPipeline: mediaPipelineHealthCheck(),
|
|
16
19
|
};
|
|
17
20
|
try {
|
|
18
21
|
// Space-scoped so shared cmsedit-sessions Redis does not mix probes across hosts.
|
|
@@ -43,6 +46,7 @@ export async function GET(request) {
|
|
|
43
46
|
};
|
|
44
47
|
const ok = checks.config.ok && checks.redis.ok && checks.oauth.ok;
|
|
45
48
|
const origin = new URL(request.url).origin;
|
|
49
|
+
checks.stagedUpload = await stagedUploadHealthCheck({ origin });
|
|
46
50
|
const landingPageUrl = `${origin}/cms-edit`;
|
|
47
51
|
const playbooksUrl = `${origin}/cms-edit/playbooks`;
|
|
48
52
|
const customerApiUrl = `${origin}/api/customer`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.js","sourceRoot":"","sources":["../../../../src/hosted/next/routes/health.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"health.js","sourceRoot":"","sources":["../../../../src/hosted/next/routes/health.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EACL,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OA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BAAiB,EAAE,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,iEAAiE;IACnE,CAAC;IAED,MAAM,iBAAiB,GAAG,0BAA0B,CAAC,MAAM,EAAE,uBAAuB,EAAE,CAAC,CAAC;IAExF,OAAO,QAAQ,CAAC,IAAI,CAClB;QACE,EAAE;QACF,OAAO,EAAE,cAAc,EAAE;QACzB,cAAc,EAAE;YACd,GAAG,oBAAoB;YACvB,cAAc;YACd,iBAAiB,EAAE,MAAM;YACzB,YAAY;YACZ,cAAc;YACd,YAAY,EAAE,mBAAmB;YACjC,iBAAiB,EAAE,iBAAiB;gBAClC,CAAC,CAAC;oBACE,UAAU,EAAE,iBAAiB,CAAC,UAAU;oBACxC,WAAW,EAAE,iBAAiB,CAAC,WAAW;oBAC1C,SAAS,EAAE,iBAAiB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;wBACxD,IAAI,EAAE,QAAQ,CAAC,IAAI;wBACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;qBACxB,CAAC,CAAC;iBACJ;gBACH,CAAC,CAAC,IAAI;SACT;QACD,UAAU,EAAE,EAAE,UAAU,EAAE,UAAU,CAAC,UAAU,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,EAAE;QAC9E,MAAM;KACP,EACD,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import type { HostedMcpInfo } from '../guide.js';
|
|
3
3
|
import type { RunCmsEditFn } from '../types.js';
|
|
4
|
-
export declare const TOOL_DESCRIPTION = "Run any cms-edit command. cms-edit edits Contentful draft content (no publishing).\n\nUse hosted MCP only for content. Do not run a local cms-edit binary, --file, or stdin for pages.\n\nJSON-first (preferred for a whole page):\n [\"schema\", \"component\"] then [\"schema\", \"types\", \"component\"] \u2014 field ids and enums for THIS space\n [\"help\", \"create-from-json\"] or cms_edit_help {topic:\"create-from-json\"}\n Hosted payloads over 8192 bytes MUST use staged upload (kind=json), not --json / --json-base64.\n Filesystem client: write JSON on disk, cms_edit_request_staged_upload kind=json, curl, then\n [\"create\", \"from-json\", \"--staged\", \"<id>\", \"--dry-run\", \"--strict\"]\n Tiny JSON only: [\"create\", \"from-json\", \"--json\", \"{...}\", \"--dry-run\", \"--strict\"]\n Then the same command without --dry-run. Never publish.\n Edit existing: [\"open\", \"--page-slug\", \"/x\"] \u2192 [\"export\", \"from-json\"] \u2192 staged json \u2192 [\"apply\", \"from-json\", \"--staged\", \"<id>\"]\n Tiny patches only: set / rtf / add. Long Text (rawHtml/customCss/customJs): kind=text then set --staged.\n Object JSON, rtf --content, batch run, person/taxonomy imports: --staged when over 8k (kind=json or kind=text).\n\nUse cms_edit_version (no args) to check the installed version.\nUse cms_edit_help to read the getting-started guide or playbooks (including create-from-json).\n Topic \"workflow\" is the playbook; use topic \"guide/workflow\" for the short hosted-guide section.\nOutput: command JSON, then a last line {\"cma_requests\":N,\"cpa_requests\":N} (parse the last line for CMA counts; JSON.parse the command body separately).\nUse cms_edit_customer to read site-specific playbooks (articles, routing, blog-tag-matrix, etc.).\nIf Integrations only exposes cms_edit, use [\"customer\", \"index\"] or [\"customer\", \"resource=index\"] instead.\nRead the cms-edit://guide resource for the full guide.\n\nWorkflow (patches): open \u2192 snapshot \u2192 read/set/rtf/add/remove \u2192 diff \u2192 save\nAll saves create drafts only \u2014 a human must publish in Contentful.\n\nCRITICAL \u2014 sessions and open:\n set/rtf field edits are staged until save. Plain open while dirty HARD-FAILS (does not wipe silently).\n [\"open\", \"--resume\"] \u2014 re-print current session; keeps all staged edits (no Contentful refetch)\n [\"open\", \"--overwrite\", \"--confirm-discard\", \"--id\", \"<id>\"] \u2014 abandon staged work and load a new entry\n [\"discard\"] then open \u2014 also valid abandon path\n Never re-open the same article mid-edit without save/discard \u2014 use --resume if you only need the tree again.\n\nCommon command sequences:\n [\"open\", \"--page-slug\", \"/\"] \u2014 homepage (CMS slug index; /index is equivalent)\n [\"open\", \"--page-slug\", \"/pricing\"] \u2014 load a page by slug (skips template menu/footer)\n [\"open\", \"--include-chrome\", \"--page-slug\", \"/pricing\"] \u2014 also fetch template nav chrome\n [\"open\", \"--id\", \"<entry-id>\"] \u2014 load by Contentful entry ID\n [\"open\", \"--resume\"] \u2014 keep staged work; re-print snapshot\n [\"snapshot\"] \u2014 print content tree with @refs\n [\"read\", \"@c0\"] \u2014 read all fields of a component (requires open session)\n [\"read\", \"@c0\", \"heading\"] \u2014 read a specific field (requires open session)\n [\"read\", \"@root\"] \u2014 read root entry fields (requires open session)\n [\"read\", \"<entry-id>\", \"--id\"] \u2014 read entry by ID (no session)\n [\"read\", \"<entry-id>\", \"--id\", \"heading\"] \u2014 read one field by entry ID (no session)\n [\"peek\", \"--page-slug\", \"/pricing\"] \u2014 preview tree + root fields (no session)\n [\"peek\", \"--id\", \"<entry-id>\"] \u2014 preview by entry ID with rootFields in JSON\n [\"set\", \"@c0\", \"heading\", \"New heading\"] \u2014 set a scalar field\n [\"set\", \"<entry-id>\", \"autoplay\", \"true\"] \u2014 mid-session scalar by ID (e.g. media; no re-open)\n [\"set\", \"<entry-id>:autoplay=true\"] \u2014 same, batch-shaped token on page session\n [\"set\", \"@c1\", \"visual\", \"<media-id>\", \"--link\"] \u2014 single Entry link field only\n [\"set\", \"@c2\", \"contents\", \"<id1>,<id2>\", \"--links\"] \u2014 array of links (full replace); never --link on arrays\n [\"rtf\", \"@c0\", \"body\", \"--content\", \"# H1\\n\\nBody.\"] \u2014 set rich text (preferred for AI)\n [\"rtf\", \"@c0\", \"body\", \"--base64\", \"<encoded>\"] \u2014 set rich text via base64 (no filesystem)\n [\"set\", \"@c1\", \"rawHtml\", \"--staged\", \"<id>\"] \u2014 long Text from staged upload (kind=text)\n [\"read\", \"@c0\", \"--hash\"] \u2014 byte lengths + sha256 (no bodies)\n [\"diff\"] \u2014 pending changes; long Text is bytes/sha256/head only\n [\"save\"] \u2014 write drafts to Contentful\n [\"discard\"] \u2014 discard unsaved changes\n [\"links\", \"set\", \"@c0\", \"0\", \"variant\", \"link\"] \u2014 set scalar field on link at index 0\n [\"batch\", \"set\", \"<entry-id>:variant=link\"] \u2014 scalar by ID (OK mid-page session; then save)\n [\"batch\", \"diff\"] \u2014 show pending batch edits\n [\"batch\", \"save\"] \u2014 save all batch edits as drafts\n [\"health\"] \u2014 verify config and connectivity\n [\"diagnose\"] \u2014 session/MCP diagnostics (store, userId, active session)\n [\"version\"] \u2014 print installed cms-edit version\n [\"guide\"] \u2014 print getting-started guide\n [\"guide\", \"workflow\"] \u2014 print a guide section\n [\"customer\", \"index\"] \u2014 list site editor playbooks\n [\"customer\", \"articles\"] \u2014 read articles playbook\n [\"customer\", \"resource=index\"] \u2014 same as index (Integrations fallback)\n [\"list\", \"--type\", \"article\", \"--sort\", \"date\", \"-n\", \"10\"] \u2014 recent articles by publication date\n [\"list\", \"--type\", \"article\", \"--sort\", \"date\"] \u2014 list articles (preview index includes drafts)\n [\"peek\", \"--article-slug\", \"<slug>\"] \u2014 preview draft or published article (CMA)\n [\"preview\", \"url\", \"/pricing\"] \u2014 staging page URL (open in browser MCP)\n [\"preview\", \"urls\", \"/pricing\"] \u2014 all preview targets; slug wins over leftover session root\n [\"nav\", \"open\", \"--nav-id\", \"<id>\"] \u2014 persist a navigation session (not --id)\n [\"nav\", \"open\", \"--nav-name\", \"Main menu\"] \u2014 same by navigation name\n [\"preview\", \"showcase\", \"--component\", \"HeroSimple\"] \u2014 component showcase URL (mock data)\n [\"preview\", \"showcase\", \"--collection\", \"CardGrid\", \"--param\", \"backgroundColour=Navy\"]\n\nDiscovery notes:\n Visual checks: use preview url / preview showcase, then open the returned URL with a browser MCP (cms-edit does not capture screenshots).\n peek/open/read --id load draft content via CMA \u2014 NOT published-only.\n Only list --published / resolve --published use the published-only Delivery API index.\n Articles: use --article-slug (not --page-slug). search --type article sorts by publication date.\n\nSessions persist between MCP calls (Redis on hosted, disk locally). MCP auto-uses session \"_mcp\" unless you pass --session.\nUse --session <name> before the subcommand to isolate concurrent workflows, e.g. [\"--session\", \"my-work\", \"open\", \"--page-slug\", \"/\"].\nUse --space <name> to target a specific Contentful space (local MCP only \u2014 omit for hosted Integrations).\nStateless read (no open required): [\"read\", \"<entry-id>\", \"--id\"] or [\"read\", \"<entry-id>\", \"--id\", \"heading\"].\npeek is one-shot (no session). open / nav open persist. preview urls /slug follows that slug even if _mcp is another page (JSON may include sessionRootIgnored).\nBefore set on a nested nav item (often a shared header CTA): ask whether the change is global or page-specific. Page-specific \u2192 new NavigationItem + page.menu (or a cloned menu), do not mutate the shared entry.\nTemplate menu is site-wide; page.menu overrides one page. nav clone is shallow for nested navigationItems.\nOutput is always JSON (CMS_EDIT_JSON=1 is forced by the MCP server).\n\n\nRich text tips:\n --content \"<markdown>\" preferred named flag for inline content (hosted: max 8192 bytes)\n --base64 \"<encoded>\" fully environment-agnostic, no filesystem needed\n --staged \"<id>\" kind=text (or kind=json with --rtf-json)\n\nJSON bulk input (create/apply from-json, batch run, taxonomy/person/article-tags imports, set object fields, rtf patch):\n --json \"<string>\" inline JSON (hosted: max 8192 bytes)\n --json-base64 \"<b64>\" base64-encoded JSON (hosted: max 8192 decoded bytes)\n --staged \"<id>\" after cms_edit_request_staged_upload kind=json\n\nAsset upload (hosted MCP):\n Raster/video: cms_edit_request_staged_upload \u2192 curl \u2192 cms_edit_media prepare with stagedUploadIds \u2192 wait \u2192 catalog \u2192 import (video: import only; overrides[].alt required). Never asset upload --staged/--base64 for jpeg/png/webp/gif/mp4. Never asset upload --url for video.\n SVG/PDF/Lottie: [\"staged-upload\", \"request\", ...] then curl, then [\"asset\", \"upload\", \"--staged\", \"<id>\", ...].\n Long Text / large page JSON: cms_edit_request_staged_upload kind=text|json \u2192 curl \u2192 set --staged or create from-json --staged.\n Pipeline ready **image** URLs may use import or asset upload --url on a Blob pack host.";
|
|
4
|
+
export declare const TOOL_DESCRIPTION = "Run any cms-edit command. cms-edit edits Contentful draft content (no publishing).\n\nUse hosted MCP only for content. Do not run a local cms-edit binary, --file, or stdin for pages.\n\nJSON-first (preferred for a whole page):\n [\"schema\", \"component\"] then [\"schema\", \"types\", \"component\"] \u2014 field ids and enums for THIS space\n [\"help\", \"create-from-json\"] or cms_edit_help {topic:\"create-from-json\"}\n Hosted payloads over 8192 bytes MUST use staged upload (kind=json), not --json / --json-base64.\n Filesystem client: write JSON on disk, cms_edit_request_staged_upload kind=json, curl, then\n [\"create\", \"from-json\", \"--staged\", \"<id>\", \"--dry-run\", \"--strict\"]\n Tiny JSON only: [\"create\", \"from-json\", \"--json\", \"{...}\", \"--dry-run\", \"--strict\"]\n Then the same command without --dry-run. Never publish.\n Edit existing: [\"open\", \"--page-slug\", \"/x\"] \u2192 [\"export\", \"from-json\"] \u2192 staged json \u2192 [\"apply\", \"from-json\", \"--staged\", \"<id>\"]\n Tiny patches only: set / rtf / add. Long Text (rawHtml/customCss/customJs): kind=text then set --staged.\n Object JSON, rtf --content, batch run, person/taxonomy imports: --staged when over 8k (kind=json or kind=text).\n\nUse cms_edit_version (no args) to check the installed version.\nUse cms_edit_help to read the getting-started guide or playbooks (including create-from-json).\n Topic \"workflow\" is the playbook; use topic \"guide/workflow\" for the short hosted-guide section.\nOutput: command JSON, then a last line {\"cma_requests\":N,\"cpa_requests\":N} (parse the last line for CMA counts; JSON.parse the command body separately).\nUse cms_edit_customer to read site-specific playbooks (articles, routing, blog-tag-matrix, etc.).\nIf Integrations only exposes cms_edit, use [\"customer\", \"index\"] or [\"customer\", \"resource=index\"] instead.\nRead the cms-edit://guide resource for the full guide.\n\nWorkflow (patches): open \u2192 snapshot \u2192 read/set/rtf/add/remove \u2192 diff \u2192 save\nAll saves create drafts only \u2014 a human must publish in Contentful.\n\nCRITICAL \u2014 sessions and open:\n set/rtf field edits are staged until save. Plain open while dirty HARD-FAILS (does not wipe silently).\n [\"open\", \"--resume\"] \u2014 re-print current session; keeps all staged edits (no Contentful refetch)\n [\"open\", \"--overwrite\", \"--confirm-discard\", \"--id\", \"<id>\"] \u2014 abandon staged work and load a new entry\n [\"discard\"] then open \u2014 also valid abandon path\n Never re-open the same article mid-edit without save/discard \u2014 use --resume if you only need the tree again.\n\nCommon command sequences:\n [\"open\", \"--page-slug\", \"/\"] \u2014 homepage (CMS slug index; /index is equivalent)\n [\"open\", \"--page-slug\", \"/pricing\"] \u2014 load a page by slug (skips template menu/footer)\n [\"open\", \"--include-chrome\", \"--page-slug\", \"/pricing\"] \u2014 also fetch template nav chrome\n [\"open\", \"--id\", \"<entry-id>\"] \u2014 load by Contentful entry ID\n [\"open\", \"--resume\"] \u2014 keep staged work; re-print snapshot\n [\"snapshot\"] \u2014 print content tree with @refs\n [\"read\", \"@c0\"] \u2014 read all fields of a component (requires open session)\n [\"read\", \"@c0\", \"heading\"] \u2014 read a specific field (requires open session)\n [\"read\", \"@root\"] \u2014 read root entry fields (requires open session)\n [\"read\", \"<entry-id>\", \"--id\"] \u2014 read entry by ID (no session)\n [\"read\", \"<entry-id>\", \"--id\", \"heading\"] \u2014 read one field by entry ID (no session)\n [\"peek\", \"--page-slug\", \"/pricing\"] \u2014 preview tree + root fields (no session)\n [\"peek\", \"--id\", \"<entry-id>\"] \u2014 preview by entry ID with rootFields in JSON\n [\"set\", \"@c0\", \"heading\", \"New heading\"] \u2014 set a scalar field\n [\"set\", \"<entry-id>\", \"autoplay\", \"true\"] \u2014 mid-session scalar by ID (e.g. media; no re-open)\n [\"set\", \"<entry-id>:autoplay=true\"] \u2014 same, batch-shaped token on page session\n [\"set\", \"@c1\", \"visual\", \"<media-id>\", \"--link\"] \u2014 single Entry link field only\n [\"set\", \"@c2\", \"contents\", \"<id1>,<id2>\", \"--links\"] \u2014 array of links (full replace); never --link on arrays\n [\"rtf\", \"@c0\", \"body\", \"--content\", \"# H1\\n\\nBody.\"] \u2014 set rich text (preferred for AI)\n [\"rtf\", \"@c0\", \"body\", \"--base64\", \"<encoded>\"] \u2014 set rich text via base64 (no filesystem)\n [\"set\", \"@c1\", \"rawHtml\", \"--staged\", \"<id>\"] \u2014 long Text from staged upload (kind=text)\n [\"read\", \"@c0\", \"--hash\"] \u2014 byte lengths + sha256 (no bodies)\n [\"diff\"] \u2014 pending changes; long Text is bytes/sha256/head only\n [\"save\"] \u2014 write drafts to Contentful\n [\"discard\"] \u2014 discard unsaved changes\n [\"links\", \"set\", \"@c0\", \"0\", \"variant\", \"link\"] \u2014 set scalar field on link at index 0\n [\"batch\", \"set\", \"<entry-id>:variant=link\"] \u2014 scalar by ID (OK mid-page session; then save)\n [\"batch\", \"diff\"] \u2014 show pending batch edits\n [\"batch\", \"save\"] \u2014 save all batch edits as drafts\n [\"health\"] \u2014 verify config and connectivity\n [\"diagnose\"] \u2014 session/MCP diagnostics (store, userId, active session)\n [\"version\"] \u2014 print installed cms-edit version\n [\"guide\"] \u2014 print getting-started guide\n [\"guide\", \"workflow\"] \u2014 print a guide section\n [\"customer\", \"index\"] \u2014 list site editor playbooks\n [\"customer\", \"articles\"] \u2014 read articles playbook\n [\"customer\", \"resource=index\"] \u2014 same as index (Integrations fallback)\n [\"list\", \"--type\", \"article\", \"--sort\", \"date\", \"-n\", \"10\"] \u2014 recent articles by publication date\n [\"list\", \"--type\", \"article\", \"--sort\", \"date\"] \u2014 list articles (preview index includes drafts)\n [\"peek\", \"--article-slug\", \"<slug>\"] \u2014 preview draft or published article (CMA)\n [\"preview\", \"url\", \"/pricing\"] \u2014 staging page URL (open in browser MCP)\n [\"preview\", \"urls\", \"/pricing\"] \u2014 all preview targets; slug wins over leftover session root\n [\"nav\", \"open\", \"--nav-id\", \"<id>\"] \u2014 persist a navigation session (not --id)\n [\"nav\", \"open\", \"--nav-name\", \"Main menu\"] \u2014 same by navigation name\n [\"preview\", \"showcase\", \"--component\", \"HeroSimple\"] \u2014 component showcase URL (mock data)\n [\"preview\", \"showcase\", \"--collection\", \"CardGrid\", \"--param\", \"backgroundColour=Navy\"]\n\nDiscovery notes:\n Visual checks: use preview url / preview showcase, then open the returned URL with a browser MCP (cms-edit does not capture screenshots).\n peek/open/read --id load draft content via CMA \u2014 NOT published-only.\n Only list --published / resolve --published use the published-only Delivery API index.\n Articles: use --article-slug (not --page-slug). search --type article sorts by publication date.\n\nSessions persist between MCP calls (Redis on hosted, disk locally). MCP auto-uses session \"_mcp\" unless you pass --session.\nUse --session <name> before the subcommand to isolate concurrent workflows, e.g. [\"--session\", \"my-work\", \"open\", \"--page-slug\", \"/\"].\nUse --space <name> to target a specific Contentful space (local MCP only \u2014 omit for hosted Integrations).\nStateless read (no open required): [\"read\", \"<entry-id>\", \"--id\"] or [\"read\", \"<entry-id>\", \"--id\", \"heading\"].\npeek is one-shot (no session). open / nav open persist. preview urls /slug follows that slug even if _mcp is another page (JSON may include sessionRootIgnored).\nBefore set on a nested nav item (often a shared header CTA): ask whether the change is global or page-specific. Page-specific \u2192 new NavigationItem + page.menu (or a cloned menu), do not mutate the shared entry.\nTemplate menu is site-wide; page.menu overrides one page. nav clone is shallow for nested navigationItems.\nOutput is always JSON (CMS_EDIT_JSON=1 is forced by the MCP server).\n\n\nRich text tips:\n --content \"<markdown>\" preferred named flag for inline content (hosted: max 8192 bytes)\n --base64 \"<encoded>\" fully environment-agnostic, no filesystem needed\n --staged \"<id>\" kind=text (or kind=json with --rtf-json)\n\nJSON bulk input (create/apply from-json, batch run, taxonomy/person/article-tags imports, set object fields, rtf patch):\n --json \"<string>\" inline JSON (hosted: max 8192 bytes)\n --json-base64 \"<b64>\" base64-encoded JSON (hosted: max 8192 decoded bytes)\n --staged \"<id>\" after cms_edit_request_staged_upload kind=json\n\nAsset upload (hosted MCP):\n Raster/video: cms_edit_request_staged_upload \u2192 curl \u2192 cms_edit_media prepare with stagedUploadIds \u2192 wait \u2192 catalog \u2192 import (video: import only; overrides[].alt required). Never asset upload --staged/--url/--base64 for jpeg/png/webp/gif/mp4. Never ffmpeg/convert GIF or PNG locally \u2014 leave the original file; the pipeline encodes (animated GIF \u2192 gif-converted MP4, mute-loop Media, not featuredImage).\n SVG/PDF/Lottie: [\"staged-upload\", \"request\", ...] then curl, then [\"asset\", \"upload\", \"--staged\", \"<id>\", ...].\n Long Text / large page JSON: cms_edit_request_staged_upload kind=text|json \u2192 curl \u2192 set --staged or create from-json --staged.\n Pipeline ready **image** URLs may use import or asset upload --url on a Blob pack host.";
|
|
5
5
|
export declare function registerCmsEditTools(server: McpServer, runCmsEdit: RunCmsEditFn, hosted?: HostedMcpInfo): void;
|
|
6
6
|
export declare function getMcpServerInfo(hosted?: HostedMcpInfo): {
|
|
7
7
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cms-edit.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/cms-edit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAOjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"cms-edit.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/cms-edit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAOjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,eAAO,MAAM,gBAAgB,wkVAgH6D,CAAC;AAE3F,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,YAAY,EACxB,MAAM,CAAC,EAAE,aAAa,GACrB,IAAI,CAmEN;AAED,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAE1F"}
|
|
@@ -112,7 +112,7 @@ JSON bulk input (create/apply from-json, batch run, taxonomy/person/article-tags
|
|
|
112
112
|
--staged "<id>" after cms_edit_request_staged_upload kind=json
|
|
113
113
|
|
|
114
114
|
Asset upload (hosted MCP):
|
|
115
|
-
Raster/video: cms_edit_request_staged_upload → curl → cms_edit_media prepare with stagedUploadIds → wait → catalog → import (video: import only; overrides[].alt required). Never asset upload --staged/--base64 for jpeg/png/webp/gif/mp4. Never
|
|
115
|
+
Raster/video: cms_edit_request_staged_upload → curl → cms_edit_media prepare with stagedUploadIds → wait → catalog → import (video: import only; overrides[].alt required). Never asset upload --staged/--url/--base64 for jpeg/png/webp/gif/mp4. Never ffmpeg/convert GIF or PNG locally — leave the original file; the pipeline encodes (animated GIF → gif-converted MP4, mute-loop Media, not featuredImage).
|
|
116
116
|
SVG/PDF/Lottie: ["staged-upload", "request", ...] then curl, then ["asset", "upload", "--staged", "<id>", ...].
|
|
117
117
|
Long Text / large page JSON: cms_edit_request_staged_upload kind=text|json → curl → set --staged or create from-json --staged.
|
|
118
118
|
Pipeline ready **image** URLs may use import or asset upload --url on a Blob pack host.`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/media.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAczE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/media.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAczE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA4CjD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,IAAI,CAqJlF"}
|
package/dist/mcp/tools/media.js
CHANGED
|
@@ -9,10 +9,12 @@ const TOOL_DESCRIPTION = `Prepare, inspect, and import media packs via the SE me
|
|
|
9
9
|
|
|
10
10
|
Uses the host's service credentials — never ask the user for MEDIA_PIPELINE_API_KEY or Blob tokens.
|
|
11
11
|
|
|
12
|
-
Raster images (jpeg/png/webp/gif) must be encoded here before Contentful. Video must be imported (not asset upload --url). Do not use asset upload --staged/--url/--base64 for jpeg/png/webp/gif/mp4. SVG, PDF, and Lottie may still use asset upload.
|
|
12
|
+
Raster images (jpeg/png/webp/gif) must be encoded here before Contentful. Video must be imported (not asset upload --url). Do not use asset upload --staged/--url/--base64 for jpeg/png/webp/gif/mp4. Do not convert GIF/PNG/MP4 with local ffmpeg — prepare the original file. SVG, PDF, and Lottie may still use asset upload.
|
|
13
|
+
|
|
14
|
+
If catalog/status gaps say "staged GET failed 405", stop. That is a cms-edit host version lag (GET /api/staged-upload missing). Do not retry prepare, do not fall back to the Contentful web UI.
|
|
13
15
|
|
|
14
16
|
Actions:
|
|
15
|
-
- prepare: start a pack job (returns jobId). Source is **one of**: driveFolderUrl, stagedUploadIds (after curl
|
|
17
|
+
- prepare: start a pack job (returns jobId). Source is **one of**: driveFolderUrl, stagedUploadIds (after curl POST to staged uploadUrl), and/or httpsUrls. Optional sourceNames/excludeSourceNames filter **before encode**. Omit sourceNames = entire Drive folder (slow for large packs).
|
|
16
18
|
- status: poll job status / gap counts
|
|
17
19
|
- catalog: list ready assets (readyUrl, previewUrl) for naming/alt
|
|
18
20
|
- wait: poll until terminal or timeout (~25s default)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../../src/mcp/tools/media.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEL,YAAY,EACZ,WAAW,EACX,YA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K;YACnB,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;SACrB,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;SACnE,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -14,4 +14,25 @@ export interface MediaPipelineConfig {
|
|
|
14
14
|
*/
|
|
15
15
|
export declare function loadMediaPipelineConfig(envSource?: NodeJS.ProcessEnv): MediaPipelineConfig | null;
|
|
16
16
|
export declare function mediaPipelineConfiguredMessage(): string;
|
|
17
|
+
export declare function mediaPipelineHealthCheck(envSource?: NodeJS.ProcessEnv): {
|
|
18
|
+
ok: boolean;
|
|
19
|
+
detail: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function stagedUploadHmacCheck(envSource?: NodeJS.ProcessEnv): {
|
|
22
|
+
ok: boolean;
|
|
23
|
+
detail: string;
|
|
24
|
+
};
|
|
25
|
+
/** GET with no query: 400 "GET requires op=get" means GET is exported; 405 means POST-only. */
|
|
26
|
+
export declare function interpretStagedUploadGetProbe(status: number): {
|
|
27
|
+
getMounted: boolean;
|
|
28
|
+
detail: string;
|
|
29
|
+
};
|
|
30
|
+
export declare function stagedUploadHealthCheck(opts?: {
|
|
31
|
+
envSource?: NodeJS.ProcessEnv;
|
|
32
|
+
origin?: string;
|
|
33
|
+
fetchImpl?: typeof fetch;
|
|
34
|
+
}): Promise<{
|
|
35
|
+
ok: boolean;
|
|
36
|
+
detail: string;
|
|
37
|
+
}>;
|
|
17
38
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/media-pipeline/config.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACn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;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,CAiBA;AAED,wBAAsB,uBAAuB,CAAC,IAAI,CAAC,EAAE;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B,GAAG,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAuB3C"}
|
|
@@ -49,4 +49,64 @@ export function mediaPipelineConfiguredMessage() {
|
|
|
49
49
|
'Ops must set MEDIA_PIPELINE_BASE_URL, MEDIA_PIPELINE_SERVICE_KEY, and MEDIA_PIPELINE_TENANT. ' +
|
|
50
50
|
'Agents do not need (and must not be given) a pipeline API key.');
|
|
51
51
|
}
|
|
52
|
+
export function mediaPipelineHealthCheck(envSource = process.env) {
|
|
53
|
+
const cfg = loadMediaPipelineConfig(envSource);
|
|
54
|
+
if (!cfg) {
|
|
55
|
+
return { ok: false, detail: mediaPipelineConfiguredMessage() };
|
|
56
|
+
}
|
|
57
|
+
return { ok: true, detail: `${cfg.baseUrl} tenant=${cfg.tenant}` };
|
|
58
|
+
}
|
|
59
|
+
export function stagedUploadHmacCheck(envSource = process.env) {
|
|
60
|
+
if (!envSource['CMS_EDIT_UPLOAD_HMAC_SECRET']?.trim()) {
|
|
61
|
+
return {
|
|
62
|
+
ok: false,
|
|
63
|
+
detail: 'Missing CMS_EDIT_UPLOAD_HMAC_SECRET (staged POST upload and GET ?op=get disabled)',
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return { ok: true, detail: 'HMAC secret set' };
|
|
67
|
+
}
|
|
68
|
+
/** GET with no query: 400 "GET requires op=get" means GET is exported; 405 means POST-only. */
|
|
69
|
+
export function interpretStagedUploadGetProbe(status) {
|
|
70
|
+
if (status === 405) {
|
|
71
|
+
return {
|
|
72
|
+
getMounted: false,
|
|
73
|
+
detail: 'GET /api/staged-upload returned 405 (route does not export GET)',
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (status === 400 || status === 401 || status === 404) {
|
|
77
|
+
return {
|
|
78
|
+
getMounted: true,
|
|
79
|
+
detail: `GET /api/staged-upload is mounted (${String(status)})`,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
getMounted: true,
|
|
84
|
+
detail: `GET /api/staged-upload returned ${String(status)}`,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export async function stagedUploadHealthCheck(opts) {
|
|
88
|
+
const hmac = stagedUploadHmacCheck(opts?.envSource ?? process.env);
|
|
89
|
+
if (!hmac.ok) {
|
|
90
|
+
return hmac;
|
|
91
|
+
}
|
|
92
|
+
const origin = opts?.origin?.replace(/\/$/, '');
|
|
93
|
+
if (!origin) {
|
|
94
|
+
return { ok: false, detail: `${hmac.detail}; GET /api/staged-upload not probed (no origin)` };
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
const res = await (opts?.fetchImpl ?? fetch)(`${origin}/api/staged-upload`, {
|
|
98
|
+
method: 'GET',
|
|
99
|
+
redirect: 'manual',
|
|
100
|
+
});
|
|
101
|
+
const probe = interpretStagedUploadGetProbe(res.status);
|
|
102
|
+
if (!probe.getMounted) {
|
|
103
|
+
return { ok: false, detail: `${hmac.detail}; ${probe.detail}` };
|
|
104
|
+
}
|
|
105
|
+
return { ok: true, detail: `${hmac.detail}; ${probe.detail}` };
|
|
106
|
+
}
|
|
107
|
+
catch (err) {
|
|
108
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
109
|
+
return { ok: false, detail: `${hmac.detail}; GET probe failed (${message})` };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
52
112
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/media-pipeline/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,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CAAC;QACH,MAAM,KAAK,GAAG,6BAA6B,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACxD,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;YACtB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QAClE,CAAC;QACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;IACjE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,uBAAuB,OAAO,GAAG,EAAE,CAAC;IAChF,CAAC;AACH,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { type MediaActionContext, type MediaActionResult, type MediaImportOverride, type MediaImportParams, mediaCatalog, mediaImport, mediaPrepare, mediaStatus, mediaWait, } from './actions.js';
|
|
2
2
|
export { MediaPipelineClient, MediaPipelineClientError, type PipelineJobStatusResponse, type PipelineManifestAsset, type PipelinePrepareResponse, } from './client.js';
|
|
3
|
-
export { loadMediaPipelineConfig, type MediaPipelineConfig, mediaPipelineConfiguredMessage, } from './config.js';
|
|
3
|
+
export { interpretStagedUploadGetProbe, loadMediaPipelineConfig, type MediaPipelineConfig, mediaPipelineConfiguredMessage, mediaPipelineHealthCheck, stagedUploadHealthCheck, stagedUploadHmacCheck, } from './config.js';
|
|
4
4
|
export { createMemoryRedis, type MediaJobBinding, MediaJobStoreError, MediaPipelineJobStore, } from './job-store.js';
|
|
5
5
|
export { MEDIA_DEFAULT_TTL_HOURS, MEDIA_JOB_BINDING_TTL_SECONDS, MEDIA_MAX_CONCURRENT_JOBS_PER_USER, MEDIA_PREPARE_RATE_LIMIT_PER_HOUR, } from './limits.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/media-pipeline/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,WAAW,EACX,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,GAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,uBAAuB,EACvB,KAAK,mBAAmB,EACxB,8BAA8B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/media-pipeline/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,WAAW,EACX,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,GAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,EACvB,KAAK,mBAAmB,EACxB,8BAA8B,EAC9B,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,iBAAiB,EACjB,KAAK,eAAe,EACpB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC7B,kCAAkC,EAClC,iCAAiC,GAClC,MAAM,aAAa,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { mediaCatalog, mediaImport, mediaPrepare, mediaStatus, mediaWait, } from './actions.js';
|
|
2
2
|
export { MediaPipelineClient, MediaPipelineClientError, } from './client.js';
|
|
3
|
-
export { loadMediaPipelineConfig, mediaPipelineConfiguredMessage, } from './config.js';
|
|
3
|
+
export { interpretStagedUploadGetProbe, loadMediaPipelineConfig, mediaPipelineConfiguredMessage, mediaPipelineHealthCheck, stagedUploadHealthCheck, stagedUploadHmacCheck, } from './config.js';
|
|
4
4
|
export { createMemoryRedis, MediaJobStoreError, MediaPipelineJobStore, } from './job-store.js';
|
|
5
5
|
export { MEDIA_DEFAULT_TTL_HOURS, MEDIA_JOB_BINDING_TTL_SECONDS, MEDIA_MAX_CONCURRENT_JOBS_PER_USER, MEDIA_PREPARE_RATE_LIMIT_PER_HOUR, } from './limits.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/media-pipeline/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,WAAW,EACX,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GAIzB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,uBAAuB,EAEvB,8BAA8B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/media-pipeline/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,WAAW,EACX,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GAIzB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,EAEvB,8BAA8B,EAC9B,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,iBAAiB,EAEjB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC7B,kCAAkC,EAClC,iCAAiC,GAClC,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"census.d.ts","sourceRoot":"","sources":["../../src/patterns/census.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAqB,aAAa,EAAE,MAAM,YAAY,CAAC;AAsInE,wBAAsB,kBAAkB,CAAC,OAAO,EAAE;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,aAAa,CAAC,CAsFzB"}
|