| 1 |
(function(_elementor_editor_mcp, _elementor_elementor_mcp_common, _elementor_schema) { |
| 2 |
|
| 3 |
//#region \0rolldown/runtime.js |
| 4 |
var __defProp = Object.defineProperty; |
| 5 |
var __name = (target, value) => __defProp(target, "name", { |
| 6 |
value, |
| 7 |
configurable: true |
| 8 |
}); |
| 9 |
var __exportAll = (all, no_symbols) => { |
| 10 |
let target = {}; |
| 11 |
for (var name in all) { |
| 12 |
__defProp(target, name, { |
| 13 |
get: all[name], |
| 14 |
enumerable: true |
| 15 |
}); |
| 16 |
} |
| 17 |
if (!no_symbols) { |
| 18 |
__defProp(target, Symbol.toStringTag, { value: "Module" }); |
| 19 |
} |
| 20 |
return target; |
| 21 |
}; |
| 22 |
|
| 23 |
//#endregion |
| 24 |
|
| 25 |
//#region packages/apps/elementor-capabilities-mcp/src/pages-list-resource.ts |
| 26 |
var PAGES_LIST_RESOURCE_URI = "wp://pages/list"; |
| 27 |
function addPagesListResource(server) { |
| 28 |
server.registerResource("wp-pages-list", PAGES_LIST_RESOURCE_URI, { |
| 29 |
title: "List of wordpress pages", |
| 30 |
description: "List of all WordPress pages with their IDs, titles, status, and metadata. Use this to get available pages before navigation or editing." |
| 31 |
}, async (uri) => { |
| 32 |
try { |
| 33 |
const pages = (await (0, _elementor_elementor_mcp_common.callWpApi)("/wp/v2/pages?per_page=100&orderby=modified&order=desc", "GET")).data; |
| 34 |
if (!Array.isArray(pages)) throw new Error("Invalid response format from wordpress pages API"); |
| 35 |
const pagesList = pages.map((page) => ({ |
| 36 |
id: page.id, |
| 37 |
title: page.title.rendered, |
| 38 |
status: page.status, |
| 39 |
link: page.link, |
| 40 |
modified: page.modified, |
| 41 |
type: page.type |
| 42 |
})); |
| 43 |
return { contents: [{ |
| 44 |
uri: uri.href, |
| 45 |
mimeType: "application/json", |
| 46 |
text: JSON.stringify({ |
| 47 |
pages: pagesList, |
| 48 |
total: pagesList.length, |
| 49 |
message: "List of all available wordpress pages" |
| 50 |
}, null, 2) |
| 51 |
}] }; |
| 52 |
} catch (error) { |
| 53 |
throw new Error(`Failed to fetch pages list: ${error.message}`); |
| 54 |
} |
| 55 |
}); |
| 56 |
} |
| 57 |
|
| 58 |
//#endregion |
| 59 |
//#region packages/apps/elementor-capabilities-mcp/src/mcp-description-resource.ts |
| 60 |
var CAPABILITIES_DESCRIPTION_URI = "elementor://capabilities/server-description"; |
| 61 |
var CAPABILITIES_DESCRIPTION = `## Elementor Page Builder - Available When In Editor |
| 62 |
|
| 63 |
This MCP provides information about Elementor's page building capabilities. When users ask about Elementor features, you should navigate them to the Elementor editor where full capabilities are available. |
| 64 |
|
| 65 |
### Available Resources: |
| 66 |
**Pages List Resource** (\`${PAGES_LIST_RESOURCE_URI}\`): |
| 67 |
- Lists all WordPress pages with IDs, titles, status, and metadata |
| 68 |
- Use this to see what pages are available before navigation |
| 69 |
- Updated automatically when pages are created or modified |
| 70 |
- Useful for suggesting pages to edit or checking if a page exists |
| 71 |
|
| 72 |
### Elementor Capabilities (Available In Editor): |
| 73 |
|
| 74 |
**Page Management:** |
| 75 |
- Manage page settings, saving and routing pages |
| 76 |
- Control the editor UI, including switching between desktop, tablet, and mobile views |
| 77 |
|
| 78 |
**Global Styles:** |
| 79 |
- Work with global styles, helping manage shared design settings like colors and fonts across the site |
| 80 |
|
| 81 |
**Element Management:** |
| 82 |
- Create, edit, delete, duplicate, and move individual Elementor widgets and containers |
| 83 |
- Update widget and container settings |
| 84 |
- Insert text content with AI-powered text generation |
| 85 |
- Create image widgets and assign images to elements |
| 86 |
|
| 87 |
**AI-Powered Content Creation:** |
| 88 |
- Generate and edit text and insert it into the page |
| 89 |
- Generate images and place them on the canvas |
| 90 |
|
| 91 |
**Custom Styling & Code:** |
| 92 |
- Apply custom CSS to elements |
| 93 |
- Generate supported code snippets |
| 94 |
|
| 95 |
### Elementor Limitations (What Cannot Be Done): |
| 96 |
|
| 97 |
**Element Management Limitations:** |
| 98 |
- Cannot apply motion effects |
| 99 |
- Cannot create fully designed or polished pages in a single step |
| 100 |
- Cannot fully resolve responsiveness issues |
| 101 |
- Layout generation (Copilot) is not currently available |
| 102 |
|
| 103 |
**Theme Builder:** |
| 104 |
- Cannot create or manage Theme Builder templates, including headers, footers, single posts, archives, products, loop items, or 404 pages |
| 105 |
- Cannot set display conditions for templates |
| 106 |
- Cannot configure popup triggers and advanced rules |
| 107 |
|
| 108 |
**System Settings:** |
| 109 |
- Cannot change Elementor system-level settings |
| 110 |
- Cannot activate or work with Editor V4 |
| 111 |
- Cannot manage form submissions |
| 112 |
- Cannot add custom fonts or icons |
| 113 |
- Cannot manage user roles |
| 114 |
- Cannot roll back Elementor versions |
| 115 |
- Cannot place the site in maintenance mode |
| 116 |
- Cannot export the website |
| 117 |
- Cannot apply full website templates |
| 118 |
|
| 119 |
**Code & Widgets:** |
| 120 |
- Cannot register PHP code or create new custom widgets, though Angie may provide guidance, code snippets, or plugin suggestions where helpful |
| 121 |
|
| 122 |
**Note**: While page names can include terms like "header" or "footer", these won't function as actual theme parts without Theme Builder access. |
| 123 |
|
| 124 |
### How to Help Users: |
| 125 |
|
| 126 |
**When users ask about Elementor features:** |
| 127 |
1. Confirm what they want to accomplish |
| 128 |
2. Check if it's a supported capability (see lists above) |
| 129 |
3. **Get the page to edit:** |
| 130 |
- If user says "create new page" \u2192 Use createNew=true |
| 131 |
- Otherwise \u2192 Call tool with no parameters to get page list |
| 132 |
- Show pages to user: "Which page? Homepage, About, Contact..." |
| 133 |
- User chooses \u2192 Call tool again with that pageId |
| 134 |
4. Once in editor, full Elementor MCP tools will be available |
| 135 |
|
| 136 |
**Examples:** |
| 137 |
- User: "Edit homepage" \u2192 Get page list \u2192 Find "Homepage" \u2192 Ask to confirm \u2192 Navigate |
| 138 |
- User: "Create new page" \u2192 createNew=true \u2192 Navigate |
| 139 |
|
| 140 |
**Examples of when to navigate to editor:** |
| 141 |
- "Edit my homepage with Elementor" |
| 142 |
- "Apply custom CSS to my page" |
| 143 |
- "Generate text content for my page" |
| 144 |
- "Work with dynamic content" |
| 145 |
|
| 146 |
**Examples of when to navigate to editor (element management now supported):** |
| 147 |
- "Add a heading widget" (Navigate to editor - element management supported) |
| 148 |
- "Create a new section with containers" (Navigate to editor - container creation supported) |
| 149 |
- "Change the color of a button" (Navigate to editor - widget settings supported) |
| 150 |
|
| 151 |
**Examples of what Elementor CANNOT do (don't navigate):** |
| 152 |
- "Add motion effects to my page" (Motion effects not supported) |
| 153 |
- "Create a header template" (Theme Builder not available) |
| 154 |
- "Set up a popup trigger" (Popup triggers and advanced rules not supported) |
| 155 |
- "Change Elementor settings" (System-level settings restricted) |
| 156 |
- "Add custom fonts" (Custom fonts not supported) |
| 157 |
- "Create a custom widget" (Cannot register PHP code or custom widgets) |
| 158 |
|
| 159 |
### Important Notes: |
| 160 |
- Elementor tools are ONLY available when inside the Elementor editor |
| 161 |
- This MCP server is for navigation and capability awareness |
| 162 |
- Once in editor, the full 'elementor' MCP server with all tools becomes available |
| 163 |
- Always verify if the requested feature is supported before navigating |
| 164 |
|
| 165 |
**Important**: When users ask "What can Angie do?" or similar questions about Angie's general capabilities, use the \`what-can-angie-do\` tool from the knowledge MCP server instead of generating your own response.`; |
| 166 |
function addCapabilitiesDescriptionResource(server) { |
| 167 |
server.registerResource("elementor-capabilities-server-description", CAPABILITIES_DESCRIPTION_URI, { |
| 168 |
title: "Elementor capabilities and limitations", |
| 169 |
description: "Full guide to Elementor MCP capabilities, limitations, workflows, and when to navigate to the editor." |
| 170 |
}, async (uri) => ({ contents: [{ |
| 171 |
uri: uri.href, |
| 172 |
mimeType: "text/plain", |
| 173 |
text: CAPABILITIES_DESCRIPTION |
| 174 |
}] })); |
| 175 |
} |
| 176 |
|
| 177 |
//#endregion |
| 178 |
//#region packages/apps/elementor-capabilities-mcp/src/elementor-capabilities-mcp-server.ts |
| 179 |
var ANGIE_REQUIRED_RESOURCES = "angie/requiredResources"; |
| 180 |
var WP_PAGES_ENDPOINT = "/wp/v2/pages"; |
| 181 |
var ELEMENTOR_EDIT_MODE = "builder"; |
| 182 |
var DEFAULT_PAGE_TITLE = "New Page"; |
| 183 |
var ELEMENTOR_EDIT_ACTION = "elementor"; |
| 184 |
var getSafeOrigin = () => { |
| 185 |
if (typeof window === "undefined") return ""; |
| 186 |
const url = new URL(window.location.href); |
| 187 |
return `${url.protocol}://${url.host}` || ""; |
| 188 |
}; |
| 189 |
function safeNavigateAfterResponse(url) { |
| 190 |
try { |
| 191 |
(0, _elementor_editor_mcp.getAngieIframe)().contentWindow.postMessage({ |
| 192 |
type: _elementor_editor_mcp.AngieMessageEvenetType.ANGIE_NAVIGATE_AFTER_RESPONSE, |
| 193 |
payload: { url } |
| 194 |
}, getSafeOrigin()); |
| 195 |
} finally { |
| 196 |
setTimeout(() => { |
| 197 |
window.location.replace(url); |
| 198 |
}, 50); |
| 199 |
} |
| 200 |
} |
| 201 |
function createElementorCapabilitiesServer() { |
| 202 |
const server = new _elementor_elementor_mcp_common.McpServer({ |
| 203 |
name: "elementor-capabilities-server", |
| 204 |
version: "1.0.0", |
| 205 |
title: "Elementor Capabilities" |
| 206 |
}, { |
| 207 |
instructions: `Provides Elementor page-building capabilities and navigates users to the editor.`, |
| 208 |
capabilities: { resources: { subscribe: true } } |
| 209 |
}); |
| 210 |
addPagesListResource(server); |
| 211 |
addCapabilitiesDescriptionResource(server); |
| 212 |
server.registerTool("navigate-to-elementor-editor", { |
| 213 |
description: `Navigate the user to the Elementor editor. Causes a full page reload \u2014 editor-related tools become available afterward. |
| 214 |
|
| 215 |
Workflow: choose from the pages list resource \u2192 set pageId (edit) OR createNew=true (new page) with confirmationMessage.`, |
| 216 |
inputSchema: { |
| 217 |
pageId: _elementor_schema.z.number().optional().describe("The ID of the page to navigate to. Only provide after user has explicitly selected a page from the available pages list. When provided, confirmationMessage is REQUIRED."), |
| 218 |
createNew: _elementor_schema.z.boolean().optional().describe("Set to true ONLY when user explicitly requests to create a new page. When true, confirmationMessage is REQUIRED. Default is false."), |
| 219 |
newPageTitle: _elementor_schema.z.string().optional().describe("Title for the new page when createNew is true. Use what the user specified or default to \"New Page\"."), |
| 220 |
confirmationMessage: _elementor_schema.z.string().optional().describe(`REQUIRED when pageId or createNew is provided. A clear message shown to user before navigation. Example: "I'll open the 'Homepage' in Elementor editor so you can add a form widget. Ready to proceed?" Omit when just fetching available pages.`) |
| 221 |
}, |
| 222 |
annotations: { |
| 223 |
title: "Navigate to Elementor Editor", |
| 224 |
destructiveHint: true |
| 225 |
}, |
| 226 |
_meta: { [ANGIE_REQUIRED_RESOURCES]: [{ |
| 227 |
uri: CAPABILITIES_DESCRIPTION_URI, |
| 228 |
whenToUse: "Read first for full capabilities and limitations guide" |
| 229 |
}, { |
| 230 |
uri: PAGES_LIST_RESOURCE_URI, |
| 231 |
whenToUse: "Always use this resource first to understand what pages are available before asking the user which page to edit" |
| 232 |
}] } |
| 233 |
}, async (params) => { |
| 234 |
try { |
| 235 |
if ((params.pageId || params.createNew) && !params.confirmationMessage) throw new Error("confirmationMessage is required when navigating to a page (pageId or createNew provided)"); |
| 236 |
if (params.createNew) return await handleCreateAndNavigate(params); |
| 237 |
if (params.pageId) return await handleNavigateToPage(params.pageId); |
| 238 |
throw new Error("Either pageId or createNew must be provided. The pages list is available in the wp-pages-list resource."); |
| 239 |
} catch (error) { |
| 240 |
console.error("[Elementor Capabilities Server] navigation error:", error); |
| 241 |
throw new Error(`Error navigating to Elementor editor: ${error.message}`); |
| 242 |
} |
| 243 |
}); |
| 244 |
return server; |
| 245 |
} |
| 246 |
async function handleCreateAndNavigate(params) { |
| 247 |
const title = params.newPageTitle || DEFAULT_PAGE_TITLE; |
| 248 |
const newPage = (await (0, _elementor_elementor_mcp_common.callWpApi)(WP_PAGES_ENDPOINT, "POST", { |
| 249 |
title, |
| 250 |
status: "draft", |
| 251 |
meta: { _elementor_edit_mode: ELEMENTOR_EDIT_MODE } |
| 252 |
})).data; |
| 253 |
if (!newPage || typeof newPage !== "object" || !("id" in newPage)) throw new Error("Invalid response from page creation API"); |
| 254 |
return await handleNavigateToPage(newPage.id); |
| 255 |
} |
| 256 |
async function handleNavigateToPage(pageId) { |
| 257 |
if (!pageId || pageId <= 0) throw new Error("Invalid page ID"); |
| 258 |
const page = (await (0, _elementor_elementor_mcp_common.callWpApi)(`${WP_PAGES_ENDPOINT}/${pageId}`, "GET")).data; |
| 259 |
if (!page || typeof page !== "object" || !("id" in page) || !("title" in page)) throw new Error(`Invalid page data received for page ID ${pageId}`); |
| 260 |
const editUrl = generateElementorEditUrl(pageId); |
| 261 |
if (!editUrl.startsWith(window.location.origin)) throw new Error("Invalid navigation URL"); |
| 262 |
safeNavigateAfterResponse(editUrl); |
| 263 |
return { content: [{ |
| 264 |
type: "text", |
| 265 |
text: JSON.stringify({ |
| 266 |
success: true, |
| 267 |
message: `Navigating to Elementor editor for page: ${page.title.rendered}`, |
| 268 |
pageId: page.id, |
| 269 |
pageTitle: page.title.rendered, |
| 270 |
editUrl, |
| 271 |
nextSteps: "Once in the Elementor editor, you can use Elementor MCP tools for page settings, UI navigation, AI content generation, custom styling, and dynamic content." |
| 272 |
}, null, 2) |
| 273 |
}] }; |
| 274 |
} |
| 275 |
function generateElementorEditUrl(pageId) { |
| 276 |
return `${window.location.origin}/wp-admin/post.php?post=${pageId}&action=${ELEMENTOR_EDIT_ACTION}`; |
| 277 |
} |
| 278 |
|
| 279 |
//#endregion |
| 280 |
//#region packages/apps/elementor-capabilities-mcp/src/index.ts |
| 281 |
var src_exports = /* @__PURE__ */ __exportAll({ init: () => init }); |
| 282 |
function init() { |
| 283 |
const sdk = (0, _elementor_editor_mcp.getAngieSdk)(); |
| 284 |
sdk.waitForReady().then(() => { |
| 285 |
const capabilitiesServer = createElementorCapabilitiesServer(); |
| 286 |
sdk.registerServer({ |
| 287 |
name: "elementor-capabilities", |
| 288 |
version: "2.0.0", |
| 289 |
description: "Elementor Capabilities Gateway", |
| 290 |
server: capabilitiesServer, |
| 291 |
capabilities: { tools: {} } |
| 292 |
}); |
| 293 |
console.log("[Elementor Capabilities MCP] Module initialized"); |
| 294 |
}); |
| 295 |
} |
| 296 |
|
| 297 |
//#endregion |
| 298 |
//#region \0elementor-package-library-entry |
| 299 |
(window.elementorV2 = window.elementorV2 || {}).elementorCapabilitiesMcp = src_exports; |
| 300 |
|
| 301 |
//#endregion |
| 302 |
})(elementorV2.editorMcp, elementorV2.elementorMcpCommon, elementorV2.schema); |
| 303 |
window.elementorV2.elementorCapabilitiesMcp?.init?.(); |
| 304 |
//# sourceMappingURL=elementor-capabilities-mcp.js.map |