Skip to content

Conversation

@jack-arturo
Copy link
Contributor

Overview

This PR implements comprehensive multi-site support for the WordPress MCP server, enabling users to manage multiple WordPress installations from a single MCP server instance.

Key Features

🌐 Multi-Site Management

  • Support for up to 10 WordPress sites via numbered environment variables
  • Three new MCP tools: list_sites, get_site, test_site
  • Site-specific authentication and API client management
  • Automatic default site selection

🔧 Core Implementation

  • SiteManager Class (src/config/site-manager.ts): Centralized site configuration and client management
  • Site Management Tools (src/tools/site-management.ts): New tools for site discovery and testing
  • Enhanced WordPress Client: Updated to support site-specific requests via siteId parameter

📝 Configuration Options

  • WORDPRESS_N_URL: Site URL (required)
  • WORDPRESS_N_USERNAME: WordPress username (required)
  • WORDPRESS_N_PASSWORD: Application password (required)
  • WORDPRESS_N_ID: Custom site identifier (optional)
  • WORDPRESS_N_DEFAULT: Mark as default site (optional)
  • WORDPRESS_N_ALIASES: Comma-separated aliases (optional)

✨ Enhanced Features

  • All content and taxonomy tools now accept optional site_id parameter
  • Lazy initialization for optimal performance
  • Connection testing for individual sites
  • Backward compatible with single-site configuration

Testing

Tested with two live WordPress sites (wpfusion.com and verygoodplugins.com):

  • ✅ Site listing and discovery
  • ✅ Connection testing for both sites
  • ✅ Content retrieval from both sites using site_id parameter
  • ✅ Default site behavior (when no site_id specified)
  • ✅ Backward compatibility with existing single-site setup

Documentation Updates

  • Updated README.md with multi-site configuration examples
  • Updated CLAUDE.md with architecture and usage details
  • Updated example config files with multi-site templates
  • Added comprehensive inline documentation

Breaking Changes

None. The implementation is fully backward compatible with existing single-site configurations.

Files Changed

  • src/config/site-manager.ts (new): Site management implementation
  • src/tools/site-management.ts (new): Site management tools
  • src/wordpress.ts: Updated to use SiteManager
  • src/server.ts: Removed legacy WORDPRESS_API_URL check
  • src/tools/index.ts: Added site management tools
  • src/tools/unified-content.ts: Added site_id support to all tools
  • README.md: Multi-site documentation
  • CLAUDE.md: Technical documentation
  • claude_desktop_config.json.example: Multi-site examples

Eliminated file system-based logging in src/wordpress.ts by disabling the logToFile function and removing related imports and directory setup. It was running in every folder in Cursor and it was driving me nuts.
- Implement SiteManager for handling multiple WordPress site configurations
- Add support for numbered environment variables (WORDPRESS_1_URL, WORDPRESS_2_URL, etc.)
- Create 3 new site management tools: list_sites, get_site, test_site
- Add optional site_id parameter to all content and taxonomy tools
- Update WordPress client to use SiteManager for multi-site requests
- Add site aliases for easier site detection and targeting
- Maintain backward compatibility with single-site configuration
- Update documentation (README, CLAUDE.md) with multi-site examples
- Update example config files with multi-site setup instructions

Features:
- Support up to 10 WordPress sites from a single MCP server
- Automatic default site selection (first site or explicitly configured)
- Site-specific authentication and API client management
- Lazy initialization for optimal performance
- Connection testing for individual sites

This enhancement transforms the MCP server from single-site to multi-site
capable, allowing users to manage multiple WordPress installations from
one unified interface.
@vikasiwp
Copy link
Contributor

vikasiwp commented Oct 16, 2025

Will the previously supported single site continue to work?

@jack-arturo
Copy link
Contributor Author

It's backward compatible and doesn't change the original setup. It adds the ability to add multiple sites without spawning multiple MCP instances (which is a memory hog).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants