SRZ MCP Server WP
by Sohagsrz
README.md
# SRZ MCP Server WP
A comprehensive WordPress plugin that creates an MCP (Model Context Protocol) server for AI integration. This plugin provides **194+ tools** for complete WordPress and WooCommerce management through AI clients like Cursor, Claude Desktop, or VS Code.
## 🚀 **194+ Available Tools**
### **Core WordPress Management (31 tools)**
- Site information, status monitoring, and configuration
- User management, roles, and permissions
- Content management (posts, pages, media)
- Database operations and optimization
- System maintenance and debugging
- Cron job management
- WordPress core updates and configuration
### **Site Management (10 tools)**
- Site status monitoring and health checks
- URL management and redirects
- Maintenance mode control
- Cache management and optimization
- Security hardening and monitoring
### **Plugin & Theme Tools (20 tools)**
- Plugin installation, activation, and management
- Theme switching and customization
- Bulk operations for plugins and themes
- Update management and version control
- Dependency checking and conflict resolution
### **Security Management (20 tools)**
- Security scanning and vulnerability assessment
- Malware detection and removal
- IP blocking and firewall management
- User security and access control
- Security audit and compliance checking
### **Performance & Caching (32 tools)**
- Cache management (object, page, database)
- Performance monitoring and optimization
- CDN configuration and management
- Database optimization and cleanup
- Resource monitoring and alerting
### **Database & File Tools (25 tools)**
- Database queries and management
- Backup and restore operations
- File system operations and security
- Search and replace functionality
- Data migration and synchronization
### **Email & Notifications (36 tools)**
- Email sending and template management
- Notification system configuration
- Queue management and monitoring
- Analytics and reporting
- Webhook management and testing
### **WooCommerce Advanced Management (20+ tools)**
- **Product Management**: Complete CRUD operations
- **Bulk Operations**: Mass product updates and management
- **Order Processing**: Order management and status updates
- **Customer Management**: Customer data and order history
- **Inventory Control**: Stock management and monitoring
- **Analytics & Reporting**: Sales data and performance metrics
- **Coupon Management**: Discount creation and management
- **Settings Configuration**: WooCommerce settings management
### **WooCommerce Product Editor (10+ tools)**
- **Product Editing**: Name, description, price, SKU updates
- **Category Management**: Add/remove product categories
- **Tag Management**: Product tag operations
- **Attribute Management**: Product attributes and variations
- **SEO Optimization**: Meta descriptions and keywords
- **Image Management**: Featured images and galleries
- **Stock Management**: Inventory tracking and alerts
- **Pricing Management**: Regular and sale price updates
## ✨ **Key Features**
### **Complete WordPress Control**
- **194+ tools** covering every aspect of WordPress management
- **Real-time monitoring** of site health and performance
- **Automated maintenance** tasks and optimization
- **Security hardening** and vulnerability scanning
- **Database management** and optimization
### **Advanced WooCommerce Integration**
- **Product Management**: Full CRUD operations with bulk capabilities
- **Order Processing**: Complete order lifecycle management
- **Customer Insights**: Customer data and behavior analysis
- **Inventory Control**: Stock management and automated alerts
- **Analytics Dashboard**: Sales reports and performance metrics
- **Marketing Tools**: Coupon management and promotional campaigns
### **AI-Powered Features**
- **Smart Product Descriptions**: AI-generated content for better SEO
- **Intelligent Categorization**: Automatic product categorization
- **Content Optimization**: SEO-friendly content generation
- **Automated Workflows**: Smart automation for repetitive tasks
### **Developer-Friendly**
- **REST API Integration**: Full WordPress REST API compliance
- **Extensible Architecture**: Easy to add custom tools
- **Comprehensive Logging**: Detailed operation logs and debugging
- **Error Handling**: Graceful error management and reporting
## 🏗️ Architecture
The plugin is built with a modular, extensible architecture:
- **Core Module**: Handles MCP protocol, REST API, and core abilities
- **Abilities Manager**: Manages ability registration and execution
- **Hooks Manager**: Provides extensibility system for other plugins
- **Admin Interface**: WordPress admin dashboard with modern UI
- **WooCommerce Integration**: Comprehensive e-commerce abilities
- **WooCommerce Advanced Management**: Advanced bulk operations and automation
- **Extension System**: Allows other plugins to add custom abilities
## 🚀 **Quick Start**
### **Prerequisites**
- WordPress 5.0+ with REST API enabled
- WooCommerce (optional, for e-commerce features)
- Node.js (for MCP server integration)
- Cursor IDE or Claude Desktop
### **Installation**
#### **Step 1: Install the Plugin**
1. Upload the plugin files to `/wp-content/plugins/srz-mcp-server-wp/`
2. Activate the plugin through WordPress admin
3. Configure permalinks (Settings > Permalinks) - choose any structure other than "Plain"
#### **Step 2: Enable Development Mode**
Add to your `wp-config.php`:
```php
define('WP_ENVIRONMENT_TYPE', 'local');
define('WP_DEBUG', true);
```
#### **Step 3: Install Node.js Dependencies**
```bash
cd wp-content/plugins/srz-mcp-server-wp
npm install
```
#### **Step 4: Set Up Application Password**
1. Go to Users > Profile in WordPress admin
2. Scroll down to "Application Passwords" section
3. Create a new application password (save it securely)
4. Note your username (usually "admin")
## 🔧 **Configuration**
### **Cursor IDE Configuration**
Create or update your `~/.cursor/mcp.json` file:
```json
{
"mcpServers": {
"srz-mcp-server": {
"command": "npm",
"args": ["start"],
"cwd": "/path/to/your/wp-content/plugins/srz-mcp-server-wp"
}
}
}
```
**Important**: Replace `/path/to/your/wp-content/plugins/srz-mcp-server-wp` with your actual plugin path.
### **Claude Desktop Configuration**
Edit your `claude_desktop_config.json` file:
```json
{
"mcpServers": {
"srz-mcp-server": {
"command": "npm",
"args": ["start"],
"cwd": "/path/to/your/wp-content/plugins/srz-mcp-server-wp"
}
}
}
```
### **VS Code Configuration**
Create a `.vscode/mcp.json` file in your WordPress root directory:
```json
{
"servers": {
"srz-mcp-server": {
"command": "npm",
"args": ["start"],
"cwd": "/path/to/your/wp-content/plugins/srz-mcp-server-wp"
}
}
}
```
### **Testing the Connection**
After configuration, restart your AI client and test with:
```bash
# Test the MCP server directly
curl -X POST http://wp.test/wp-json/srz-mcp-server/v1/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "tools/list", "id": "test"}'
```
You should see a response with 194+ tools available.
## Available Abilities
### Site Information
- **Ability**: `srz-mcp-server/get-site-info`
- **Description**: Retrieves basic information about the WordPress site
- **Permissions**: `read`
- **Output**: Site title, description, URL, admin email, timezone, language
### Post Management
- **List Posts**: `srz-mcp-server/list-posts`
- Parameters: `post_type`, `posts_per_page`, `status`
- Permissions: `read`
- **Create Post**: `srz-mcp-server/create-post`
- Parameters: `title` (required), `content` (required), `post_type`, `status`, `excerpt`
- Permissions: `edit_posts`
- **Get Post**: `srz-mcp-server/get-post`
- Parameters: `post_id` (required)
- Permissions: `read`
- **Update Post**: `srz-mcp-server/update-post`
- Parameters: `post_id` (required), `title`, `content`, `status`, `excerpt`
- Permissions: `edit_posts`
### User Management
- **List Users**: `srz-mcp-server/list-users`
- Parameters: `role`, `number`
- Permissions: `list_users`
### System Information
- **Get Plugins**: `srz-mcp-server/get-plugins`
- Permissions: `activate_plugins`
- Output: Plugin list with active status
### WooCommerce Abilities
#### Product Management
- **List Products**: `woo/get-products`
- Parameters: `status`, `per_page`, `search`, `category`, `stock_status`, `featured`
- Permissions: `edit_products`
- **Get Product**: `woo/product/get`
- Parameters: `product_id` (required)
- Permissions: `edit_products`
- **Update Product**: `woo/product/update`
- Parameters: `product_id` (required), `name`, `description`, `regular_price`, `sale_price`, `stock_quantity`, `stock_status`
- Permissions: `edit_products`
#### Bulk Operations
- **Bulk Update Products**: `woo/products/bulk-update`
- Parameters: `product_ids` (array), `update_data` (object)
- Permissions: `edit_products`
- Description: Updates multiple products with the same data
- **Bulk Update Categories**: `woo/products/bulk-categories`
- Parameters: `product_ids` (array), `categories` (array)
- Permissions: `edit_products`
- Description: Updates categories for multiple products
- **Bulk Update Pricing**: `woo/products/bulk-pricing`
- Parameters: `product_ids` (array), `pricing_data` (object)
- Permissions: `edit_products`
- Description: Updates pricing for multiple products
#### Advanced Management
- **Enhanced Bulk Update**: `wc_bulk_update_enhanced`
- Parameters: None (processes all products)
- Permissions: `edit_products`
- Description: Updates all products with 500+ word descriptions and proper categories
- Features:
- Generates comprehensive product descriptions
- Intelligent category assignment based on product names
- Updates short descriptions for better SEO
- Maintains data integrity throughout the process
#### Order Management
- **List Orders**: `woo/get-orders`
- Parameters: `status`, `per_page`, `customer_id`, `date_from`, `date_to`
- Permissions: `edit_shop_orders`
#### Categories & Tags
- **List Categories**: `woo/categories/list`
- Permissions: `edit_products`
- Output: All product categories with hierarchy
- **List Tags**: `woo/tags/list`
- Permissions: `edit_products`
- Output: All product tags
## 🎯 **Usage Examples**
### **With Cursor IDE**
1. Restart Cursor after configuration
2. Use the chat panel to interact with your WordPress site:
**Site Management:**
- "Show me my WordPress site information"
- "What's the current site status?"
- "List all active plugins"
- "Check site performance metrics"
**Content Management:**
- "Create a new blog post about WordPress"
- "List all published posts"
- "Update post with ID 123"
- "Show me all media files"
**WooCommerce Management:**
- "List all WooCommerce products"
- "Show me product with ID 456"
- "Update product pricing for all products"
- "Add categories to product 789"
- "Show me all orders from last month"
**Advanced Operations:**
- "Run a security scan"
- "Optimize the database"
- "Clear all caches"
- "Check for plugin updates"
### **With Claude Desktop**
1. Restart Claude Desktop after configuration
2. Use the "Search and tools" feature
3. Ask questions like:
- "What users are registered on this site?"
- "Create a draft post about AI integration"
- "Show me all products in the Electronics category"
- "Update all products with better descriptions"
- "Run a performance audit"
### **Product Management Examples**
**Get Product Information:**
```json
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "woo/product/get",
"arguments": {
"product_id": 123
}
}
}
```
**Update Product:**
```json
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "woo/product/update",
"arguments": {
"product_id": 123,
"name": "Updated Product Name",
"description": "New product description",
"regular_price": "29.99"
}
}
}
```
**Add Categories to Product:**
```json
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "woo/product/categories/add",
"arguments": {
"product_id": 123,
"categories": ["Electronics", "Gadgets"]
}
}
}
```
### Testing with Postman
You can test the MCP server directly using Postman:
1. **List Tools**:
```json
{
"jsonrpc": "2.0",
"method": "tools/list",
"params": {}
}
```
2. **Call a Tool**:
```json
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "srz-mcp-server-get-site-info",
"arguments": {}
}
}
```
3. **Bulk Update Products**:
```json
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "wc_bulk_update_enhanced",
"arguments": {}
}
}
```
## Security
- All abilities respect WordPress user capabilities and permissions
- Authentication is required for all MCP requests
- Users can only perform actions they're authorized to do
- Application passwords provide secure API access
- Input validation and sanitization on all parameters
- Rate limiting to prevent abuse
## 🔧 **Troubleshooting**
### **Common Issues**
1. **"MCP server not connecting"**
- Restart your AI client (Cursor/Claude Desktop)
- Check that the plugin path in `mcp.json` is correct
- Ensure Node.js dependencies are installed (`npm install`)
- Verify the MCP server is running: `npm start`
2. **"No tools showing"**
- Check that the plugin is activated in WordPress
- Verify permalinks are not set to "Plain"
- Test the REST API endpoint directly with curl
- Check WordPress debug logs for errors
3. **"Permission denied errors"**
- Ensure `WP_ENVIRONMENT_TYPE` is set to 'local' in `wp-config.php`
- Check that Application Passwords are enabled
- Verify the user has appropriate capabilities
4. **"REST API endpoint does not exist"**
- Ensure permalinks are not set to "Plain"
- Check that the plugin is activated
- Verify the endpoint: `http://wp.test/wp-json/srz-mcp-server/v1/mcp`
### **Debugging Steps**
1. **Test the MCP server directly:**
```bash
curl -X POST http://wp.test/wp-json/srz-mcp-server/v1/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "tools/list", "id": "test"}'
```
2. **Check WordPress debug logs:**
- Enable `WP_DEBUG` in `wp-config.php`
- Check `/wp-content/debug.log` for errors
3. **Verify plugin activation:**
- Go to Plugins > Installed Plugins
- Ensure "SRZ MCP Server WP" is active
4. **Test Node.js MCP server:**
```bash
cd wp-content/plugins/srz-mcp-server-wp
npm start
```
### **Getting Help**
If you're still having issues:
1. Check the WordPress debug logs
2. Test the REST API endpoint directly
3. Verify your MCP configuration
4. Ensure all dependencies are installed
5. Restart your AI client after configuration changes
## 🔧 Creating Extensions
The plugin provides a comprehensive extension system that allows other plugins to add their own MCP abilities. See the `examples/example-extension.php` file for a complete example.
### Quick Start
```php
class My_Plugin_MCP_Extension {
public function __construct() {
add_filter('srz_mcp_server_extensions', array($this, 'register_extension'));
add_action('abilities_api_init', array($this, 'register_abilities'));
}
public function register_extension($extensions) {
$extensions['my-plugin'] = array(
'name' => 'My Plugin Extension',
'description' => 'Adds MCP abilities for My Plugin',
'version' => '1.0.0',
'load_abilities' => array($this, 'load_abilities')
);
return $extensions;
}
public function register_abilities() {
wp_register_ability(
'srz-mcp-server/my-plugin/my-ability',
array(
'label' => 'My Ability',
'description' => 'Does something useful',
'category' => 'my-plugin',
'permissions' => array('read'),
'inputs' => array(
'param1' => array(
'type' => 'string',
'description' => 'Parameter description',
'required' => true
)
),
'outputs' => array(
'result' => array(
'type' => 'string',
'description' => 'Result description'
)
)
),
array($this, 'my_ability_callback')
);
}
public function my_ability_callback($args) {
return array('result' => 'success');
}
}
new My_Plugin_MCP_Extension();
```
### Available Hooks
The plugin provides extensive hooks for customization:
- **Extension Hooks**: Register and manage extensions
- **Ability Hooks**: Modify ability data, permissions, and execution
- **Admin Hooks**: Add admin menu items and pages
- **REST API Hooks**: Modify requests and responses
For complete documentation, see [DEVELOPER.md](DEVELOPER.md).
## Development
### Adding Custom Abilities
To add your own abilities, use the `wp_register_ability()` function:
```php
wp_register_ability(
'srz-mcp-server/custom-ability',
array(
'label' => 'Custom Ability',
'description' => 'Description of what this ability does',
'category' => 'custom',
'permissions' => array('read'),
'inputs' => array(
'param1' => array(
'type' => 'string',
'description' => 'Parameter description',
'required' => true
)
),
'outputs' => array(
'result' => array(
'type' => 'string',
'description' => 'Output description'
)
)
),
'your_callback_function'
);
```
### WooCommerce Extension Example
```php
class WooCommerce_MCP_Extension {
public function __construct() {
add_action('abilities_api_init', array($this, 'register_woocommerce_abilities'));
}
public function register_woocommerce_abilities() {
// Register WooCommerce-specific abilities
wp_register_ability(
'srz-mcp-server/woocommerce/bulk-update-products',
array(
'label' => 'Bulk Update Products',
'description' => 'Updates multiple products with enhanced descriptions',
'category' => 'woocommerce',
'permissions' => array('edit_products'),
'inputs' => array(
'min_words' => array(
'type' => 'integer',
'description' => 'Minimum words for descriptions',
'default' => 500
)
),
'outputs' => array(
'updated_count' => array(
'type' => 'integer',
'description' => 'Number of products updated'
)
)
),
array($this, 'bulk_update_products')
);
}
public function bulk_update_products($args) {
// Implementation for bulk updating products
return array('updated_count' => 0);
}
}
new WooCommerce_MCP_Extension();
```
## Performance Considerations
### Bulk Operations
- Bulk updates are optimized for performance
- Large operations are processed in batches
- Memory usage is monitored during bulk operations
- Progress tracking for long-running operations
### Caching
- Built-in caching for frequently accessed data
- Configurable cache expiration times
- Cache invalidation on data updates
### Rate Limiting
- Configurable API rate limits
- Per-user rate limiting
- Graceful handling of rate limit exceeded
## License
This plugin is licensed under the GPL v2 or later.
## Support
For support and questions:
- Check the troubleshooting section above
- Review the [WordPress Abilities API documentation](https://github.com/WordPress/abilities-api)
- Check the [MCP Adapter documentation](https://github.com/WordPress/mcp-adapter)
- Create an issue on the GitHub repository
## 📋 **Changelog**
### **Version 3.0.0 - Current Release**
- **NEW**: **194+ tools** for comprehensive WordPress management
- **NEW**: Complete WooCommerce integration with product editing capabilities
- **NEW**: Advanced security management and vulnerability scanning
- **NEW**: Performance monitoring and caching optimization
- **NEW**: Database management and file system tools
- **NEW**: Email and notification system management
- **NEW**: Plugin and theme advanced management tools
- **NEW**: Site management and maintenance capabilities
- **NEW**: Custom MCP server implementation for better AI client integration
- **IMPROVED**: Enhanced error handling and debugging capabilities
- **IMPROVED**: Better authentication and permission management
- **IMPROVED**: Optimized performance for bulk operations
### **Version 2.0.0**
- Enhanced bulk update functionality for WooCommerce products
- AI-powered product description generation (500+ words)
- Intelligent product categorization system
- Advanced WooCommerce management abilities
- Comprehensive bulk operations for products, categories, and pricing
- Better error handling and logging
- Enhanced security and permission checks
- Performance optimizations for bulk operations
### **Version 1.0.0**
- Initial release
- Basic site information abilities
- Post management capabilities
- User listing functionality
- Plugin information retrieval
- Full MCP protocol compliance
## Contributing
We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details on how to contribute to this project.
## Roadmap
### Upcoming Features
- **Advanced Analytics**: Detailed WooCommerce analytics and reporting
- **Automated Marketing**: AI-powered marketing content generation
- **Inventory Automation**: Automated stock management and alerts
- **Customer Insights**: Advanced customer behavior analysis
- **Multi-site Support**: Management across multiple WordPress sites
### Planned Improvements
- Enhanced caching system
- Better error reporting
- More granular permissions
- Additional WooCommerce integrations
- Performance monitoring dashboard# srz-mcp-server-wp
Maintenance
ActivityInactive
ResponsivenessNo issues