WP Manifestindependent plugin directory
manifest / ai / llm-connector-for-wp

LLM Connector for WordPress

Secure WordPress-to-LLM connector for AI-powered site management

★ 4stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/sudo-wp/llm-connector-for-wp/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Read-only MCP bridge for WordPress with optional AI provider integration. Verified with Claude.ai Web UI, Claude Code, and Gemini CLI; compatible with Cursor, Windsurf, and VS Code (Cline) via the auto-generated MCP config. Also integrates WordPress as an outbound AI text-generation client through the WP 7.0 AI Client and WP 6.9 Abilities API.

📹 Demo Video

Watch the LLM Connector in action with Claude Code:

LLM Connector Demo

Click to watch on YouTube

Purpose

The plugin runs in two complementary directions:

  • Inbound (MCP bridge): AI clients connect into your WordPress site to read diagnostics — plugin / theme inventory, system status, user statistics, content statistics — via a read-only REST API authenticated with a per-plugin API key.
  • Outbound (AI providers): WordPress calls an LLM (Anthropic, OpenAI, Gemini) to generate text via the WP 7.0 AI Client / WP 6.9 Abilities API, with credentials and models configured per-provider from the admin UI.

Both directions are optional and independent. Enabling providers does not open any inbound endpoints; enabling inbound endpoints does not require any outbound provider credentials.

Why LLM Connector?

  • Production-safe by design. Read-only enforcement at the permission layer. No eval(), no dynamic code execution, no filesystem writes from REST handlers, no third-party data transmission except the explicitly-configured outbound provider calls (generate_text via wp_remote_post()) and a single self-loopback to /health from the admin Test Connection button. See SECURITY.md.
  • Works in the Claude.ai Web UI — not just local CLI tools. Most alternatives are CLI-only; this plugin ships a verified remote MCP config for claude.ai.
  • SHA-256 hashed API keys stored in WordPress options. Plaintext is shown once at generation time and then discarded. Not a reuse of WordPress Application Passwords.
  • Access logging built in. Every inbound request is logged to a dedicated audit table (endpoint, IP, method, response code, execution time, provider) and surfaced via the Access Log admin panel with filters, CSV export, and a summary bar.
  • Auto-generated MCP config for Claude.ai, Claude Code, Gemini CLI, and Cursor / Windsurf / VS Code (Cline) — copy the full config with one click from the settings page.
  • WordPress-native AI integration. Providers auto-register with the WP 7.0 AI Client API and expose 8 abilities via the WP 6.9+ Abilities API, so other plugins / themes can use them without any direct coupling.

Compatibility

Verified against the following AI clients (inbound MCP bridge):

AI Client Status Notes
Claude.ai Web UI ✓ Verified No CLI required
Claude Code ✓ Verified
Gemini CLI ✓ Verified
Cursor ✓ Compatible Via MCP config
Windsurf ✓ Compatible Via MCP config
VS Code + Cline ✓ Compatible Via MCP config

"Verified" = tested end-to-end against a live WordPress install. "Compatible" = standard MCP config generated by the plugin should load without modification; not regression-tested every release.

Supported outbound providers: Anthropic (Claude), OpenAI, Google Gemini.

Key Features

Security First

  • API Key Authentication: Secure token-based access control for inbound clients
  • Read-Only Data Endpoints: Enforced at the permission layer — no write endpoints are exposed in this build
  • Rate Limiting: Configurable request limits per API key (1-1000 req/hour)
  • Audit Logging: Full request logging surfaced via the Access Log admin panel
  • IP Tracking: Monitor where requests originate
  • Granular Permissions: Enable only the endpoints you need
  • SHA-256 hashed API keys: Plaintext shown once, then hashed at rest

Multi-Provider AI Integration (v2.0+)

  • Anthropic (Claude) — Opus 4.6, Sonnet 4.6, Haiku 4.5
  • OpenAI — GPT-4o, GPT-4o mini, GPT-4 Turbo
  • Google Gemini — Gemini 2.0 Flash, 1.5 Pro, 1.5 Flash
  • Provider Registry: Capability-based lookup; extensible via the wp_llm_connector_register_providers action
  • Uniform text generation: generate_text() method on every provider (same signature, vendor APIs under the hood via wp_remote_post())

WordPress AI Stack (v2.0+)

  • WP 7.0 AI Client API: Providers auto-register via register_with_wp_ai_client() when the AI Client is available
  • WP 6.9+ Abilities API: 8 abilities registered (site-info, list-plugins, system-status, user-count, post-stats, list-providers, generate-text, provider-status)
  • Graceful Fallback: Works on WordPress 5.8+ — new hooks are function_exists()-guarded

MCP Compatible

  • Universal MCP Server: wordpress_mcp_server.py works with Claude Code, Gemini CLI, Cursor, Windsurf, Cline, VS Code Copilot
  • /mcp manifest endpoint: Remote-capable clients (like the Claude.ai Web UI) can consume the manifest directly without running a local Python MCP server
  • Tool filtering: The manifest's tools[] only lists endpoints the admin has enabled — clients see an accurate catalog, not a list that will 404
  • Composite tool: wp_full_diagnostics runs site-info, plugins, themes, system-status in sequence (advertised only when all four are enabled)

Admin-Friendly

  • Tabbed settings page: General | AI Providers | API Keys
  • Auto-Generated MCP Config: Pick your client from the "Connect Your AI Client" section on the API Keys tab to get a ready-to-use snippet with your site's real REST URL, a one-click Copy full config button (real key when a freshly generated one is available; placeholder otherwise), and an inline Test Connection badge
  • Access Log Panel: Settings > LLM Connector Log lists every request with color-coded response codes, HTTP method, IP, execution time; filters by range / status / search; Clear Log; CSV export
  • Recent Activity Widget: Last 5 requests on the main settings page linking to the full log
  • One-Click API Keys: Generate secure keys instantly; reveal / copy / revoke on the API Keys tab

Installation

Manual Installation

  1. Download the plugin files
  2. Upload the wp-llm-connector folder to /wp-content/plugins/
  3. Activate the plugin through the WordPress admin
  4. Navigate to Settings > LLM Connector
  5. On the General tab, enable the connector and choose which endpoints to allow
  6. On the API Keys tab, generate an API key (copy it immediately — shown once)
  7. Use the Connect Your AI Client section to copy a ready-to-use MCP config
  8. (Optional) On the AI Providers tab, configure Anthropic / OpenAI / Gemini credentials for outbound text generation

Requirements

  • WordPress 5.8 or higher (WP 6.9+ recommended for Abilities API; WP 7.0+ for AI Client integration)
  • PHP 7.4 or higher
  • MySQL 5.6 or higher

Quick Start

1. Enable the Connector

Navigate to Settings > LLM Connector and:

  1. On the General tab, check "Enable Connector"
  2. Keep "Read-Only Mode" enabled (recommended)
  3. Select which endpoints to allow
  4. Save settings

2. Generate an API Key

  1. Switch to the API Keys tab
  2. Enter a descriptive name (e.g., "Claude Production")
  3. Click "Generate API Key"
  4. Copy the key immediately — it is shown once; afterwards only the prefix remains

3. Configure AI Providers (Optional)

For outbound generate_text use via WP AI Client / Abilities:

  1. Switch to the AI Providers tab
  2. For each provider you want to use, check Enable, paste the vendor API key, choose a default model
  3. Save provider settings

4. Test the Connection

Inline from the admin: use the Test Connection button in the Connect Your AI Client section (pings /health).

Or via cURL:

curl -H "X-WP-LLM-API-Key: wpllm_your_api_key_here" \
     https://yoursite.com/wp-json/wp-llm-connector/v1/site-info

Available REST Endpoints

All endpoints require authentication via the X-WP-LLM-API-Key header except /health.

Endpoint Auth Purpose
GET /health No Uptime check
GET /mcp Yes MCP server manifest (filtered to enabled tools)
GET /site-info Yes Site configuration, WP + PHP versions, timezone
GET /plugins Yes All installed plugins with active status
GET /themes Yes All installed themes with active theme identification
GET /system-status Yes Server / database / filesystem diagnostics
GET /user-count Yes User statistics by role
GET /post-stats Yes Content statistics by post type

Full schemas in API_DOCS.md.

Abilities (WP 6.9+)

When the WordPress Abilities API is available, the plugin registers eight abilities under the llm-connector category:

Ability Input Output
llm-connector/site-info — Site metadata
llm-connector/list-plugins active_only? Plugin array
llm-connector/system-status — System diagnostics
llm-connector/user-count — User counts by role
llm-connector/post-stats — Post stats by type
llm-connector/list-providers — Configured providers + models
llm-connector/generate-text prompt, provider?, model? Generated text (requires auth)
llm-connector/provider-status provider Provider credential validity

Connecting to Claude Code

Option 1: Auto-Generated Config (recommended)

On the API Keys tab, the Connect Your AI Client section generates a ready-to-use config for Claude Code. Click Copy full config and paste into ~/.claude/mcp.json.

Option 2: Manual Configuration

Add to your Claude Code MCP settings:

{
  "mcpServers": {
    "wordpress": {
      "url": "https://yoursite.com/wp-json/wp-llm-connector/v1/",
      "transport": "http",
      "headers": {
        "X-WP-LLM-API-Key": "wpllm_your_api_key_here"
      },
      "description": "WordPress site diagnostics"
    }
  }
}

See CLAUDE_CODE_SETUP.md for the full guide.

Connecting to Gemini CLI

The generated MCP config also targets ~/.gemini/mcp.json. See the Connect Your AI Client section on the API Keys tab for the exact format.

Other MCP-Compatible Tools

The plugin's MCP output works with any MCP-compatible client. The config generator has presets for Cursor (.cursor/mcp.json), Windsurf (.windsurf/mcp.json), and VS Code (Cline) (.vscode/cline_mcp_settings.json).

Provider Extensibility

Add new LLM providers by implementing LLM_Provider_Interface and hooking the registration action:

add_action( 'wp_llm_connector_register_providers', function ( $registry ) {
    $registry->register( new My_Provider( $registry->get_security_manager() ) );
} );

See includes/Providers/LLM_Provider_Interface.php for the required methods (init, validate_credentials, get_provider_name, get_provider_display_name, get_config_fields, generate_text, …).

Security Considerations

See SECURITY.md for the full threat model. Highlights:

  • Read-only by design. The inbound REST data layer exposes GET routes only. Read-only enforcement lives in API_Handler::check_permissions(), not in a settings toggle a caller can influence.
  • No dynamic code execution. No eval(), create_function(), assert() with string input, preg_replace /e, or variable-variable invocation of user-controlled callbacks.
  • No filesystem writes from REST handlers. CSV export from the Access Log streams to php://output (HTTP response), not to disk.
  • API key storage. Keys are generated with random_bytes(32) and prefixed with wpllm_. Only the SHA-256 hash is persisted; plaintext is returned to the browser once at generation time via a per-user transient and then discarded.
  • Provider credential storage. Vendor API keys (Anthropic, OpenAI, Gemini) are stored in wp_options under wp_llm_connector_settings['providers'][slug]['api_key']. They are never exposed via REST endpoints and only travel outbound inside generate_text() via wp_remote_post().
  • Rate limiting. Per-key window, transient-backed, TTL set only on window entry.
  • Full audit logging. Every authenticated request (plus every auth / endpoint / rate-limit denial) is inserted into {prefix}llm_connector_audit_log.

Best Practices

  1. Use Strong API Keys: The plugin generates cryptographically secure keys — no need to supply your own
  2. Enable Only Needed Endpoints: Don't expose data you don't intend to share
  3. Monitor the Access Log: Regularly review via Settings > LLM Connector Log
  4. Rotate Keys Regularly: Revoke and regenerate periodically
  5. Use HTTPS: Always run the site over TLS
  6. Treat Provider API Keys Like Passwords: Never share via email / Slack / screenshots

What Data is Exposed?

Only the endpoints you explicitly enable. The plugin does not expose user passwords or credentials, email content, private post bodies, database credentials, server passwords, or file contents.

Architecture

Directory Structure

wp-llm-connector/
├── wp-llm-connector.php          # Main plugin file (header, constants, autoloader)
├── includes/
│   ├── Core/
│   │   ├── Plugin.php            # Singleton orchestrator
│   │   ├── Activator.php         # Schema + defaults; maybe_upgrade()
│   │   └── Deactivator.php
│   ├── API/
│   │   └── API_Handler.php       # REST routes (/health, /mcp, /site-info, …)
│   ├── Security/
│   │   ├── Security_Manager.php  # Auth, rate limiting, audit log
│   │   └── Write_Permission_Manager.php  # Write-tier permission scaffold (no endpoints yet)
│   ├── Admin/
│   │   ├── Admin_Interface.php   # Tabbed settings UI + AJAX + Access Log page
│   │   └── Access_Log_Table.php  # WP_List_Table implementation
│   ├── Providers/
│   │   ├── LLM_Provider_Interface.php
│   │   ├── Provider_Registry.php
│   │   ├── Anthropic_Provider.php
│   │   ├── OpenAI_Provider.php
│   │   └── Gemini_Provider.php
│   └── Abilities/
│       └── Abilities_Manager.php # WP 6.9+ Abilities API registration
├── assets/
│   ├── css/admin.css
│   └── js/admin.js
├── mcp/
│   └── wordpress_mcp_server.py   # Universal MCP server (Python)
├── docs/
│   └── WRITE_TIER.md             # Design doc for the premium write tier
├── uninstall.php                 # Options + audit log cleanup
├── API_DOCS.md                   # Per-endpoint reference
├── CHANGELOG.md                  # Keep-a-Changelog format
├── readme.txt                    # WordPress.org format
├── SECURITY.md                   # Threat model + security claims
├── CLAUDE.md                     # Orientation doc for session start
├── HANDOFF.md                    # Living session snapshot
└── README.md                     # This file

Design Patterns

  • PSR-4 Autoloading: WP_LLM_Connector\{Core,API,Security,Admin,Providers,Abilities}\*
  • Dependency Injection: Security_Manager and Provider_Registry are injected into consumers
  • Interface Segregation: LLM_Provider_Interface defines the provider contract
  • Singleton: Plugin::get_instance() bootstraps the plugin
  • Forward-Compatible Migrations: Activator::maybe_upgrade() runs on plugins_loaded so in-place updates pick up schema changes without reactivation

Database Schema

Audit Log Table (wp_llm_connector_audit_log)

Column Type Purpose
id bigint PK
timestamp datetime UTC, indexed
api_key_hash varchar(64) SHA-256 of inbound key, indexed
endpoint varchar(255) Logical endpoint slug
http_method varchar(10) GET/POST/…
execution_time_ms float Request duration
request_data text Sanitized JSON
response_code int HTTP status, indexed
ip_address varchar(45) IPv4/IPv6, indexed
user_agent varchar(500) Caller UA
provider varchar(64) Provider slug for outbound calls, indexed

Schema version is tracked in the wp_llm_connector_db_version option. Current: 2.1.

Options

  • wp_llm_connector_settings: Main plugin configuration (API keys, providers, allowlist, rate limit, logging)
  • wp_llm_connector_db_version: Current schema version
  • wp_llm_connector_activated: Activation timestamp

Roadmap

Shipped (2.1.0)

  • ✅ Read-only REST API endpoints
  • ✅ /mcp manifest endpoint with filtered tool list
  • ✅ Auto-generated MCP config for Claude.ai Web UI (Verified), Claude Code, Gemini CLI, Cursor / Windsurf / Cline
  • ✅ Access Log admin panel (WP_List_Table, filters, CSV export, Clear Log)
  • ✅ Recent Activity widget on main settings page
  • ✅ Inline /health Test Connection badge
  • ✅ API key authentication (SHA-256 hashed)
  • ✅ Rate limiting + full audit logging
  • ✅ Providers system (Anthropic, OpenAI, Gemini) with WP 7.0 AI Client integration
  • ✅ WP 6.9+ Abilities API integration (8 abilities)
  • ✅ Write-tier permission scaffold (no endpoints yet)

Next

  • [ ] Admin UI for per-key write flags and write-session tokens
  • [ ] First write endpoint: POST /write/cache/flush (idempotent, lowest-risk)
  • [ ] Webhook support for proactive alerts
  • [ ] Saved filter presets in the Access Log panel

Future

  • [ ] Multi-tenant / agency mode
  • [ ] Custom endpoint builder (GUI, read-only only)
  • [ ] Dashboard widget for quick stats

Contributing

Contributions, feedback, and suggestions are welcome. See CLAUDE.md and HANDOFF.md for the project governance model and current open tasks.

Development Setup

  1. Clone the repository
  2. Install on a local WordPress instance
  3. Enable WP_DEBUG and WP_DEBUG_LOG
  4. Make your changes
  5. Run the verification checklist in CLAUDE.md
  6. Test thoroughly

Changelog

See CHANGELOG.md for the full version history.

License

GPL v2 or later

Disclaimer

This plugin is designed for site diagnostics and, optionally, outbound LLM text generation. While it includes robust security features, always:

  • Use strong, unique API keys
  • Monitor access logs regularly
  • Keep WordPress and all plugins updated
  • Maintain regular backups
  • Use HTTPS/SSL

The authors are not responsible for misuse or unauthorized access resulting from improper configuration.


Built with Security and Performance in mind