Table of Contents
< All Topics

Claude MCP Integration

The AIWU Claude MCP (Model Context Protocol) integration allows Claude AI to directly interact with your WordPress website through a secure server-side connection. This feature enables Claude to perform WordPress administrative tasks through natural language conversation.

System Requirements

  • WordPress 5.0 or higher
  • AIWU Pro plugin (latest version)
  • Valid SSL certificate (HTTPS required)
  • Public IP address accessible to Claude.ai
  • PHP 7.4 or higher

Important: Claude cannot connect to sites without valid TLS certificates or localhost/private IP addresses.

Setup Instructions

Step 1: Enable MCP in AIWU Settings

  1. Navigate to WordPress Admin → AIWU → Settings → Plugin Settings
  2. Locate the Model Context Protocol section
  3. Enable the following options:
    • Enable MCP: Check this box to activate the MCP server
    • Access Token: (Optional) Generate a 32-character security token
    • Enable MCP logging: Check to log all MCP requests for debugging

Step 2: Configure Claude Connection

  1. Go to Claude.ai
  2. Navigate to Settings → Connectors
  3. Click Add custom connector
  4. Enter your MCP endpoint URL:
    • Without token: https://your-site.com/wp-json/mcp/v1/sse
    • With token: https://your-site.com/wp-json/mcp/v1/sse?token=your-access-token

Step 3: Configure Tool Permissions

  1. In Claude.ai, find your connected MCP server
  2. Click Tools and settings
  3. Enable/disable specific tools Claude can access
  4. Configure permission prompts (Claude will ask before using tools)

Available MCP Functions

The AIWU MCP server provides 36 WordPress functions organized into 8 categories:

System Functions

  • mcp_ping – Test connection and retrieve basic site info
  • wp_list_plugins – List installed WordPress plugins

Content Management

  • wp_get_post_types – Retrieve available post types
  • wp_get_posts – Fetch posts with filtering options
  • wp_get_post – Get single post by ID
  • wp_create_post – Create new posts/pages
  • wp_update_post – Update existing posts/pages
  • wp_delete_post – Delete posts/pages
  • wp_count_posts – Count posts by status

Post Meta & Custom Fields

  • wp_get_post_meta – Retrieve post custom fields
  • wp_update_post_meta – Set/update post custom fields
  • wp_delete_post_meta – Remove post custom fields

Taxonomies (Categories & Tags)

  • wp_get_taxonomies – List available taxonomies
  • wp_get_terms – Fetch taxonomy terms
  • wp_create_term – Create new categories/tags
  • wp_update_term – Update existing terms
  • wp_delete_term – Delete terms
  • wp_get_post_terms – Get terms assigned to posts
  • wp_add_post_terms – Assign terms to posts
  • wp_count_terms – Count terms in taxonomies

Media Management

  • wp_get_media – List media library files
  • wp_upload_media – Upload files to media library
  • wp_update_media – Update media metadata
  • wp_delete_media – Delete media files
  • wp_set_featured_image – Set post featured images
  • wp_count_media – Count media files
  • aiwu_image – Generate AI images via AIWU

User Management

  • wp_get_users – Retrieve user accounts
  • wp_create_user – Create new user accounts
  • wp_update_user – Update user profiles

Comments

  • wp_get_comments – Fetch comments with filtering
  • wp_create_comment – Add new comments
  • wp_update_comment – Update/moderate comments
  • wp_delete_comment – Delete comments

Site Options

  • wp_get_option – Get WordPress site options
  • wp_update_option – Set WordPress site options

Security Configuration

Access Token Setup

If you set an Access Token in AIWU settings, append it to your MCP URL:

https://your-site.com/wp-json/mcp/v1/sse?token=your-32-character-token

WordPress Permissions

MCP functions respect WordPress user roles and capabilities. The connecting user must have appropriate permissions for each operation.

Logging

When Enable MCP logging is active, all requests and responses are logged to:

/wp-content/plugins/aiwu/logs/mcp-YYYY-MM-DD.log

Server-Side Caching Configuration

Critical: Server-Side Events (SSE) streams must not be cached. Configure your server:

Cloudflare

Add a Page Rule to bypass cache for:

https://your-site.com/wp-json/mcp/v1/sse*

Set: Cache Level = Bypass

NGINX

Add to your server configuration:

location /wp-json/mcp/v1/sse {
    add_header Cache-Control "no-cache, no-store, must-revalidate";
    add_header Pragma "no-cache";
    add_header Expires "0";
}

Apache

Add to .htaccess:

<LocationMatch "/wp-json/mcp/v1/sse">
    Header set Cache-Control "no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires "0"
</LocationMatch>

Developer Hooks

AIWU provides hooks for extending MCP functionality:

aiwu_allow_mcp

Filter to customize MCP authentication:

add_filter( 'aiwu_allow_mcp', function( $allowed, $request ) {
    // Custom authentication logic
    return $allowed;
}, 10, 2 );

aiwu_mcp_tools

Filter to add custom MCP tools:

add_filter( 'aiwu_mcp_tools', function( $tools ) {
    $tools['custom_function'] = [
        'name' => 'custom_function',
        'description' => 'Your custom function',
        'inputSchema' => [
            'type' => 'object',
            'properties' => [
                'param1' => [
                    'type' => 'string',
                    'description' => 'Parameter description'
                ]
            ]
        ]
    ];
    return $tools;
});

aiwu_mcp_callback

Action to handle custom MCP tool calls:

add_action( 'aiwu_mcp_callback', function( $tool_name, $arguments ) {
    if ( $tool_name === 'custom_function' ) {
        // Handle your custom function
        return [
            'content' => [
                [
                    'type' => 'text',
                    'text' => 'Custom function result'
                ]
            ]
        ];
    }
}, 10, 2 );

Usage Examples

Basic Content Creation

Claude, create a new blog post titled "WordPress MCP Integration" with a brief introduction about the technology.

Bulk Operations

Claude, update all posts in the "Technology" category to add the tag "AI" and set the excerpt to the first paragraph of each post.

Media Management

Claude, generate a header image for the post "WordPress Tips" and set it as the featured image.

User Management

Claude, create a new author account for "John Smith" with the email john@example.com and assign the Editor role.

Troubleshooting

Connection Issues

  1. Verify HTTPS certificate is valid
  2. Check that your site is publicly accessible
  3. Confirm MCP is enabled in AIWU settings
  4. Review server caching configuration

Permission Errors

  1. Verify WordPress user has required capabilities
  2. Check if specific MCP tools are enabled in Claude
  3. Review access token configuration

Performance Issues

  1. Monitor server resources during MCP operations
  2. Check MCP logs for errors
  3. Consider rate limiting for bulk operations

Best Practices

  1. Always backup your site before testing MCP operations
  2. Test on staging before using on production sites
  3. Use access tokens for additional security
  4. Monitor logs regularly for unusual activity
  5. Limit tool permissions to only what Claude needs
  6. Keep AIWU updated for latest security patches

Support

For technical issues with MCP integration:

  1. Check MCP logs for error details
  2. Verify server configuration requirements
  3. Test connection with mcp_ping function
  4. Contact AIWU support with log excerpts if needed

The MCP integration is designed to be secure and reliable, but always follow WordPress security best practices when granting AI access to your site.

Scroll to Top