dragble-react-editor 1.0.8 → 1.0.10

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.
Files changed (2) hide show
  1. package/README.md +18 -22
  2. package/package.json +8 -3
package/README.md CHANGED
@@ -206,21 +206,20 @@ export default AdvancedEmailBuilder;
206
206
 
207
207
  ## MCP — AI Integration
208
208
 
209
- Connect AI agents (Claude Code, OpenCode, Codex, Cursor, or your own backend) to the editor through the Model Context Protocol. The AI calls structured tools `add_row`, `add_heading`, `update_button`, `export_html` that mutate design state live on the canvas.
209
+ Connect AI agents (Claude Code, OpenCode, Codex, Cursor, or your own backend) to the editor through the Model Context Protocol. Your backend uses `mcp_key`; third-party AI clients use `mcp_client_key` plus a pairing code. Tool calls mutate design state live on the canvas.
210
210
 
211
211
  ### Enabling MCP
212
212
 
213
- MCP is off by default. Set `features: { mcp: true }` to opt in:
213
+ MCP is on by default when your plan includes it. You can still set `features: { mcp: true }` explicitly, or set `features: { mcp: false }` to turn it off for an embed:
214
214
 
215
215
  ```tsx
216
216
  <DragbleEditor
217
217
  ref={editorRef}
218
218
  editorKey="db_pxl81cxn92wignwx"
219
- options={{ features: { mcp: true } }}
220
219
  />
221
220
  ```
222
221
 
223
- MCP also requires a **Starter plan or higher**. Both conditions must be true — plan allows it AND SDK enables it.
222
+ MCP also requires a **Starter plan or higher**. Both conditions must be true — plan allows it AND SDK has not opted out.
224
223
 
225
224
  ### Quick example — your backend controls the AI
226
225
 
@@ -243,8 +242,8 @@ function App() {
243
242
  const userIdFromAuth = "alice123"; // from your auth/session
244
243
  const docIdFromRoute = "campaign-summer"; // from your URL or DB row
245
244
  const id = `${userIdFromAuth}-${docIdFromRoute}`;
246
- const { sessionId } = await editorRef.current!.editor!.connectMCP({ id });
247
- // Pass sessionId to your backend — it calls MCP tools with your mcp_key
245
+ const { sessionId } = await editorRef.current!.editor!.joinMCP({ id });
246
+ // Pass sessionId to your backend — it calls MCP tools with your backend mcp_key
248
247
  };
249
248
 
250
249
  return (
@@ -253,7 +252,6 @@ function App() {
253
252
  <DragbleEditor
254
253
  ref={editorRef}
255
254
  editorKey="db_pxl81cxn92wignwx"
256
- options={{ features: { mcp: true } }}
257
255
  />
258
256
  </div>
259
257
  );
@@ -268,10 +266,7 @@ const handleLetUserPair = async () => {
268
266
  // Same id you'd use anywhere else for this user+document combination.
269
267
  // 8-128 chars, only letters/digits/hyphens/underscores.
270
268
  const id = "alice123-campaign-summer-2026";
271
- await editor.connectMCP({ id });
272
-
273
- // Explicitly generate a pairing code (not auto-generated)
274
- const { code, expiresAt } = await editor.getPairingCode();
269
+ const { code, expiresAt } = await editor.startMCPPairing({ id });
275
270
  alert(`Paste this into Claude Code: ${code}`);
276
271
  };
277
272
  ```
@@ -287,15 +282,15 @@ This prevents two AI controllers from conflicting on the same design.
287
282
 
288
283
  ### How it works
289
284
 
290
- 1. **Enable MCP** in the SDK config: `features: { mcp: true }`.
291
- 2. **Generate an MCP key** in the Dragble dashboard: Project MCP Key → Generate. Store it in your backend env vars never in browser code.
292
- 3. **Call `editor.connectMCP({ id })`** where `id` is a stable identifier you control (see below).
293
- 4. **Choose your AI path**: either your backend calls MCP tools directly (using the mcp_key), or you generate a pairing code for the end-user to connect their own AI client.
285
+ 1. **Confirm MCP is enabled**: it is on by default; set `features: { mcp: false }` only when you want to opt out.
286
+ 2. **Generate MCP keys** in the Dragble dashboard: use backend `mcp_key` for your server, and `mcp_client_key` for Claude/OpenCode/Cursor/Codex-style clients.
287
+ 3. **Call `editor.joinMCP({ id })`** where `id` is a stable identifier you control (see below).
288
+ 4. **Choose your AI path**: either your backend calls MCP tools directly (using `mcp_key`), or you generate a pairing code for the end-user to connect their own AI client (using `mcp_client_key`).
294
289
  5. **Mutations stream live** onto the editor canvas as the AI works.
295
290
 
296
291
  ### The `id` parameter — why it matters
297
292
 
298
- The `id` you pass to `connectMCP()` is a **Bring Your Own ID (BYOI)** that maps to your domain entities. It is NOT a random token — it is how Dragble identifies the session across browser refreshes, server restarts, and device switches.
293
+ The `id` you pass to `joinMCP()` is a **Bring Your Own ID (BYOI)** that maps to your domain entities. It is NOT a random token — it is how Dragble identifies the session across browser refreshes, server restarts, and device switches.
299
294
 
300
295
  **Rules:**
301
296
 
@@ -311,14 +306,14 @@ The `id` you pass to `connectMCP()` is a **Bring Your Own ID (BYOI)** that maps
311
306
 
312
307
  ```tsx
313
308
  // Recommended: derive from your domain — concrete examples
314
- editor.connectMCP({ id: "alice123-campaign-summer-2026" }); // user + doc
315
- editor.connectMCP({ id: "workspace_acme_template_welcome" }); // workspace + template
316
- editor.connectMCP({ id: "org-uber-eats-promo-q4-2026" }); // org + campaign
317
- editor.connectMCP({ id: "tenant_42_invoice_template_v3" }); // tenant + entity
309
+ editor.joinMCP({ id: "alice123-campaign-summer-2026" }); // user + doc
310
+ editor.joinMCP({ id: "workspace_acme_template_welcome" }); // workspace + template
311
+ editor.joinMCP({ id: "org-uber-eats-promo-q4-2026" }); // org + campaign
312
+ editor.joinMCP({ id: "tenant_42_invoice_template_v3" }); // tenant + entity
318
313
 
319
314
  // Valid but NOT recommended — random IDs break session continuity
320
315
  // (every page refresh creates a brand new session, AI loses context)
321
- editor.connectMCP({ id: crypto.randomUUID() });
316
+ editor.joinMCP({ id: crypto.randomUUID() });
322
317
  ```
323
318
 
324
319
  ### Disconnecting
@@ -342,7 +337,8 @@ Idle sessions are reaped after 2 hours of inactivity. Active sessions never expi
342
337
 
343
338
  | Method | Returns |
344
339
  | -------------------------------------------------- | ----------------------------------------------------------------------- |
345
- | `editor.connectMCP({ id, editorMode? })` | `{ sessionId, resumed? }` |
340
+ | `editor.joinMCP({ id, editorMode? })` | `{ sessionId, resumed? }` for backend-managed flows |
341
+ | `editor.startMCPPairing({ id, editorMode? })` | `{ sessionId, resumed?, code, expiresAt }` for client pairing |
346
342
  | `editor.disconnectMCP()` | `{ destroyed }` — permanently deletes session |
347
343
  | `editor.getPairingCode()` | `{ code, expiresAt }` — generate a pairing code for end-user AI clients |
348
344
  | `editor.endPairing()` | `{ revoked }` — invalidate the active pairing code |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dragble-react-editor",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "AI-powered React email editor component. Drag-and-drop email builder for creating responsive email templates and newsletters. Build HTML emails visually with Dragble.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -35,6 +35,8 @@
35
35
  "ai-email-builder",
36
36
  "dragble",
37
37
  "email",
38
+ "ai email builder",
39
+ "ai email editor",
38
40
  "email-editor",
39
41
  "email-builder",
40
42
  "email-template",
@@ -78,8 +80,11 @@
78
80
  "embed",
79
81
  "embeddable",
80
82
  "sdk",
83
+ "mcp",
81
84
  "content-builder",
82
- "email-automation"
85
+ "email-automation",
86
+ "ai-email-builder",
87
+ "mcp-email-builder"
83
88
  ],
84
89
  "author": "Dragble",
85
90
  "license": "MIT",
@@ -95,7 +100,7 @@
95
100
  },
96
101
  "homepage": "https://docs.dragble.com",
97
102
  "dependencies": {
98
- "dragble-types": "latest"
103
+ "dragble-types": "^1.0.9"
99
104
  },
100
105
  "peerDependencies": {
101
106
  "react": ">=17.0.0",