- Fix Python formatting (sync no longer strips blank lines from .py files) - Remove test_community_build.py (tests private sync module) - Fix ruff warnings in test files - Add CODE_OF_CONDUCT.md - Add .github/PULL_REQUEST_TEMPLATE.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📚 Examples
This directory contains practical examples demonstrating how to use MCP Hub tools.
📂 Files
- basic_usage.py - Basic WordPress operations
- bulk_operations.py - Batch processing and bulk updates
- woocommerce_shop.py - E-commerce management examples
- content_migration.py - Migrating content between sites
- .env.example - Configuration template for examples
🚀 Quick Start
1. Setup Environment
# Copy environment template
cp examples/.env.example examples/.env
# Edit with your WordPress credentials
nano examples/.env
2. Run Examples
# Activate virtual environment
source venv/bin/activate # Linux/Mac
.\venv\Scripts\Activate.ps1 # Windows
# Run an example
python examples/basic_usage.py
📖 Example Descriptions
Basic Usage
Demonstrates fundamental operations:
- Listing posts
- Creating posts
- Updating posts
- Deleting posts
- Working with media
- Managing categories
Use Case: Learning the basics, quick operations
Bulk Operations
Shows how to handle large-scale tasks:
- Bulk post creation
- Batch updates
- Mass deletion
- Progress tracking
- Error handling
Use Case: Content migrations, mass updates, cleanup
WooCommerce Shop
E-commerce management examples:
- Product CRUD operations
- Inventory management
- Order processing
- Customer management
- Sales reports
Use Case: Online store management, inventory sync
Content Migration
Cross-site content transfer:
- Migrating posts between sites
- Copying pages
- Media migration
- Taxonomy mapping
- URL rewriting
Use Case: Site consolidation, content backup, multi-site sync
🔧 Prerequisites
- Configured WordPress sites in
.env - Valid credentials (Application Passwords)
- WooCommerce installed (for e-commerce examples)
- Sufficient permissions on WordPress sites
💡 Tips
Error Handling
All examples include comprehensive error handling:
try:
result = wordpress_create_post(...)
print(f"Success: {result}")
except Exception as e:
print(f"Error: {e}")
# Log error, retry, or handle appropriately
Rate Limiting
Examples respect rate limits:
import time
for item in items:
process(item)
time.sleep(0.1) # Avoid hitting rate limits
Progress Tracking
For long-running operations:
from tqdm import tqdm
for post in tqdm(posts, desc="Processing posts"):
update_post(post)
🧪 Testing Examples
Before running on production:
- Test on staging site first
- Backup your WordPress site
- Start with small batches
- Verify results manually
📞 Support
If you encounter issues with examples:
- Check Troubleshooting Guide
- Review Getting Started
- Contact: hello@mcphub.dev