mcp-wp-tools

christianemmanuelcreates/mcp-wp-tools

3.1

If you are the rightful owner of mcp-wp-tools 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.

This project is a Model Context Protocol (MCP) server designed for automating internal linking tasks on WordPress sites.

Tools
4
Resources
0
Prompts
0

MCP WordPress Tools Server

Overview

This project is a Model Context Protocol (MCP) server that exposes tools for working with WordPress sites via the REST API.
It is designed to handle internal linking automation tasks without relying on manual WordPress UI interaction.

The server:

  • Connects to a WordPress site using Application Password authentication.
  • Fetches and filters posts.
  • Suggests internal link targets based on keywords or hybrid strategies.
  • Inserts links directly into post content (HTML-safe).
  • Can be extended with embeddings, pillar-page logic, and more.

Requirements

  • Node.js v18+
  • npm (comes with Node.js)
  • A WordPress site with:
    • Application Passwords enabled
    • A dedicated integration user account with permission to edit posts

Installation

1. Clone or create the project folder

mkdir mcp-wp-tools
cd mcp-wp-tools

### 2. Initialize npm
npm init -y

### 3. Install dependencies
npm install @modelcontextprotocol/sdk zod axios jsdom express

### 4. Enable ES modules
npm pkg set type=module

### 5. Create the server file
Create server.js in the project root and paste in the provided server code.

## Configuration
The server does not store WordPress credentials by default.
You pass credentials (site URL, username, application password) in each MCP request from your client (e.g., n8n MCP Client node).

## Running Locally
node server.js

The server starts on port 8080 by default.

MCP endpoint:
http://localhost:8080/mcp

Health check:
http://localhost:8080/healthz

## Connecting from n8n Cloud

### 1. In n8n, add an MCP Client Tool node.
### 2. Set the MCP Server URL to:
http://<your-server-host>:8080/mcp
### 3. Choose the tools you want to expose (wp.discover, wp.get_posts, wp.suggest_links, wp.insert_links, etc.).
### 4. Trigger the workflow manually or on a schedule.

## WordPress Setup

### 1. Enable Application Passwords
WP Admin → Users → Your Profile → Application Passwords → Add New Application Password.
Copy the generated password.

### 2. Use a dedicated user account
Create a user just for MCP (e.g., mcp-bot).
Grant only the capabilities you need (e.g., Editor role).

## Development Notes

This server is built with Express for HTTP handling and the MCP SDK for tool registration.
Tools are defined with Zod schemas for input validation.
The link insertion tool uses JSDOM to safely manipulate post HTML.
Extendable: add embeddings, pillar link weighting, or advanced filtering.

## Security
Always use HTTPS in production.
Protect the server with an API key or behind a firewall/VPN.
Do not log raw credentials.
Restrict WordPress account permissions.