wordpress-mcp-server
by: stefans71
This MCP server let you automate interactions with Wordpress
📌Overview
Purpose: To enable seamless integration and interaction with WordPress sites using a Model Context Protocol (MCP) server.
Overview: The WordPress MCP server facilitates communication with WordPress by leveraging the WordPress REST API. It allows users to create, retrieve, and update posts efficiently via the JSON-RPC 2.0 protocol.
Key Features:
-
Create Post: Enables users to create new posts on WordPress with customizable parameters such as title, content, and status.
-
Get Posts: Allows for the retrieval of existing WordPress posts, with options to specify pagination and the number of posts per page.
-
Update Post: Provides the capability to update existing posts by modifying details like title, content, and status based on the post ID.
WordPress MCP Server
A Model Context Protocol (MCP) server for WordPress integration, compatible with Windows, macOS, and Linux.
Overview
This MCP server enables interaction with WordPress sites through the WordPress REST API. It provides tools for creating, retrieving, and updating posts using JSON-RPC 2.0 protocol.
Requirements
- Node.js 20.0.0 or higher
- WordPress site with REST API enabled
- WordPress application password for authentication
Installation
- Clone the repository
- Install dependencies:
npm install
- Build the project:
npm run build
Configuration
Add the server to your MCP settings file with environment variables for WordPress credentials:
{
"mcpServers": {
"wordpress": {
"command": "node",
"args": ["path/to/build/index.js"],
"env": {
"WORDPRESS_SITE_URL": "https://your-wordpress-site.com",
"WORDPRESS_USERNAME": "your-username",
"WORDPRESS_PASSWORD": "your-app-password"
}
}
}
}
Environment variables:
WORDPRESS_SITE_URL
: Your WordPress site URLWORDPRESS_USERNAME
: WordPress usernameWORDPRESS_PASSWORD
: WordPress application password
Alternatively, you can provide these credentials in the request parameters instead of using environment variables.
Available Methods
create_post
Creates a new WordPress post.
Parameters:
siteUrl
(optional if set in env): WordPress site URLusername
(optional if set in env): WordPress usernamepassword
(optional if set in env): WordPress application passwordtitle
: Post titlecontent
: Post contentstatus
(optional): 'draft' | 'publish' | 'private' (default: 'draft')
get_posts
Retrieves WordPress posts.
Parameters:
siteUrl
(optional if set in env): WordPress site URLusername
(optional if set in env): WordPress usernamepassword
(optional if set in env): WordPress application passwordperPage
(optional): Number of posts per page (default: 10)page
(optional): Page number (default: 1)
update_post
Updates an existing WordPress post.
Parameters:
siteUrl
(optional if set in env): WordPress site URLusername
(optional if set in env): WordPress usernamepassword
(optional if set in env): WordPress application passwordpostId
: ID of the post to updatetitle
(optional): New post titlecontent
(optional): New post contentstatus
(optional): 'draft' | 'publish' | 'private'
Security Note
For security, it is recommended to use WordPress application passwords instead of your main account password. Generate an application password in your WordPress dashboard under Users → Security → Application Passwords.
Example Usage
Using environment variables:
{
"jsonrpc": "2.0",
"id": 1,
"method": "create_post",
"params": {
"title": "My New Post",
"content": "Hello World!",
"status": "draft"
}
}
Without environment variables:
{
"jsonrpc": "2.0",
"id": 1,
"method": "create_post",
"params": {
"siteUrl": "https://your-wordpress-site.com",
"username": "your-username",
"password": "your-app-password",
"title": "My New Post",
"content": "Hello World!",
"status": "draft"
}
}
License
MIT License - See LICENSE file for details