dmvai/wordpress-rest-mcp
If you are the rightful owner of wordpress-rest-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 dayong@mcphub.com.
A comprehensive Model Context Protocol (MCP) server for WordPress REST API with multi-site support, providing 15 specialized tools for WordPress content management, media handling, and internal linking.
🚀 WordPress MCP Server
A comprehensive Model Context Protocol (MCP) server for WordPress REST API with multi-site support, providing 15 specialized tools for WordPress content management, media handling, and internal linking.
🌟 Overview
This MCP server integrates with WordPress sites through the REST API to provide powerful content management capabilities through Claude Code. It supports multiple WordPress sites with individual authentication and offers comprehensive WordPress operations.
✨ Key Features
- 15 Specialized Tools across 5 main categories
- Multi-Site Support - Manage multiple WordPress installations
- JSON-Only Credentials - Organized credential management
- Internal Linking Tools - Create and manage internal links
- Media Management - Upload and manage media files
- Complete Content Management - Posts, pages, and site operations
- TypeScript Implementation - Type safety and better development experience
- Rate Limiting - Built-in request throttling
- WordPress Application Password Support - Secure authentication
🛠️ Available Tools
📝 Posts Management (5 tools)
| Tool | Description | Key Parameters |
|---|---|---|
wp_list_posts | List posts with filters and pagination | site, per_page, search, status, categories, tags |
wp_create_post | Create new posts | site, title, content, status, categories, tags, featured_media |
wp_update_post | Update existing posts | site, id, title, content, status, etc. |
wp_delete_post | Delete posts | site, id, force |
wp_get_post | Get single post by ID or slug | site, id, slug, context |
📄 Pages Management (3 tools)
| Tool | Description | Key Parameters |
|---|---|---|
wp_list_pages | List pages with hierarchy | site, per_page, search, parent, status |
wp_create_page | Create new pages | site, title, content, parent, menu_order |
wp_get_page | Get single page by ID or slug | site, id, slug, context |
🖼️ Media Management (3 tools)
| Tool | Description | Key Parameters |
|---|---|---|
wp_upload_media | Upload files to media library | site, filename, content (base64), title, alt_text |
wp_list_media | List media library | site, per_page, media_type, mime_type, search |
wp_get_media_url | Get media URLs for embedding | site, id, size |
🔗 Internal Linking (2 tools)
| Tool | Description | Key Parameters |
|---|---|---|
wp_create_internal_link | Create links between posts/pages | site, fromPost, toPost/toSlug, anchorText, position |
wp_update_links_in_post | Batch update multiple links | site, postId, links array |
ℹ️ Site Information (2 tools)
| Tool | Description | Key Parameters |
|---|---|---|
wp_get_site_info | Get site metadata and settings | site |
wp_search_content | Search content for linking opportunities | site, keywords, post_type, limit, context_length |
📦 Installation
Prerequisites
- Node.js 18+
- Claude Code CLI
- WordPress sites with REST API enabled (WordPress 4.7+)
- WordPress Application Passwords configured
Setup
-
Navigate to the server directory:
cd servers/wordpress-rest-mcp -
Install dependencies:
npm install -
Build the server:
npm run build
🔐 Configuration
Multi-Site Credentials
Create your credential file:
cp ../../.credentials/wordpress/sites.json.example \
../../.credentials/wordpress/sites.json
Edit the file with your WordPress sites:
{
"sites": {
"blog": {
"url": "https://mainblog.com",
"username": "admin",
"password": "your-application-password"
},
"shop": {
"url": "https://shop.example.com",
"username": "shop_admin",
"password": "shop-application-password"
},
"docs": {
"url": "https://docs.example.com",
"username": "docs_admin",
"password": "docs-application-password"
}
},
"default": "blog"
}
WordPress Application Passwords
- Go to your WordPress admin dashboard
- Navigate to Users > Profile
- Scroll to Application Passwords section
- Create a new application password
- Copy the generated password (format:
xxxx xxxx xxxx xxxx) - Use this password in your sites.json file
MCP Configuration
Add to your Claude Code MCP configuration:
{
"mcpServers": {
"wordpress": {
"command": "node",
"args": [
"<project-root>/servers/wordpress-rest-mcp/dist/index.js"
],
"cwd": "<project-root>/servers/wordpress-rest-mcp"
}
}
}
🚀 Usage Examples
Basic Operations
// List recent posts from default site
wp_list_posts({ per_page: 10, status: "publish" })
// Create a new post on the "blog" site
wp_create_post({
site: "blog",
title: "My New Post",
content: "This is the post content...",
status: "publish"
})
// Upload an image to the "shop" site
wp_upload_media({
site: "shop",
filename: "product.jpg",
content: "base64-encoded-image-data",
title: "Product Image"
})
Internal Linking
// Create internal link between posts
wp_create_internal_link({
site: "blog",
fromPost: 123,
toPost: 456,
anchorText: "Related Article",
position: "after_paragraph_2"
})
// Search for content to link to
wp_search_content({
site: "blog",
keywords: "WordPress tutorial",
post_type: "post",
limit: 5
})
Multi-Site Management
// Get info from different sites
wp_get_site_info({ site: "blog" }) // Main blog
wp_get_site_info({ site: "shop" }) // Shop site
wp_get_site_info({ site: "docs" }) // Documentation
// Create posts on specific sites
wp_create_post({ site: "blog", title: "Blog Post", ... })
wp_create_post({ site: "shop", title: "Product Page", ... })
🔧 Development
Running in Development
npm run dev
Building
npm run build
Testing
npm run start
📁 Project Structure
servers/wordpress-rest-mcp/
├── README.md # This file
├── PLAN.md # Implementation plan
├── package.json # Dependencies
├── tsconfig.json # TypeScript config
├── src/
│ ├── index.ts # Main MCP server
│ ├── handlers/
│ │ ├── base.ts # Base handler class
│ │ ├── posts.ts # Posts management
│ │ ├── pages.ts # Pages management
│ │ ├── media.ts # Media management
│ │ ├── links.ts # Internal linking
│ │ └── site.ts # Site information
│ └── types/
│ └── index.ts # WordPress types
└── dist/ # Compiled JavaScript
🔒 Security Notes
- Never commit credential files - The
.credentials/directory is gitignored - Use Application Passwords only - Never use regular WordPress passwords
- Limit user permissions - Use WordPress users with appropriate role permissions
- HTTPS only - Always use HTTPS URLs for WordPress sites
🐛 Troubleshooting
Common Issues
-
Credentials not found
- Ensure
sites.jsonexists in.credentials/wordpress/ - Check file permissions and JSON syntax
- Ensure
-
Authentication failed
- Verify Application Passwords are correctly generated
- Check username and site URL are correct
- Ensure user has appropriate permissions
-
Site not found
- Check site alias in
sites.json - Verify the
defaultsite is set correctly
- Check site alias in
-
WordPress API errors
- Ensure WordPress REST API is enabled
- Check WordPress version (4.7+ required)
- Verify SSL certificates are valid
Debug Mode
Set DEBUG=1 to enable verbose logging:
DEBUG=1 npm run start
📄 License
This WordPress MCP server is part of the Claude MCP Servers project.