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.
- Overview
- Quick start
- Configuration
- Running the MCP server
- Tool catalog
- Usage patterns
- Development & testing
- Troubleshooting
- Security
- Contributing & License
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
git clone https://github.com/<you>/WordPress-MCP.git
cd WordPress-MCP
npm install
cp .env.example .env # or `copy` on Windows- Fill out
.envusing the variables listed below. - Build the TypeScript sources:
npm run build. - 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. - Launch the MCP server in stdio mode:
node build/index.js. - Point your MCP client at the executable (see Running the MCP server).
| 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.
- Log into wp-admin with the target user.
- Navigate to Users → Profile.
- Scroll to Application Passwords.
- Name it (e.g., "MCP Server") and click Add New.
- Copy the value immediately—WordPress never shows it again.
- Paste it into
.envunderWORDPRESS_APP_PASSWORD.
The server communicates over stdio, so you can embed it in any host that understands MCP.
npm run build
node build/index.jsWhen the server logs Successfully connected to WordPress site!, it is ready to accept MCP requests.
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"
}
}
}
}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 | 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.
| 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
“Could not connect to WordPress site”
- Confirm
WORDPRESS_URLincludeshttps://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 buildsucceeded andbuild/index.jsexists. - Confirm file paths use escaped backslashes on Windows.
- 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.
MIT License. Issues and pull requests are welcome—especially around new MCP workflows, additional test coverage, and documentation improvements.
{
"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.