@yashwant.dharmdas/elementor-mcp 3.11.0 → 3.11.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.
Files changed (2) hide show
  1. package/dist/index.js +10 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1138,6 +1138,11 @@ function createMcpServer(sites) {
1138
1138
  catch {
1139
1139
  return { content: [{ type: "text", text: `Error: File at ${file_path} is not valid JSON.` }], isError: true };
1140
1140
  }
1141
+ // Auto-unwrap Elementor export format: {"content":[...],"version":"0.4",...}
1142
+ // The API endpoint expects a raw elements array, not the export wrapper object.
1143
+ if (!Array.isArray(elementorData) && Array.isArray(elementorData?.content)) {
1144
+ elementorData = elementorData.content;
1145
+ }
1141
1146
  // Push to WordPress
1142
1147
  const r = await axios.put(`${wpUrl}/wp-json/erc/v1/pages/${page_id}/data`, elementorData, { headers: { Authorization: authHeader, "Content-Type": "application/json" } });
1143
1148
  // Clear cache
@@ -1170,6 +1175,11 @@ function createMcpServer(sites) {
1170
1175
  catch {
1171
1176
  return { content: [{ type: "text", text: `Error: File at ${file_path} is not valid JSON.` }], isError: true };
1172
1177
  }
1178
+ // Auto-unwrap Elementor export format: {"content":[...],"version":"0.4",...}
1179
+ // The API endpoint expects a raw elements array, not the export wrapper object.
1180
+ if (!Array.isArray(elementorData) && Array.isArray(elementorData?.content)) {
1181
+ elementorData = elementorData.content;
1182
+ }
1173
1183
  // Step 2: Create the page
1174
1184
  const createBody = {
1175
1185
  title,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yashwant.dharmdas/elementor-mcp",
3
- "version": "3.11.0",
3
+ "version": "3.11.1",
4
4
  "description": "MCP server for controlling Elementor via Claude — supports multiple WordPress sites",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",