npm package: @mcp-forge/wordpress-mcp
Description: WordPress MCP Server for managing WordPress sites via Model Context Protocol - 19 powerful tools, no plugin required
Author: MCP Forge
Latest version: 2.1.1

# @xenflashbox/wordpress-mcp

**WordPress MCP Server** - Comprehensive WordPress integration for Model Context Protocol

## Overview

A powerful MCP server providing **18 production-ready tools** for WordPress management, including support for WooCommerce. Built with **pure REST API** - no plugin installation required!

### Key Features

- 🚀 **18 Powerful Tools** - Complete WordPress management capabilities
- 📦 **No Plugin Required** - Uses standard WordPress REST API
- 🛍️ **WooCommerce Support** - Built-in product management
- 🔒 **Secure Authentication** - Username/password or API key support
- ⚡ **ESM Native** - Modern JavaScript module system
- 🎯 **Production Ready** - Tested with real WordPress sites

## Available Tools

### Posts Management (5 tools)
- `wp_posts_list` - List posts with filtering and pagination
- `wp_posts_get` - Get specific post by ID
- `wp_posts_create` - Create new posts
- `wp_posts_update` - Update existing posts
- `wp_posts_delete` - Delete posts (trash or permanent)

### Pages Management (3 tools)
- `wp_pages_list` - List pages with filtering and pagination
- `wp_pages_get` - Get specific page by ID
- `wp_pages_create` - Create new pages

### Users Management (3 tools)
- `wp_users_list` - List users with filtering
- `wp_users_get` - Get specific user by ID
- `wp_users_me` - Get current authenticated user

### Media Management (2 tools)
- `wp_media_list` - List media items (images, videos, etc.)
- `wp_media_get` - Get specific media item by ID

### Taxonomy Management (2 tools)
- `wp_categories_list` - List categories
- `wp_tags_list` - List tags

### WooCommerce Integration (2 tools)
- `wc_products_list` - List products (requires WooCommerce)
- `wc_products_get` - Get specific product by ID

### Settings (1 tool)
- `wp_settings_get` - Get WordPress site settings

## Installation

### Method 1: NPX (Recommended for Claude Code)

Add to your `.mcp.json`:

```json
{
  "mcpServers": {
    "wordpress": {
      "command": "npx",
      "args": [
        "-y",
        "--registry=https://mcpreg.xencolabs.com",
        "@xenflashbox/wordpress-mcp@2.0.0"
      ],
      "env": {
        "WORDPRESS_BASE_URL": "https://your-site.com",
        "WORDPRESS_USERNAME": "your-username",
        "WORDPRESS_PASSWORD": "your-password"
      }
    }
  }
}
```

### Method 2: Direct Installation

```bash
npm install --registry=https://mcpreg.xencolabs.com @xenflashbox/wordpress-mcp
```

Then run:

```bash
WORDPRESS_BASE_URL="https://your-site.com" \
WORDPRESS_USERNAME="your-username" \
WORDPRESS_PASSWORD="your-password" \
npx @xenflashbox/wordpress-mcp
```

## Configuration

### Environment Variables

| Variable | Required | Description |
|----------|----------|-------------|
| `WORDPRESS_BASE_URL` | Yes | Your WordPress site URL (e.g., `https://blog.example.com`) |
| `WORDPRESS_USERNAME` | Yes* | WordPress admin username |
| `WORDPRESS_PASSWORD` | Yes* | WordPress application password |
| `WORDPRESS_API_KEY` | Yes* | Alternative to username/password |

*Either username+password OR api_key is required

### WordPress Requirements

1. **WordPress REST API** (included in WordPress 4.7+)
2. **Application Passwords** enabled (WordPress 5.6+)
3. **Admin account** or account with appropriate permissions
4. **WooCommerce plugin** (optional, for WooCommerce tools)

### Creating Application Passwords

1. Go to **Users → Profile** in WordPress admin
2. Scroll to **Application Passwords**
3. Enter a name (e.g., "MCP Server")
4. Click **Add New Application Password**
5. Copy the generated password (use this as `WORDPRESS_PASSWORD`)

## Usage Examples

### List Recent Posts

```javascript
// Tool: wp_posts_list
{
  "per_page": 10,
  "orderby": "date",
  "order": "desc"
}
```

### Create a New Post

```javascript
// Tool: wp_posts_create
{
  "title": "My New Post",
  "content": "<p>Post content here</p>",
  "status": "publish",
  "categories": [1, 5],
  "tags": [10, 20]
}
```

### Get WooCommerce Products

```javascript
// Tool: wc_products_list
{
  "per_page": 20,
  "status": "publish",
  "on_sale": true
}
```

### Get Site Settings

```javascript
// Tool: wp_settings_get
{}
```

## Architecture

### ESM Native Design

This server uses **native ES modules** for maximum compatibility with modern JavaScript tooling:

- ✅ Pure ESM in `src/index.js`
- ✅ Dynamic import for CommonJS WordPress client
- ✅ Latest MCP SDK (v1.20.0)
- ✅ No build step required

### File Structure

```
@xenflashbox/wordpress-mcp/
├── src/
│   └── index.js              # Main ESM server (18 tools)
├── dist/
│   └── generated-server/     # WordPress REST API client (CommonJS)
│       ├── package.json      # Marks as CommonJS
│       └── src/
│           ├── client.js
│           ├── resources/
│           └── ...
├── package.json              # ESM configuration
└── README.md
```

## Development

### Local Testing

1. Clone the repository
2. Install dependencies:
   ```bash
   npm install --registry=https://registry.npmjs.org @modelcontextprotocol/sdk@latest
   ```

3. Set environment variables:
   ```bash
   export WORDPRESS_BASE_URL='https://your-site.com'
   export WORDPRESS_USERNAME='your-username'
   export WORDPRESS_PASSWORD='your-app-password'
   ```

4. Run the server:
   ```bash
   node src/index.js
   ```

5. Test MCP protocol:
   ```bash
   echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node src/index.js
   ```

### Publishing

```bash
npm publish --registry=https://mcpreg.xencolabs.com
```

## Troubleshooting

### Connection Errors

**Error**: `Cannot connect to WordPress site`

**Solutions**:
- Verify `WORDPRESS_BASE_URL` is correct
- Ensure WordPress site is accessible
- Check firewall/network settings

### Authentication Errors

**Error**: `Authentication failed`

**Solutions**:
- Verify username and application password
- Ensure user has admin privileges
- Check application password is enabled in WordPress

### WooCommerce Tools Not Working

**Error**: `WooCommerce endpoint not found`

**Solutions**:
- Install and activate WooCommerce plugin
- Verify WooCommerce REST API is enabled
- Check user has WooCommerce permissions

## Version History

### v2.0.0 (Current)
- ✨ Complete ESM rewrite
- 🚀 18 production-ready tools
- 📦 No plugin required
- ⚡ Latest MCP SDK (1.20.0)
- 🛍️ WooCommerce integration
- 🔒 Enhanced authentication

### v1.0.2 (Deprecated)
- Legacy CommonJS version
- Basic WordPress functionality

## License

MIT

## Support

For issues or questions:
- GitHub: https://github.com/xenflashbox/mcp-servers
- Registry: https://mcpreg.xencolabs.com

## Credits

Built by MCP Generator Platform for the WordPress community.