WordPress MCP Server
WordPress MCP Server
A Model Context Protocol (MCP) server that enables AI assistants to interact with WordPress sites through the WordPress REST API. Supports multiple WordPress sites with secure authentication, enabling content management, post operations, and site configuration through natural language.
Features
- Multi-Site Support: Connect to multiple WordPress sites simultaneously
- REST API Integration: Full access to WordPress REST API endpoints
- Secure Authentication: Uses application passwords for secure API access
- Dynamic Endpoint Discovery: Automatically maps available endpoints for each site
- Flexible Operations: Support for GET, POST, PUT, DELETE, and PATCH methods
- Error Handling: Graceful error handling with meaningful messages
- Simple Configuration: Easy-to-maintain JSON configuration file
Installation
Tools Reference
wp_discover_endpoints
Maps all available REST API endpoints on a WordPress site.
Arguments:
Returns: List of available endpoints with their methods and namespaces.
wp_call_endpoint
Executes REST API requests to WordPress sites.
Arguments:
Configuration
Getting an Application Password
- Log in to your WordPress admin dashboard
- Go to Users → Profile
- Scroll to the "Application Passwords" section
- Enter a name for the application (e.g., "MCP Server")
- Click "Add New Application Password"
- Copy the generated password (you won't be able to see it again)
Note: Application Passwords require WordPress 5.6 or later and HTTPS.
Configuration File Setup
Create a JSON configuration file (e.g., wp-sites.json
) with your WordPress site details:
Each site configuration requires:
URL
: WordPress site URL (must include http:// or https://)USER
: WordPress usernamePASS
: Application password (spaces will be automatically removed)
The configuration key (e.g., "myblog", "testsite") becomes the site alias you'll use when interacting with the server.
Usage with Claude Desktop
Add to your claude_desktop_config.json
:
The WP_SITES_PATH
environment variable must point to the absolute path of your configuration file.
Example Usage
Once configured, you can ask Claude to perform various WordPress operations:
List and Query Posts
Create and Edit Content
Manage Comments
Plugin Management
User Management
Site Settings and Configuration
Maintenance and Diagnostics
Error Handling
The server handles common errors including:
- Invalid configuration file path or format
- Invalid site configurations
- Authentication failures
- Missing or invalid endpoints
- API rate limiting
- Network errors
All errors are returned with descriptive messages to help diagnose issues.
Security Considerations
- Keep your
wp-sites.json
file secure and never commit it to version control - Consider using environment variables for sensitive data in production
- Store the config file outside of public directories
- Use HTTPS for all WordPress sites
- Regularly rotate application passwords
- Follow the principle of least privilege when assigning user roles
Dependencies
- @modelcontextprotocol/sdk - MCP protocol implementation
- axios - HTTP client for API requests
License
MIT
Enables AI assistants to interact with WordPress sites through the WordPress REST API. Supports multiple WordPress sites with secure authentication, enabling content management, post operations, and site configuration through natural language.