strapi-plugin-mcp-chat 0.7.0 → 0.7.1
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/README.md +32 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ https://github.com/raulbalestra/strapi-plugin-mcp-chat
|
|
|
23
23
|
- 🎙️ **Voice** — record a request (Whisper STT) and hear replies (OpenAI TTS).
|
|
24
24
|
- 👁️ **Side-by-side preview panel** — the plugin's own docked iframe that shrinks the admin and shows your frontend; reloads after each edit and **stays on the same page + scroll position** (with the optional preview bridge below). This is a custom panel, *not* Strapi's official Live Preview (which is a Growth/Enterprise feature) — it works on any plan, including Community, and complements the official Preview if you have it configured.
|
|
25
25
|
- 🖥️ **Optional browser control** — if a [Playwright MCP](https://github.com/microsoft/playwright-mcp) server is reachable, the agent can drive a real browser to verify changes.
|
|
26
|
-
- 🧱 **Frontend provisioning** — upload your frontend (Next.js or TanStack Start) with a `strapi.manifest.json`; the plugin validates it, creates all content-types, seeds content and wires the preview. Never runs code from the upload — it acts only on the validated manifest.
|
|
26
|
+
- 🧱 **Frontend provisioning** — upload your frontend (Next.js or TanStack Start) with a `strapi.manifest.json`; the plugin validates it, creates all content-types, seeds content and wires the preview. The manifest can also be **inferred from the code** (incl. data arrays hardcoded inside components → collection types), and provisioning then **auto-connects the frontend to Strapi via live REST fetch** (generates a data layer + rewires components, with a hardcoded fallback). Never runs code from the upload — it acts only on the validated manifest.
|
|
27
27
|
- 🌍 **Translate every page to any language** — create locales and translate all localized content via Strapi 5's native i18n, with **no length limits and no context blowups** (see below).
|
|
28
28
|
- 🌐 **Fully bilingual (PT / EN)** — both the AI prompts/voice *and* the plugin's own admin pages, switchable with one click (the choice is shared across the chat and the menu pages).
|
|
29
29
|
- 🎓 **Built-in onboarding tour** — a first-run mini-course (re-openable any time via **❓ Tour**) walks new users through chat, editing, live preview, provisioning and translation.
|
|
@@ -213,7 +213,8 @@ respects that:
|
|
|
213
213
|
**Draft preview contract (for custom / non-provisioned frontends):** when the iframe URL
|
|
214
214
|
carries `?preview=1` (or `?status=draft`), fetch Strapi with `status: 'draft'` and an API
|
|
215
215
|
token that can read drafts (`STRAPI_API_TOKEN`). Provisioned frontends get this wired
|
|
216
|
-
automatically via the generated `strapi
|
|
216
|
+
automatically via the generated data layer (`src/lib/strapi.ts` + `src/hooks/useStrapi.ts`),
|
|
217
|
+
which reads the `?preview=1`/`?status=draft` flag from the URL. Note: draft fetching keys off
|
|
217
218
|
the URL on the **client**, so with SSR the first server render may show published content
|
|
218
219
|
until hydration — fine for preview, but don't rely on it for production rendering.
|
|
219
220
|
|
|
@@ -256,14 +257,41 @@ reads and validates the manifest (Zod) and, from it, provisions the backend:
|
|
|
256
257
|
```
|
|
257
258
|
upload → validate manifest → extract to ../<frontend>
|
|
258
259
|
→ generate src/api/**/schema.json (additive) → Strapi restarts
|
|
259
|
-
→ seed content (Document Service) →
|
|
260
|
+
→ seed content (Document Service) → grant public read
|
|
261
|
+
→ wire .env + types + preview (admin.ts + CSP + CLIENT_URL)
|
|
262
|
+
→ wire frontend to Strapi (live REST fetch)
|
|
260
263
|
```
|
|
261
264
|
|
|
262
265
|
Safety rails: schema generation runs **only in `develop`** (a Content-Type
|
|
263
266
|
Builder limitation); generation is **additive** (never drops/alters an existing
|
|
264
267
|
type); the frontend always lands in a **sibling folder**, never inside Strapi's
|
|
265
268
|
`src/`. Ready-to-use starters live in [`starters/`](./starters). The manifest can
|
|
266
|
-
also be **inferred from the frontend code** (e.g. Figma/Lovable exports)
|
|
269
|
+
also be **inferred from the frontend code** (e.g. Figma/Lovable exports) — including
|
|
270
|
+
data arrays hardcoded inside components, which are modeled as collection types (a
|
|
271
|
+
deterministic guard drops any value that isn't found verbatim in the source, so the
|
|
272
|
+
AI can only transcribe, never invent).
|
|
273
|
+
|
|
274
|
+
### Live-fetch wiring (the frontend becomes "live")
|
|
275
|
+
|
|
276
|
+
The last step connects the frontend to Strapi by **live REST fetch** (not a
|
|
277
|
+
snapshot), so editing in Strapi reflects in the page:
|
|
278
|
+
|
|
279
|
+
- Generates a tiny, dependency-free **data layer** in the frontend —
|
|
280
|
+
`src/lib/strapi.ts` (REST helpers, flat — no `populate`/nesting, light calls) and
|
|
281
|
+
`src/hooks/useStrapi.ts` (`useSection` / `useCollection`, preview/draft aware).
|
|
282
|
+
- **Rewires the components** to read from Strapi with a **hardcoded fallback**
|
|
283
|
+
(`{c.field ?? "original text"}`), leaving icons/assets/layout untouched.
|
|
284
|
+
- **Safe by construction:** every rewritten file is syntax-validated (esbuild, with one
|
|
285
|
+
retry) and backed up as `.bak`; on any doubt the file is left as-is, so the frontend
|
|
286
|
+
never fails to compile because of the plugin. It **only writes inside the frontend
|
|
287
|
+
folder — never touches Strapi.**
|
|
288
|
+
- Runs automatically after provisioning, and is also exposed as `POST
|
|
289
|
+
/mcp-chat/frontend/wire`. It's **idempotent** (components already wired are skipped).
|
|
290
|
+
|
|
291
|
+
> **Needs `OPENAI_API_KEY`** for the two AI steps (inferring collections + rewiring
|
|
292
|
+
> components). Without the key, provisioning still creates the text single-types and
|
|
293
|
+
> generates the data layer, but **does not rewire the components** (the frontend stays
|
|
294
|
+
> hardcoded).
|
|
267
295
|
|
|
268
296
|
## Translation (i18n)
|
|
269
297
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strapi-plugin-mcp-chat",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "AI chat inside the Strapi 5 admin that reads and edits your content (incl. components & dynamic zones) via MCP, with voice and a side-by-side live preview.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|