PHP Classes

File: docs/MCP_AND_AI_CONCIERGE.md

Recommend this page to a friend!
  Packages of Adrian M   QuickWP   docs/MCP_AND_AI_CONCIERGE.md   Download  
File: docs/MCP_AND_AI_CONCIERGE.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: QuickWP
Manage WordPress sites using the REST API
Author: By
Last change:
Date: 12 hours ago
Size: 4,819 bytes
 

 

Contents

Class file image Download

MCP Server & AI Concierge Guide

QuickWP v3.0 provides two complementary AI-ready layers built on top of the deterministic Core SDK:

  1. Local MCP Server (bin/quickwp-mcp) ? Exposes 11 WordPress tools over `stdio` to AI IDEs and agents (Antigravity, Claude Desktop, Cursor) without putting credentials in prompts.
  2. AI Concierge (AiConciergeService) ? Optional, provider-agnostic (`Gemini`, `OpenAI`, or local `Ollama`) multilingual voice/text draft generator with strict draft-first safety.

Part 1: Local MCP Server (bin/quickwp-mcp)

Setup in Antigravity / Claude Desktop / Cursor

Add the following server entry to your MCP configuration file:

{
  "mcpServers": {
    "quickwp": {
      "command": "php",
      "args": ["/absolute/path/to/QuickWP/bin/quickwp-mcp"],
      "env": {
        "QUICKWP_BASE_DIR": "/absolute/path/to/QuickWP"
      }
    }
  }
}

On Windows:

{
  "mcpServers": {
    "quickwp": {
      "command": "php",
      "args": ["D:/GitHub/QuickWP/bin/quickwp-mcp"],
      "env": {
        "QUICKWP_BASE_DIR": "D:/GitHub/QuickWP"
      }
    }
  }
}

Available MCP Tools (11)

| Tool | Description | Safety | |------|-------------|--------| | quickwp_list_sites | List configured sites (keys, labels, endpoints) | Never returns wp_app_password | | quickwp_health_check | Check REST reachability, auth, user roles & latency | Read-only | | quickwp_list_posts | List posts/pages with status & search filters | Read-only | | quickwp_get_post | Fetch single post/page by ID | Read-only | | quickwp_list_taxonomies | List real categories & tags with IDs | Read-only | | quickwp_create_post | Create post/page (supports markdown ? HTML, meta, acf) | Defaults to status: "draft" | | quickwp_update_post | Update existing post/page by ID | Explicit ID | | quickwp_upload_media | Upload a local file from disk + optional Featured Image | Host disk path | | quickwp_list_comments | List comments by moderation status | Read-only | | quickwp_moderate_comment | approve, unapprove, spam, or delete (trash) | Explicit ID | | quickwp_sync_item | Sync a post/page between two configured sites | Defaults to status: "draft" |

Security Model

  • Credentials stay locally in `quick-config.php` / `quick-sites.php` and are never exposed in `quickwp_list_sites` or prompts.
  • `quickwp_create_post` and `quickwp_sync_item` default to `draft`. Publishing requires explicit `status: "publish"` from the user/agent.

Part 2: Multilingual AI Concierge (Voice & Text, Draft-First)

The AI Concierge is 100% optional and disabled until you configure ai_provider in quick-config.php (or per site in quick-sites.php).

Configuration Examples

Option A: Google Gemini

'ai_provider' => 'gemini',
'ai_api_key'  => 'your-gemini-api-key',
'ai_model'    => 'gemini-3.5-flash-lite', // optional (default)

Option B: OpenAI (or OpenAI-Compatible API)

'ai_provider' => 'openai',
'ai_api_key'  => 'sk-...',
'ai_model'    => 'gpt-4o-mini', // optional (default)
'ai_endpoint' => '',            // optional custom base URL

Option C: Local Ollama (Free, Private, No API Key)

'ai_provider' => 'ollama',
'ai_model'    => 'llama3.2',               // optional (default)
'ai_endpoint' => 'http://localhost:11434', // optional (default)

How It Works (Draft-First Safety)

  1. You type or dictate a natural-language request in any language (e.g., Romanian, English, German, French, Spanish) ? optionally including a `source_url` to summarize.
  2. QuickWP fetches the site's real categories and tags so the model only assigns valid taxonomy IDs.
  3. The model returns structured JSON (`title`, `slug`, `excerpt`, `content_html`, `category_ids`, `tag_ids`).
  4. QuickWP saves the result to WordPress with hardcoded status => 'draft' (it never auto-publishes).
  5. In the Web Dashboard (`public/index.php`), you get a one-click Open Draft in Editor ? button straight into `quick-edit.php` (2-column editor with live preview and Media Picker).

Usage Channels

  • Dashboard Command Bar (public/index.php): Text input + ? browser-native voice dictation (Web Speech API in Chrome/Edge; automatically hidden on unsupported browsers) + optional URL + language selector + CSRF protection.
  • CLI:
    php bin/quickwp ai:draft --site=main --prompt="F? un rezumat īn romān? despre acest articol" --url=https://example.com/article --lang=ro
    
  • Programmatic PHP:
    $res = $qwp->ai()->draftFromPrompt('Write a concise release summary in English', [
        'type' => 'post',
        'language' => 'en',
        'source_url' => 'https://example.com/release-notes',
        'create_draft' => true,
    ]);