Skip to content

Bring your WordPress site into any Model Context Protocol (MCP) workflow. This TypeScript server lets local-first LLM agents create, edit, and organize WordPress content through natural language prompts.

Notifications You must be signed in to change notification settings

NemesisGuy/WordPress-MCP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WordPress MCP Server

Bring your WordPress site into any Model Context Protocol (MCP) workflow. This TypeScript server lets local-first LLM agents create, edit, and organize WordPress content through natural language prompts.

Table of contents

  1. Overview
  2. Quick start
  3. Configuration
  4. Running the MCP server
  5. Tool catalog
  6. Usage patterns
  7. Development & testing
  8. Troubleshooting
  9. Security
  10. Contributing & License

Overview

The WordPress MCP Server exposes curated REST actions as MCP tools so any compatible client (Claude Desktop, VS Code MCP plug-ins, custom shells) can manage content through voice or text automations. Use it to draft posts, update landing pages, or clean up categories without touching wp-admin.

Highlights

  • Full CRUD coverage for posts, pages, categories, and tags
  • Secure authentication powered by WordPress Application Passwords
  • Type-safe implementation with shared interfaces across client and server
  • Works with any MCP host over stdio; no network port exposure required
  • Ships with smoke-test scripts and troubleshooting guidance so you can validate locally before connecting a client

Quick start

git clone https://github.com/<you>/WordPress-MCP.git
cd WordPress-MCP
npm install
cp .env.example .env   # or `copy` on Windows
  1. Fill out .env using the variables listed below.
  2. Build the TypeScript sources: npm run build.
  3. Run a quick sanity check: node test-create-post.js. This script drops a draft post so you know auth and REST connectivity are good.
  4. Launch the MCP server in stdio mode: node build/index.js.
  5. Point your MCP client at the executable (see Running the MCP server).

Configuration

Environment variables

Variable Description Example
WORDPRESS_URL Base URL to your WordPress site (must include protocol). https://example.com
WORDPRESS_USERNAME WordPress user that generated the Application Password. editor_bot
WORDPRESS_APP_PASSWORD Application Password copied from wp-admin (WordPress 5.6+). xxxx xxxx xxxx xxxx xxxx xxxx

Keep the space-separated format for Application Passwords. WordPress rejects tokens if you remove the spaces.

Creating an Application Password

  1. Log into wp-admin with the target user.
  2. Navigate to Users → Profile.
  3. Scroll to Application Passwords.
  4. Name it (e.g., "MCP Server") and click Add New.
  5. Copy the value immediately—WordPress never shows it again.
  6. Paste it into .env under WORDPRESS_APP_PASSWORD.

Running the MCP server

The server communicates over stdio, so you can embed it in any host that understands MCP.

Direct CLI

npm run build
node build/index.js

When the server logs Successfully connected to WordPress site!, it is ready to accept MCP requests.

Claude Desktop

Add the configuration to claude_desktop_config.json and restart Claude Desktop:

{
  "mcpServers": {
    "wordpress": {
      "command": "node",
      "args": ["C:\\Users\\YourUsername\\Projects\\WordPress-MCP\\build\\index.js"],
      "env": {
        "WORDPRESS_URL": "https://your-site.com",
        "WORDPRESS_USERNAME": "your-username",
        "WORDPRESS_APP_PASSWORD": "xxxx xxxx xxxx xxxx xxxx xxxx"
      }
    }
  }
}

IDE + MCP tooling

VS Code (and other IDEs with MCP support) can reference the repository directly. See IDE_SETUP.md for a full walk-through tailored to this project, including a working example that also connects to the local VibeType agent.

Tool catalog

Tool Purpose Required fields Helpful options
wordpress_create_post Draft or publish a post title, content status, excerpt, categories, tags
wordpress_get_post Fetch a specific post id
wordpress_list_posts List posts with filters page, per_page, search, status, order, orderby
wordpress_update_post Update an existing post id title, content, status, excerpt, categories, tags, slug

You can speak or type natural-language prompts once the server is registered with your MCP client:

  • “Create a draft WordPress post titled ‘Hello World’ with content ‘This is my first post.’”
  • “Update WordPress post 123 and change its status to publish.”
  • “Update WordPress post 123 and set its slug to ‘hello-world-post’.”
  • “Upload a PNG image and attach as the featured image to post 123.”
  • “List the five most recent WordPress posts.”
  • “Create a new WordPress page called ‘About Us’ that summarizes our company.”
  • “Update WordPress page 42 and set its slug to ‘about-us-company’.”
  • “List all WordPress categories and tags so I can clean up duplicates.”

The included script test-create-post.js is another quick sanity check. After running npm run build, execute node test-create-post.js to create a draft titled “Second Test Post via MCP Server 🤖”. For upload testing, try node test-upload-media.js path/to/image.png <postId> to upload and (optionally) attach to a post as featured media.

Development & testing

Command Description
npm run build Compile TypeScript sources in src/ to build/.
npm run watch Rebuild on file changes for faster iteration.
node build/index.js Start the MCP server after building.
node test-create-post.js Smoke-test connectivity by creating a draft post.

Project layout:

src/                  # TypeScript sources and tool implementations
build/                # Compiled JS artifacts consumed by MCP hosts
docs/ (optional)      # Additional guides and blog content
IDE_SETUP.md          # IDE-specific MCP instructions
test-create-post.js   # Manual smoke test script

Troubleshooting

“Could not connect to WordPress site”

  • Confirm WORDPRESS_URL includes https:// and resolves from your machine.
  • Verify the REST API endpoint https://your-site.com/wp-json/wp/v2/ responds.
  • Check for firewalls or plugins that block Application Password requests.

“401 Unauthorized”

  • Double-check the username matches the Application Password issuer.
  • Regenerate the Application Password and update .env.
  • Keep the spaces in the password; WordPress expects them.

“Tool not found” inside an MCP client

  • Restart the client after editing its configuration.
  • Ensure npm run build succeeded and build/index.js exists.
  • Confirm file paths use escaped backslashes on Windows.

Security

  • Do not commit .env; it is ignored by default.
  • Revoke Application Passwords from wp-admin if a device is lost.
  • Prefer HTTPS for all remote WordPress instances so credentials never traverse plaintext.

Contributing & License

MIT License. Issues and pull requests are welcome—especially around new MCP workflows, additional test coverage, and documentation improvements.

Tested config on VS Code

{
  "servers": {
    "wordpress": {
      "command": "node",
      "args": [
        "C:\\Users\\<YourUser>\\Projects\\WordPress-MCP\\build\\index.js"
      ],
      "cwd": "C:\\Users\\<YourUser>\\Projects\\WordPress-MCP"
    }
  },
  "inputs": []
}

Replace <YourUser> with the Windows username or adjust the entire path if you keep the repository elsewhere.

About

Bring your WordPress site into any Model Context Protocol (MCP) workflow. This TypeScript server lets local-first LLM agents create, edit, and organize WordPress content through natural language prompts.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published