Cloudflare Workers MCP server for WordPress REST API - 24 tools
wordpress-nodeflow-mcp
Cloudflare Workers MCP server for WordPress REST API - serverless, auto-scaling, zero memory leaks.
Features
- 24 Tools: Posts, Pages, Media, Categories, Tags, Comments, and Image Storage
- Serverless: Runs on Cloudflare Workers (300+ edge locations)
- Auto-scaling: Handles 100,000 requests/day (free tier)
- Zero Memory Leaks: Stateless architecture, no long-running processes
- Multi-tenant: Support multiple WordPress sites via headers
- MCP Protocol: JSON-RPC 2.0 over HTTP
- n8n Integration: Direct HTTP API calls
- Claude Desktop: Via supergateway (stdio transport)
Available Tools
Posts (5 tools)
wp_get_posts- List posts with filteringwp_get_post- Get single post by IDwp_create_post- Create new postwp_update_post- Update existing postwp_delete_post- Delete post
Pages (4 tools)
wp_get_pages- List pageswp_create_page- Create new pagewp_update_page- Update existing pagewp_delete_page- Delete page
Media (4 tools)
wp_get_media- List media itemswp_get_media_item- Get single media itemwp_upload_media_from_url- Upload media from URLwp_upload_media_from_base64- Upload media from base64 (n8n binary data)
Categories (4 tools)
wp_get_categories- List categorieswp_get_category- Get single category by IDwp_create_category- Create new categorywp_delete_category- Delete category
Tags (2 tools)
wp_get_tags- List tagswp_create_tag- Create new tag
Comments (4 tools)
wp_get_comments- List comments with filteringwp_approve_comment- Approve pending commentwp_spam_comment- Mark comment as spamwp_delete_comment- Delete comment
Storage (1 tool)
upload_to_imgbb- Upload image to ImgBB, get public URLs (requires API key)
Quick Start
1. Clone Repository
git clone https://github.com/<username>/wordpress-nodeflow-mcp.git
cd wordpress-nodeflow-mcp
2. Install Dependencies
npm install
3. Configure Credentials
Create .dev.vars for local development:
cp .dev.vars.example .dev.vars
Edit .dev.vars and set your WordPress credentials:
WORDPRESS_URL=https://your-wordpress-site.com
WORDPRESS_USERNAME=your_username
WORDPRESS_APP_PASSWORD=yourAppPasswordWithoutSpaces
CRITICAL: WordPress Application Password format:
- WordPress UI shows:
aBcD eFgH iJkL mNoP qRsT uVwX(with spaces) - You must use:
aBcDeFgHiJkLmNoPqRsTuVwX(without spaces)
4. Run Locally
npm run dev
Server runs at http://localhost:8787
5. Deploy to Cloudflare Workers
Set production secrets:
wrangler secret put WORDPRESS_URL
wrangler secret put WORDPRESS_USERNAME
wrangler secret put WORDPRESS_APP_PASSWORD
Deploy:
npm run deploy
🖥️ Claude Desktop Integration
See full guide: CLAUDE_DESKTOP.md
Quick Setup:
- Start local server (or use production URL)
npm run dev # Runs on http://localhost:8789
- Configure Claude Desktop
Edit config file:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
Add this:
{
"mcpServers": {
"wordpress": {
"command": "npx",
"args": [
"-y",
"@anthropic-ai/supergateway",
"--stdio",
"http://localhost:8789/mcp",
"--headers",
"x-wordpress-url=https://your-wordpress-site.com",
"--headers",
"x-wordpress-username=YOUR_USERNAME",
"--headers",
"x-wordpress-password=YOUR_APP_PASSWORD_WITHOUT_SPACES"
]
}
}
}
-
Restart Claude Desktop
-
Test: Ask Claude to "List all WordPress tools"
For production: Replace http://localhost:8789/mcp with https://wordpress-mcp.nodeflow.workers.dev/mcp
Usage
Single-Tenant Mode (Environment Variables)
Set secrets via wrangler secret put or .dev.vars:
curl -X POST https://wordpress-mcp.nodeflow.workers.dev/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "wp_get_posts",
"arguments": { "per_page": 5 }
}
}'
Multi-Tenant Mode (HTTP Headers)
Pass credentials via headers (overrides environment):
curl -X POST https://wordpress-mcp.nodeflow.workers.dev/mcp \
-H "Content-Type: application/json" \
-H "x-wordpress-url: https://your-wordpress-site.com" \
-H "x-wordpress-username: YOUR_USERNAME" \
-H "x-wordpress-password: YOUR_APP_PASSWORD_WITHOUT_SPACES" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "wp_create_post",
"arguments": {
"title": "Test Post",
"content": "This is a test post from MCP",
"status": "draft"
}
}
}'
MCP Protocol
1. Initialize
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05"
}
}
2. List Tools
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list",
"params": {}
}
3. Call Tool
{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "wp_get_posts",
"arguments": {
"per_page": 10,
"status": "publish"
}
}
}
Integration with n8n
- Add HTTP Request node
- Set Method:
POST - Set URL:
https://wordpress-mcp.nodeflow.workers.dev/mcp - Set Headers (multi-tenant):
Content-Type: application/jsonx-wordpress-url: https://your-site.comx-wordpress-username: your_usernamex-wordpress-password: yourAppPasswordWithoutSpaces
- Set Body (JSON):
{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "wp_create_post", "arguments": { "title": "{{$json.title}}", "content": "{{$json.content}}", "status": "draft" } } }
WordPress Setup
1. Create Application Password
- Go to WordPress Admin → Users → Profile
- Scroll to Application Passwords
- Enter name (e.g., "MCP Server")
- Click Add New Application Password
- Copy password and remove all spaces
2. Enable REST API
WordPress REST API is enabled by default. Test it:
curl https://your-site.com/wp-json/wp/v2/posts
Architecture
n8n Workflow
↓ HTTP POST
Cloudflare Workers (wordpress-nodeflow-mcp)
↓ JSON-RPC 2.0
MCP Server (index.ts)
↓ Tool Routing
WordPress Client (client.ts)
↓ HTTP Basic Auth
WordPress REST API
↓
WordPress Database
Development
Type Check
npm run type-check
Run Tests
npm test
Watch Mode
npm run test:watch
Troubleshooting
401 Unauthorized
Problem: All write operations (POST/PUT/DELETE) fail with 401
Solution: Remove spaces from Application Password
- ❌ Wrong:
aBcD eFgH iJkL mNoP qRsT uVwX - ✅ Correct:
aBcDeFgHiJkLmNoPqRsTuVwX
CORS Errors
Solution: MCP server includes CORS headers by default. Check ALLOWED_ORIGINS in wrangler.toml
Tools Not Found
Solution: Call tools/list first to verify available tools
License
MIT License - see LICENSE file
Contributing
Contributions welcome! Please open issues or pull requests.
Links
- GitHub: https://github.com//wordpress-nodeflow-mcp
- Cloudflare Workers: https://workers.cloudflare.com/
- WordPress REST API: https://developer.wordpress.org/rest-api/
- MCP Protocol: https://modelcontextprotocol.io/