silham/wp-mulitisite-manager-mcp
If you are the rightful owner of wp-mulitisite-manager-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A Model Context Protocol (MCP) server for managing multiple WordPress sites simultaneously.
WordPress Multi-Site MCP Server
A Model Context Protocol (MCP) server for managing multiple WordPress sites simultaneously.
Features
Multi-Site Support
- Configure and manage multiple WordPress sites from environment variables
- Each site has independent authentication and configuration
- Easy site switching in tool calls
Available Tools
- get_available_sites() - List all configured WordPress sites
- get_post_by_id(site_name, post_id) - Fetch a specific post
- get_recent_posts(site_name, count) - Get recent posts from a site
- search_posts(site_name, search_term, count) - Search posts on a site
- get_post_categories(site_name) - Get all categories from a site
- get_posts_by_category(site_name, category_id, count) - Get posts by category
Available Resources
- sites://list - Display formatted list of all configured sites
Setup
1. Configure WordPress Sites
Edit .env
file to add your WordPress sites:
# Site 1
SITE_GOOGLERANK_URL=https://googlerank.com.au
SITE_GOOGLERANK_USER=goto@digifix.com.au
SITE_GOOGLERANK_APP_PASSWORD=iUGn XOkL QPvs q6jv CCI1 xWAd
# Site 2
# WordPress Multi-Site MCP Server
A powerful Model Context Protocol (MCP) server that provides Claude AI with comprehensive access to multiple WordPress sites via their REST API. Supports full CRUD operations on posts, pages, categories, tags, users, comments, and more.
## ๐ Features
- **Multi-Site Support** - Manage multiple WordPress sites from a single MCP server
- **Complete REST API Coverage** - 30+ tools for all major WordPress operations
- **Full CRUD Operations** - Create, Read, Update, Delete for posts, pages, tags, categories, users, comments
- **Secure Authentication** - Token-based authentication for server access
- **Remote Deployment** - HTTP/SSE transport for hosting on remote servers
- **Flexible Credentials** - Store WordPress credentials on server or in Claude config
- **Health Monitoring** - Built-in health checks and status endpoints
## ๐ Quick Start
### Local Development
1. **Clone and Install**
```bash
git clone https://github.com/silham/learn-mcp.git
cd mcp-server-demo
cp .env.example .env
# Edit .env with your WordPress credentials
-
Configure WordPress Sites
# Generate auth token openssl rand -hex 32 # Add to .env MCP_AUTH_TOKEN=your-generated-token SITE_MYSITE_URL=https://example.com SITE_MYSITE_USER=admin@example.com SITE_MYSITE_APP_PASSWORD=xxxx xxxx xxxx xxxx
-
Install in Claude
uv run mcp install main.py --with requests --with python-dotenv --env-file .env
Remote Deployment
See for deploying to Coolify or any Docker host.
๐ Documentation
- - Deploy to Coolify in 3 steps
- - Security setup and credential management
- - Comprehensive deployment guide
- - Environment variable template
- - Claude config template
๐ Security
Two-Level Authentication
- MCP Server Auth - Controls access to the MCP server
- WordPress Auth - Individual site credentials (Application Passwords)
Credential Configuration Options
Option A: Server-Side (Simpler)
# .env file
MCP_AUTH_TOKEN=your-token
SITE_MYSITE_URL=https://example.com
SITE_MYSITE_USER=admin@example.com
SITE_MYSITE_APP_PASSWORD=xxxx xxxx
Option B: Client-Side (More Secure - Recommended)
{
"mcpServers": {
"wordpress": {
"url": "https://mcp.yourdomain.com/sse",
"headers": {
"Authorization": "Bearer your-token"
},
"env": {
"SITE_MYSITE_URL": "https://example.com",
"SITE_MYSITE_USER": "admin@example.com",
"SITE_MYSITE_APP_PASSWORD": "xxxx xxxx"
}
}
}
}
See for complete security guide.
๐ ๏ธ Available Tools
Site Management
get_available_sites
- List all configured WordPress sitesget_site_info
- Get WordPress version and site information
Posts
get_posts
/get_post
- Retrieve posts with filteringget_posts_summary
- Lightweight post overviewcreate_post
- Create new postsupdate_post
- Update existing postsdelete_post
- Delete posts
Pages
get_pages
/get_page
- Retrieve pagescreate_page
- Create new pagesupdate_page
- Update existing pagesdelete_page
- Delete pages
Categories & Tags
get_categories
/get_category
- Manage categoriescreate_category
/update_category
/delete_category
get_tags
/get_tag
- Manage tagscreate_tag
/update_tag
/delete_tag
Users
get_users
/get_user
/get_current_user
create_user
/update_user
/delete_user
Comments
get_comments
/get_comment
create_comment
/update_comment
/delete_comment
Media
get_media
/get_media_item
- Browse and retrieve media
See full list with get_available_sites
tool in Claude.
๐ Architecture
โโโโโโโโโโโโโโโโโโโ
โ Claude AI โ
โ (MCP Client) โ
โโโโโโโโโโฌโโโโโโโโโ
โ SSE/HTTP or stdio
โ
โโโโโโโโโโผโโโโโโโโโโโโโ
โ MCP Server (This) โ
โ - Authentication โ
โ - Multi-site mgmt โ
โ - 30+ WP tools โ
โโโโโโโโโโฌโโโโโโโโโโโโโ
โ REST API
โ
โโโโโโโโโโผโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ WordPress Site 1โ โ WP Site 2 โ โ WP Site N โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
๐ง Configuration
Environment Variables
Server Authentication:
MCP_AUTH_TOKEN=your-secure-token # Optional but recommended for production
WordPress Sites (repeat for each site):
SITE_<NAME>_URL=https://example.com
SITE_<NAME>_USER=username@example.com
SITE_<NAME>_APP_PASSWORD=xxxx xxxx xxxx xxxx
How to get WordPress Application Password:
- WordPress Admin โ Users โ Profile
- Scroll to "Application Passwords"
- Create new password with name "MCP Server"
- Copy generated password
Claude Desktop Config
Local (stdio):
{
"mcpServers": {
"wordpress": {
"command": "uv",
"args": ["run", "main.py"],
"cwd": "/path/to/mcp-server-demo",
"env": {
"SITE_MYSITE_URL": "https://example.com",
"SITE_MYSITE_USER": "admin@example.com",
"SITE_MYSITE_APP_PASSWORD": "xxxx xxxx"
}
}
}
}
Remote (SSE):
{
"mcpServers": {
"wordpress-remote": {
"url": "https://mcp.yourdomain.com/sse",
"transport": "sse",
"headers": {
"Authorization": "Bearer your-auth-token"
},
"env": {
"SITE_MYSITE_URL": "https://example.com",
"SITE_MYSITE_USER": "admin@example.com",
"SITE_MYSITE_APP_PASSWORD": "xxxx xxxx"
}
}
}
}
๐งช Testing
Health Check
curl https://mcp.yourdomain.com/health
SSE Connection (with auth)
curl -H "Authorization: Bearer YOUR_TOKEN" https://mcp.yourdomain.com/sse
Local Server
./start.sh
# or
uv run python server_http.py
๐ณ Docker Deployment
# Build
docker build -t wordpress-mcp .
# Run
docker run -p 8000:8000 --env-file .env wordpress-mcp
# Docker Compose
docker-compose up -d
๐ Project Structure
mcp-server-demo/
โโโ main.py # MCP server core with all tools
โโโ server_http.py # HTTP/SSE wrapper for remote access
โโโ pyproject.toml # Python dependencies
โโโ .env # Environment config (not in git)
โโโ .env.example # Template
โโโ Dockerfile # Container definition
โโโ docker-compose.yml # Container orchestration
โโโ start.sh # Local server startup script
โโโ README.md # This file
โโโ QUICKSTART_DEPLOYMENT.md # Quick deployment guide
โโโ AUTHENTICATION.md # Security documentation
โโโ DEPLOYMENT.md # Comprehensive deployment guide
โโโ claude_desktop_config.example.json # Claude config template
๐ค Contributing
Contributions welcome! This is a learning project demonstrating MCP capabilities.
๐ License
MIT License - feel free to use and modify.
๐ Acknowledgments
- Built with Model Context Protocol (MCP)
- Uses FastMCP framework
- WordPress REST API v2
๐ Support
- Check documentation in AUTHENTICATION.md and DEPLOYMENT.md
- Review example configs
- Test with health endpoints
- Check server logs for errors
๐ Version
Version: 1.0.0
Last Updated: October 2025
MCP Protocol: 2024-11-05
Add as many sites as needed...
**Environment Variable Pattern:**
- `SITE_<NAME>_URL` - WordPress site URL
- `SITE_<NAME>_USER` - WordPress username
- `SITE_<NAME>_APP_PASSWORD` - WordPress Application Password
**Site Name Rules:**
- Can be any alphanumeric string with underscores
- Will be converted to lowercase for use in tools
- Example: `SITE_GOOGLERANK` becomes `googlerank`
### 2. Generate WordPress Application Passwords
For each WordPress site:
1. Log into WordPress admin
2. Go to **Users โ Your Profile**
3. Scroll to **Application Passwords** section
4. Enter a name (e.g., "MCP Server")
5. Click **Add New Application Password**
6. Copy the generated password (spaces included)
7. Add to your `.env` file
### 3. Install the MCP Server
```bash
cd /Users/shakil/Dev/learn/mcp/mcp-server-demo
uv run mcp install main.py --with requests --with python-dotenv --env-file .env
Important: Always include:
--with requests
- HTTP client--with python-dotenv
- Environment variable loading--env-file .env
- Path to your environment file
4. Restart Claude
- Completely quit Claude (Cmd+Q)
- Restart Claude
- The server should appear as "WordPress Multi-Site Manager"
Usage Examples
In Claude
Once connected, you can use the MCP tools:
List all configured sites:
Use the get_available_sites tool
Get recent posts from a specific site:
Get the 5 most recent posts from googlerank
Search for posts:
Search for posts about "SEO" on googlerank site
Get categories:
Show me all categories on the googlerank site
Local Testing
Test the server locally before using in Claude:
# Test basic functionality
uv run python main.py
# Test specific functions
uv run python -c "
from main import get_available_sites, get_recent_posts
sites = get_available_sites()
print('Sites:', sites)
if sites:
posts = get_recent_posts(sites[0]['name'], 3)
print(f'Posts: {len(posts)}')
"
Adding More Sites
- Edit
.env
file - Add new site following the pattern:
SITE_NEWSITE_URL=https://newsite.com SITE_NEWSITE_USER=user@newsite.com SITE_NEWSITE_APP_PASSWORD=xxxx xxxx xxxx xxxx
- Restart Claude (the .env file is loaded when the server starts)
No need to reinstall the MCP server - just restart Claude to pick up new sites.
Tool Reference
get_available_sites()
Returns list of all configured sites with their details.
Returns:
[
{
"name": "googlerank",
"url": "https://googlerank.com.au",
"api_base": "https://googlerank.com.au/wp-json/wp/v2"
}
]
get_post_by_id(site_name, post_id)
Fetch a specific post by ID.
Parameters:
site_name
(str): Site name (e.g., "googlerank")post_id
(int): WordPress post ID
Returns: Full post object with title, content, metadata, etc.
get_recent_posts(site_name, count=5)
Get recent published posts.
Parameters:
site_name
(str): Site namecount
(int): Number of posts (default: 5)
Returns: List of post objects
search_posts(site_name, search_term, count=10)
Search for posts matching a term.
Parameters:
site_name
(str): Site namesearch_term
(str): Search querycount
(int): Max results (default: 10)
Returns: List of matching posts
get_post_categories(site_name)
Get all categories from a site.
Parameters:
site_name
(str): Site name
Returns: List of category objects
get_posts_by_category(site_name, category_id, count=10)
Get posts from a specific category.
Parameters:
site_name
(str): Site namecategory_id
(int): Category IDcount
(int): Number of posts (default: 10)
Returns: List of posts in the category
Troubleshooting
"No WordPress sites configured" error
Problem: The server can't find any configured sites.
Solution:
- Check
.env
file exists and has correct format - Verify environment variables follow pattern:
SITE_<NAME>_URL
, etc. - Reinstall with
--env-file .env
flag - Restart Claude
"Site 'xyz' not found" error
Problem: Requested site name doesn't match any configured site.
Solution:
- Use
get_available_sites()
to see available site names - Site names are case-insensitive and converted to lowercase
- Check
.env
for typos in site names
Authentication errors
Problem: 401 Unauthorized or authentication failures.
Solution:
- Verify Application Password is correct in
.env
- Check username is correct
- Ensure Application Passwords are enabled on the WordPress site
- Try regenerating the Application Password
Check Claude MCP Logs
tail -f ~/Library/Logs/Claude/mcp*.log
Architecture
Site Configuration (WordPressSite
class)
- Stores site credentials and URL
- Generates authentication headers
- Provides API base URL
Environment Loading (load_wordpress_sites
)
- Scans environment variables for site configurations
- Validates required fields (URL, user, password)
- Returns dictionary of configured sites
API Requests (make_wp_request
)
- Handles all WordPress REST API calls
- Supports GET and POST methods
- Automatic authentication header injection
- Error handling with meaningful messages
Security Notes
- Never commit
.env
file to git (add to.gitignore
) - Application Passwords are safer than regular passwords
- Each app password can be revoked individually
- Store credentials securely
- Use different Application Passwords for different tools
Future Enhancements
Potential features to add:
- POST/UPDATE/DELETE operations for posts
- Media upload support
- User management
- Plugin/theme information
- Site health checks
- Bulk operations across multiple sites
- Custom post type support