KuljeetSinghXDA/wordpress-mcp-server
If you are the rightful owner of wordpress-mcp-server 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.
The WordPress MCP Server is an AI-powered content management system designed to enhance WordPress sites with advanced content creation, optimization, and management capabilities.
WordPress MCP Server
AI-Powered WordPress Content Management System
A Model Context Protocol (MCP) server that provides AI-powered content creation, optimization, and management for WordPress sites using 6 specialized AI agents and 18 comprehensive tools.
🚀 Features
6 Specialized AI Agents
- Research Agent - Finds authoritative sources, creates citations
- Content Agent - Generates original, engaging content with citations
- Humanizer Agent - Reduces AI patterns, ensures originality (<30 AI score)
- SEO/GEO/AEO Agent - Meta optimization, internal linking, GEO/AEO optimization
- UI/UX Agent - Layout design, spacing, visual hierarchy
- Nexter Agent - Generates Nexter blocks with custom CSS
18 MCP Tools
Primary Tools (4)
create_post- Create AI-powered blog postscreate_page- Create AI-powered pagesupdate_post- Update existing posts with AI refinementupdate_page- Update existing pages with AI refinement
Refinement Tools (7)
refine_content- Refine text content in specific blocksrefine_layout- Improve visual layout and spacingrefine_block- Regenerate specific Nexter blocksadd_to_section- Add content to existing sectionsremove_from_section- Remove content from sectionsreorder_blocks- Reorder blocks for better flowfix_visual_issue- Fix spacing, alignment, responsiveness
Retrieval Tools (4)
get_post- Retrieve post by IDsearch_posts- Search posts by keywordslist_posts- List recent postsget_post_structure- Get post structure as block tree
Utility Tools (3)
validate_request- Pre-validate create/update requestscompare_revisions- Compare post versionsrollback_to_revision- Rollback to previous version
Advanced Features
- ✅ CSV Keywords Prompt - Load keywords from CSV for targeted content
- ✅ Citations & Research - Automatic source finding and citation integration
- ✅ Internal Linking - Smart internal link suggestions and integration
- ✅ Originality Focus - AI humanizer reduces AI detection (<30 score)
- ✅ GEO Optimization - Generative Engine Optimization (AI search engines)
- ✅ AEO Optimization - Answer Engine Optimization (featured snippets)
- ✅ Nexter Blocks - 90+ advanced WordPress blocks with custom CSS
- ✅ Block Processing - Non-destructive editing with validation
- ✅ Multi-Provider AI - Support for OpenAI, Anthropic, Google, Groq via LiteLLM
- ✅ Google Search Integration - Via g-search-mcp service
- ✅ Docker Deployment - Containerized services with health checks
📋 Table of Contents
- Prerequisites
- Installation
- Configuration
- Usage
- API Documentation
- Architecture
- Deployment
- Development
- Troubleshooting
- Contributing
- License
🔧 Prerequisites
- Node.js 18+ and npm
- Docker and Docker Compose (for containerized deployment)
- WordPress site with:
- REST API enabled
- Application Password for authentication
- Nexter blocks plugin (optional, for advanced blocks)
- AI Provider API Keys (at least one):
- OpenAI API key (
OPENAI_API_KEY) - Anthropic API key (
ANTHROPIC_API_KEY) - Google API key (
GOOGLE_API_KEY) - Groq API key (
GROQ_API_KEY)
- OpenAI API key (
📦 Installation
Option 1: Docker (Recommended)
# Clone the repository
git clone https://github.com/KuljeetSinghXDA/wordpress-mcp-server.git
cd wordpress-mcp-server
# Copy environment file
cp .env.example .env
# Edit .env with your credentials
nano .env
# Start services
docker-compose up -d
Option 2: Local Development
# Clone the repository
git clone https://github.com/KuljeetSinghXDA/wordpress-mcp-server.git
cd wordpress-mcp-server
# Install dependencies
npm install
# Copy environment file
cp .env.example .env
# Edit .env with your credentials
nano .env
# Build TypeScript
npm run build
# Start the MCP server
npm start
⚙️ Configuration
1. WordPress Setup
Create an Application Password in WordPress:
- Go to Users → Profile
- Scroll to Application Passwords
- Enter a name (e.g., "MCP Server")
- Click Add New Application Password
- Copy the generated password (format:
xxxx xxxx xxxx xxxx xxxx xxxx)
2. Environment Variables
Edit .env file:
# WordPress Configuration
WP_SITE_URL=https://yoursite.com
WP_USERNAME=admin
WP_APP_PASSWORD=xxxx xxxx xxxx xxxx xxxx xxxx
# AI Models (User Configurable)
LITELLM_MODEL_CONTENT=gpt-4
LITELLM_MODEL_RESEARCH=gpt-4
LITELLM_MODEL_HUMANIZER=gpt-4
LITELLM_MODEL_SEO=gpt-4
LITELLM_MODEL_UIUX=gpt-3.5-turbo
LITELLM_MODEL_NEXTER=gpt-4
# AI Provider Keys (Set at least one)
OPENAI_API_KEY=sk-proj-xxxxxxxxxxxxxxxxxxxxx
ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxxxxxxxxxx
GOOGLE_API_KEY=xxxxxxxxxxxxxxxxxxxxx
GROQ_API_KEY=gsk_xxxxxxxxxxxxxxxxxxxxx
3. Feature Flags
Customize features in .env:
ENABLE_RESEARCH_AGENT=true
ENABLE_WEB_SEARCH=true
ENABLE_CITATIONS=true
ENABLE_AI_HUMANIZER=true
ENABLE_GEO_OPTIMIZATION=true
ENABLE_AEO_OPTIMIZATION=true
ENABLE_NEXTER_CHECK=true
🎯 Usage
Creating a Post
{
"tool": "create_post",
"arguments": {
"title": "10 Best AI Tools for Content Creation",
"topic": "AI tools for content writers and marketers",
"tone": "professional",
"word_count": 1500,
"keywords": ["AI tools", "content creation", "copywriting"],
"enable_research": true,
"enable_citations": true,
"enable_internal_links": true,
"status": "draft"
}
}
Updating a Post
{
"tool": "update_post",
"arguments": {
"post_id": 123,
"instructions": "Add a section about GPT-4 and improve SEO",
"preserve_existing": true
}
}
Refining Content
{
"tool": "refine_content",
"arguments": {
"post_id": 123,
"block_id": "tpgb-abc123",
"instructions": "Make this paragraph more engaging and add statistics"
}
}
CSV Keywords Example
{
"tool": "create_post",
"arguments": {
"title": "Complete Guide to SEO",
"csv_keywords": "keyword,search_volume\nSEO tools,10000\nbacklink checker,5000\nkeyword research,8000",
"topic": "SEO tools and techniques",
"enable_research": true
}
}
📚 API Documentation
Tool: create_post
Create an AI-powered blog post with research, citations, and optimization.
Parameters:
{
title: string; // Post title
topic: string; // Content topic/brief
tone?: string; // professional|casual|friendly|formal
word_count?: number; // Target word count (default: 1200)
keywords?: string[]; // Target keywords
csv_keywords?: string; // CSV format: "keyword,volume"
enable_research?: boolean; // Enable research agent (default: true)
enable_citations?: boolean; // Add citations (default: true)
enable_internal_links?: boolean; // Add internal links (default: true)
enable_humanizer?: boolean; // Run humanizer (default: true)
status?: string; // publish|draft|pending (default: draft)
categories?: number[]; // Category IDs
tags?: number[]; // Tag IDs
}
Response:
{
success: boolean;
post_id: number;
post_url: string;
ai_score?: number; // AI detection score (lower is better)
citations_count?: number;
internal_links_count?: number;
blocks_count: number;
seo_score?: {
title_optimized: boolean;
description_optimized: boolean;
geo_optimized: boolean;
aeo_optimized: boolean;
};
}
Tool: update_post
Update existing post with AI refinement.
Parameters:
{
post_id: number; // Post ID to update
instructions: string; // Update instructions
preserve_existing?: boolean; // Keep existing blocks (default: true)
enable_humanizer?: boolean; // Run humanizer (default: true)
status?: string; // Update status (optional)
}
Tool: refine_content
Refine specific text content in blocks.
Parameters:
{
post_id: number; // Post ID
block_id: string; // Block ID (e.g., "tpgb-abc123")
instructions: string; // Refinement instructions
}
Tool: get_post_structure
Get post structure as block tree.
Parameters:
{
post_id: number; // Post ID
}
Response:
{
post_id: number;
title: string;
blocks: Array<{
block_id: string;
block_name: string;
block_type: string;
attributes: Record<string, any>;
inner_blocks: Array<...>;
}>;
blocks_count: number;
nexter_blocks_count: number;
}
🏗️ Architecture
System Overview
┌─────────────────────────────────────────────────────────────┐
│ MCP Client (Claude) │
└───────────────────────────┬─────────────────────────────────┘
│ MCP Protocol
┌───────────────────────────▼─────────────────────────────────┐
│ WordPress MCP Server │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ 18 MCP Tools (Primary, Refinement, Retrieval) │ │
│ └────────────────────┬─────────────────────────────────┘ │
│ ┌────────────────────▼─────────────────────────────────┐ │
│ │ 6 AI Agents (Research, Content, Humanizer, etc.) │ │
│ └────────────────────┬─────────────────────────────────┘ │
│ ┌────────────────────▼─────────────────────────────────┐ │
│ │ Block Engine (Parser, Serializer, Validator) │ │
│ └────────────────────┬─────────────────────────────────┘ │
└───────────────────────┼─────────────────────────────────────┘
│
┌───────────────┼───────────────┐
│ │ │
┌────▼────┐ ┌────▼────┐ ┌────▼────┐
│WordPress│ │LiteLLM │ │ Google │
│REST API │ │(AI) │ │ Search │
└─────────┘ └─────────┘ └─────────┘
Component Details
1. Block Processing Engine
-
Parser (
src/blocks/parser.ts)- Uses WordPress block-serialization-spec-parser
- Parses block comments to structured objects
- Helper functions: extractBlockIds, findBlockById, countBlocks
-
Serializer (
src/blocks/serializer.ts)- Converts parsed blocks back to WordPress format
- Block manipulation: createBlock, insertBlockAt, removeBlockById
- Non-destructive editing support
-
Validator (
src/blocks/validator.ts)- Validates block structure against WordPress/Nexter rules
- Nexter blocks MUST have
block_id(pattern:tpgb-[a-z0-9]+) - Validates JSON-serializability, nested blocks, duplicate IDs
2. WordPress REST API Client
- Client (
src/wordpress/client.ts)- Basic auth with Application Passwords
- Methods: createPost, updatePost, getPost, getPosts, searchPosts
- Retry logic with exponential backoff
- Error handling for 401, 403, 404, 429, 500 status codes
3. LiteLLM Integration
- Client (
src/ai/litellm.ts)- Unified interface to 100+ AI providers
- Configurable models per agent type
- Temperature and max_tokens per agent
- Environment-based API key selection
4. AI Agents
- ResearchAgent - Finds authoritative sources, creates citations
- ContentAgent - Generates original content with citations
- HumanizerAgent - Reduces AI patterns (<30 AI score)
- SEOAgent - Meta optimization, GEO/AEO, internal linking
- UIUXAgent - Layout design, spacing, visual hierarchy
- NexterAgent - Generates Nexter blocks with custom CSS
🚢 Deployment
Docker Compose
The docker-compose.yml includes:
- wordpress-mcp-server - Main MCP server
- g-search-mcp - Google Search integration
# Start services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down
# Restart services
docker-compose restart
Health Checks
Both services include health checks:
- wordpress-mcp-server: HTTP check on port 3000
- g-search-mcp: HTTP check on port 3001
Environment Variables in Docker
The .env file is automatically loaded by Docker Compose.
💻 Development
Project Structure
wordpress-mcp-server/
├── src/
│ ├── blocks/ # Block processing engine
│ │ ├── parser.ts # WordPress block parser
│ │ ├── serializer.ts # Block serializer
│ │ └── validator.ts # Block validator
│ ├── wordpress/ # WordPress REST API
│ │ └── client.ts # WordPress client
│ ├── ai/ # AI integration
│ │ ├── litellm.ts # LiteLLM client
│ │ └── agents.ts # 6 AI agents
│ ├── tools/ # MCP tools
│ │ └── mcp-tools.ts # 18 MCP tools
│ └── index.ts # Entry point
├── docker-compose.yml # Docker services
├── .env.example # Environment template
├── package.json # Dependencies
├── tsconfig.json # TypeScript config
└── README.md # This file
Build Commands
# Install dependencies
npm install
# Build TypeScript
npm run build
# Start development server
npm run dev
# Start production server
npm start
# Run tests
npm test
# Lint code
npm run lint
Adding New Tools
- Define tool schema in
src/tools/mcp-tools.ts - Implement tool handler function
- Register tool in MCP server
- Update documentation
Adding New Agents
- Create agent class in
src/ai/agents.ts - Configure LiteLLM model in
.env - Integrate agent in tool workflow
- Update documentation
🔍 Troubleshooting
WordPress Authentication Failed (401)
Solution:
- Verify Application Password format (with spaces)
- Check username is correct
- Ensure REST API is enabled
- Test credentials:
curl -u username:password https://yoursite.com/wp-json/wp/v2/posts
AI Provider Error
Solution:
- Verify API key is correct
- Check API key has sufficient credits
- Ensure correct model name (e.g.,
gpt-4notgpt4) - Test with different provider
Block Validation Failed
Solution:
- Check Nexter blocks have
block_idattribute - Verify block_id format:
tpgb-[a-z0-9]+ - Ensure no duplicate block IDs
- Validate JSON serializability
Docker Container Won't Start
Solution:
- Check
.envfile exists and has correct format - Verify port 3000 and 3001 are available
- Check Docker logs:
docker-compose logs - Rebuild containers:
docker-compose up --build
High AI Detection Score
Solution:
- Enable humanizer:
ENABLE_AI_HUMANIZER=true - Increase temperature:
TEMPERATURE_HUMANIZER=0.9 - Use different model for humanizer
- Run humanizer multiple times
🤝 Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Guidelines
- Follow TypeScript best practices
- Add tests for new features
- Update documentation
- Use meaningful commit messages
- Keep code DRY and modular
📄 License
This project is licensed under the MIT License - see the file for details.
🙏 Acknowledgments
- WordPress REST API
- LiteLLM - Unified AI provider interface
- Model Context Protocol - MCP specification
- Nexter - Advanced WordPress blocks
- Google Search MCP - Search integration
📞 Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: kspalahyia@gmail.com
🗺️ Roadmap
- Add support for custom post types
- Implement image generation and optimization
- Add multilingual support
- Create web dashboard for monitoring
- Add analytics and reporting
- Implement batch processing
- Add support for WooCommerce
- Create WordPress plugin version
Made with ❤️ by KuljeetSinghXDA
⭐ Star this repo if you find it helpful!