Content
# Avada MCP
Exposes [Avada](https://avada.com/) / Fusion Builder element functionality as
[Model Context Protocol](https://modelcontextprotocol.io/) tools, so an AI agent
can build WordPress pages with the builder.
It is a self-contained WordPress plugin that serves an MCP server over a single
REST endpoint using the **Streamable HTTP** transport (JSON-response variant —
no SSE, no separate Node process).
## How it works
Fusion Builder stores pages as nested shortcodes in `post_content`, and every
element self-describes via `fusion_builder_map()` (124 elements / ~3,000 params on
a stock Avada install). This plugin reads that live element registry and turns it
into MCP tool schemas, then writes pages back as shortcodes.
```
AI agent ──Streamable HTTP (JSON-RPC 2.0)──▶ POST /wp-json/avada-mcp/v1/rpc
├─ tools/list ← Fusion element registry
└─ tools/call → post_content (shortcodes)
```
## Requirements
- WordPress 6.0+
- PHP 7.4+
- Avada theme with Fusion Builder + Fusion Core active
## Install
```bash
composer install # generates the PSR-4 autoloader
```
Then activate the plugin in WordPress (or `wp plugin activate avada-mcp`).
## Authentication
On activation an auth token is generated and stored in the `avada_mcp_token`
option. Retrieve it with:
```bash
wp option get avada_mcp_token
```
Or pin your own in `wp-config.php`:
```php
define( 'AVADA_MCP_TOKEN', 'your-long-random-token' );
```
Send it as a bearer token:
```
Authorization: Bearer <token>
```
A logged-in administrator (`manage_options`) is also accepted, which is handy for
local testing.
## MCP client config
```json
{
"mcpServers": {
"avada": {
"type": "http",
"url": "http://localhost:8080/wp-json/avada-mcp/v1/rpc",
"headers": { "Authorization": "Bearer <token>" }
}
}
}
```
## Tools
| Tool | Purpose |
|------|---------|
| `list_elements` | List available elements (name, label, description, param count). |
| `get_element_schema` | Full parameter schema for one element (types, defaults, options). |
| `create_page` | Create a page from a JSON element tree, serialised to shortcodes. |
| `update_page` | Update an existing page's title, status and/or content (replace or append). |
| `list_pages` | List pages (id, title, status, builder flag, URLs) to discover ids. |
| `get_page` | Read a page and return its content parsed back into the JSON element tree. |
| `add_media` | Upload a file to the media library from a URL or server path; returns attachment id + URL. |
| `list_media` | List media library items (id, title, URL, mime, date) with search/type filters. |
> **Layout tip:** Avada containers are flex layouts, so each `fusion_builder_row`
> becomes a flex *item*. Put **one** `fusion_builder_row` per container holding all
> of that section's columns — multiple rows in one container render side-by-side
> rather than stacked.
### `create_page` / `update_page` tree shape
```jsonc
{
"title": "My landing page",
"status": "publish",
"tree": [
{
"element": "fusion_builder_container",
"params": { "background_color": "#0e1116" },
"children": [
{
"element": "fusion_builder_row",
"children": [
{
"element": "fusion_builder_column",
"params": { "type": "1_1" },
"children": [
{ "element": "fusion_title", "content": "Hello world" },
{ "element": "fusion_button", "params": { "link": "/contact" }, "content": "Get in touch" }
]
}
]
}
]
}
]
}
```
## License
MIT