PluginProbe
Elementor Website Builder – more than just a page builder / trunk
Elementor Website Builder – more than just a page builder vtrunk
4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 All 456 releases
elementor / assets / js / packages / elementor-capabilities-mcp / elementor-capabilities-mcp.min.js

elementor-capabilities-mcp.min.js in Elementor Website Builder – more than just a page builder trunk, at assets/js/packages/elementor-capabilities-mcp/elementor-capabilities-mcp.min.js

107 lines 11.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function(){var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,__commonJSMin=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),__copyProps=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},__toESM=(n,r,a)=>(a=n==null?{}:e(i(n)),__copyProps(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),o=__toESM(__commonJSMin(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},__copyProps=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},__toCommonJS=e=>__copyProps(n({},`__esModule`,{value:!0}),e),o={};__export(o,{init:()=>init}),t.exports=__toCommonJS(o);var s=globalThis.elementorV2.editorMcp,c=globalThis.elementorV2.editorMcp,l=globalThis.elementorV2.elementorMcpCommon,u=globalThis.elementorV2.schema,d=globalThis.elementorV2.elementorMcpCommon,f=`wp://pages/list`;function addPagesListResource(e){e.registerResource(`wp-pages-list`,f,{title:`List of wordpress pages`,description:`List of all WordPress pages with their IDs, titles, status, and metadata. Use this to get available pages before navigation or editing.`},async e=>{try{let t=(await(0,d.callWpApi)(`/wp/v2/pages?per_page=100&orderby=modified&order=desc`,`GET`)).data;if(!Array.isArray(t))throw Error(`Invalid response format from wordpress pages API`);let n=t.map(e=>({id:e.id,title:e.title.rendered,status:e.status,link:e.link,modified:e.modified,type:e.type}));return{contents:[{uri:e.href,mimeType:`application/json`,text:JSON.stringify({pages:n,total:n.length,message:`List of all available wordpress pages`},null,2)}]}}catch(e){throw Error(`Failed to fetch pages list: ${e.message}`)}})}var p=`elementor://capabilities/server-description`,m=`## Elementor Page Builder - Available When In Editor
2
3 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.
4
5 ### Available Resources:
6 **Pages List Resource** (\`${f}\`):
7 - Lists all WordPress pages with IDs, titles, status, and metadata
8 - Use this to see what pages are available before navigation
9 - Updated automatically when pages are created or modified
10 - Useful for suggesting pages to edit or checking if a page exists
11
12 ### Elementor Capabilities (Available In Editor):
13
14 **Page Management:**
15 - Manage page settings, saving and routing pages
16 - Control the editor UI, including switching between desktop, tablet, and mobile views
17
18 **Global Styles:**
19 - Work with global styles, helping manage shared design settings like colors and fonts across the site
20
21 **Element Management:**
22 - Create, edit, delete, duplicate, and move individual Elementor widgets and containers
23 - Update widget and container settings
24 - Insert text content with AI-powered text generation
25 - Create image widgets and assign images to elements
26
27 **AI-Powered Content Creation:**
28 - Generate and edit text and insert it into the page
29 - Generate images and place them on the canvas
30
31 **Custom Styling & Code:**
32 - Apply custom CSS to elements
33 - Generate supported code snippets
34
35 ### Elementor Limitations (What Cannot Be Done):
36
37 **Element Management Limitations:**
38 - Cannot apply motion effects
39 - Cannot create fully designed or polished pages in a single step
40 - Cannot fully resolve responsiveness issues
41 - Layout generation (Copilot) is not currently available
42
43 **Theme Builder:**
44 - Cannot create or manage Theme Builder templates, including headers, footers, single posts, archives, products, loop items, or 404 pages
45 - Cannot set display conditions for templates
46 - Cannot configure popup triggers and advanced rules
47
48 **System Settings:**
49 - Cannot change Elementor system-level settings
50 - Cannot activate or work with Editor V4
51 - Cannot manage form submissions
52 - Cannot add custom fonts or icons
53 - Cannot manage user roles
54 - Cannot roll back Elementor versions
55 - Cannot place the site in maintenance mode
56 - Cannot export the website
57 - Cannot apply full website templates
58
59 **Code & Widgets:**
60 - Cannot register PHP code or create new custom widgets, though Angie may provide guidance, code snippets, or plugin suggestions where helpful
61
62 **Note**: While page names can include terms like "header" or "footer", these won't function as actual theme parts without Theme Builder access.
63
64 ### How to Help Users:
65
66 **When users ask about Elementor features:**
67 1. Confirm what they want to accomplish
68 2. Check if it's a supported capability (see lists above)
69 3. **Get the page to edit:**
70 - If user says "create new page" \u2192 Use createNew=true
71 - Otherwise \u2192 Call tool with no parameters to get page list
72 - Show pages to user: "Which page? Homepage, About, Contact..."
73 - User chooses \u2192 Call tool again with that pageId
74 4. Once in editor, full Elementor MCP tools will be available
75
76 **Examples:**
77 - User: "Edit homepage" \u2192 Get page list \u2192 Find "Homepage" \u2192 Ask to confirm \u2192 Navigate
78 - User: "Create new page" \u2192 createNew=true \u2192 Navigate
79
80 **Examples of when to navigate to editor:**
81 - "Edit my homepage with Elementor"
82 - "Apply custom CSS to my page"
83 - "Generate text content for my page"
84 - "Work with dynamic content"
85
86 **Examples of when to navigate to editor (element management now supported):**
87 - "Add a heading widget" (Navigate to editor - element management supported)
88 - "Create a new section with containers" (Navigate to editor - container creation supported)
89 - "Change the color of a button" (Navigate to editor - widget settings supported)
90
91 **Examples of what Elementor CANNOT do (don't navigate):**
92 - "Add motion effects to my page" (Motion effects not supported)
93 - "Create a header template" (Theme Builder not available)
94 - "Set up a popup trigger" (Popup triggers and advanced rules not supported)
95 - "Change Elementor settings" (System-level settings restricted)
96 - "Add custom fonts" (Custom fonts not supported)
97 - "Create a custom widget" (Cannot register PHP code or custom widgets)
98
99 ### Important Notes:
100 - Elementor tools are ONLY available when inside the Elementor editor
101 - This MCP server is for navigation and capability awareness
102 - Once in editor, the full 'elementor' MCP server with all tools becomes available
103 - Always verify if the requested feature is supported before navigating
104
105 **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.`;function addCapabilitiesDescriptionResource(e){e.registerResource(`elementor-capabilities-server-description`,p,{title:`Elementor capabilities and limitations`,description:`Full guide to Elementor MCP capabilities, limitations, workflows, and when to navigate to the editor.`},async e=>({contents:[{uri:e.href,mimeType:`text/plain`,text:m}]}))}var h=`angie/requiredResources`,g=`/wp/v2/pages`,_=`builder`,v=`New Page`,y=`elementor`,getSafeOrigin=()=>{if(typeof window>`u`)return``;let e=new URL(window.location.href);return`${e.protocol}://${e.host}`||``};function safeNavigateAfterResponse(e){try{(0,c.getAngieIframe)().contentWindow.postMessage({type:c.AngieMessageEvenetType.ANGIE_NAVIGATE_AFTER_RESPONSE,payload:{url:e}},getSafeOrigin())}finally{setTimeout(()=>{window.location.replace(e)},50)}}function createElementorCapabilitiesServer(){let e=new l.McpServer({name:`elementor-capabilities-server`,version:`1.0.0`,title:`Elementor Capabilities`},{instructions:`Provides Elementor page-building capabilities and navigates users to the editor.`,capabilities:{resources:{subscribe:!0}}});return addPagesListResource(e),addCapabilitiesDescriptionResource(e),e.registerTool(`navigate-to-elementor-editor`,{description:`Navigate the user to the Elementor editor. Causes a full page reload — editor-related tools become available afterward.
106
107 Workflow: choose from the pages list resource → set pageId (edit) OR createNew=true (new page) with confirmationMessage.`,inputSchema:{pageId:u.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.`),createNew:u.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.`),newPageTitle:u.z.string().optional().describe(`Title for the new page when createNew is true. Use what the user specified or default to "New Page".`),confirmationMessage:u.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.`)},annotations:{title:`Navigate to Elementor Editor`,destructiveHint:!0},_meta:{[h]:[{uri:p,whenToUse:`Read first for full capabilities and limitations guide`},{uri:f,whenToUse:`Always use this resource first to understand what pages are available before asking the user which page to edit`}]}},async e=>{try{if((e.pageId||e.createNew)&&!e.confirmationMessage)throw Error(`confirmationMessage is required when navigating to a page (pageId or createNew provided)`);if(e.createNew)return await handleCreateAndNavigate(e);if(e.pageId)return await handleNavigateToPage(e.pageId);throw Error(`Either pageId or createNew must be provided. The pages list is available in the wp-pages-list resource.`)}catch(e){throw console.error(`[Elementor Capabilities Server] navigation error:`,e),Error(`Error navigating to Elementor editor: ${e.message}`)}}),e}async function handleCreateAndNavigate(e){let t=e.newPageTitle||v,n=(await(0,l.callWpApi)(g,`POST`,{title:t,status:`draft`,meta:{_elementor_edit_mode:_}})).data;if(!n||typeof n!=`object`||!(`id`in n))throw Error(`Invalid response from page creation API`);return await handleNavigateToPage(n.id)}async function handleNavigateToPage(e){if(!e||e<=0)throw Error(`Invalid page ID`);let t=(await(0,l.callWpApi)(`${g}/${e}`,`GET`)).data;if(!t||typeof t!=`object`||!(`id`in t)||!(`title`in t))throw Error(`Invalid page data received for page ID ${e}`);let n=generateElementorEditUrl(e);if(!n.startsWith(window.location.origin))throw Error(`Invalid navigation URL`);return safeNavigateAfterResponse(n),{content:[{type:`text`,text:JSON.stringify({success:!0,message:`Navigating to Elementor editor for page: ${t.title.rendered}`,pageId:t.id,pageTitle:t.title.rendered,editUrl:n,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.`},null,2)}]}}function generateElementorEditUrl(e){return`${window.location.origin}/wp-admin/post.php?post=${e}&action=${y}`}function init(){let e=(0,s.getAngieSdk)();e.waitForReady().then(()=>{let t=createElementorCapabilitiesServer();e.registerServer({name:`elementor-capabilities`,version:`2.0.0`,description:`Elementor Capabilities Gateway`,server:t,capabilities:{tools:{}}}),console.log(`[Elementor Capabilities MCP] Module initialized`)})}0&&(t.exports={init})}))());(window.elementorV2=window.elementorV2||{}).elementorCapabilitiesMcp=o})(),window.elementorV2.elementorCapabilitiesMcp?.init?.();