
WordPress
STDIO通过自然语言操作WordPress的MCP服务器
通过自然语言操作WordPress的MCP服务器
This is a Model Context Protocol (MCP) server for WordPress, allowing you to interact with your WordPress site using natural language via an MCP-compatible client like Claude for Desktop. This server exposes various WordPress data and functionality as MCP tools.
claude_desktop_config.json.example
file.claude_desktop_config.json
file.This server currently provides tools to interact with core WordPress data:
Handles ALL content types (posts, pages, custom post types) with a single set of intelligent tools:
list_content
: List any content type with filtering and paginationget_content
: Get specific content by ID and typecreate_content
: Create new content of any typeupdate_content
: Update existing content of any typedelete_content
: Delete content of any typediscover_content_types
: Find all available content types on your sitefind_content_by_url
: Smart URL resolver that can find and optionally update content from any WordPress URLget_content_by_slug
: Search by slug across all content typesHandles ALL taxonomies (categories, tags, custom taxonomies) with a single set of tools:
discover_taxonomies
: Find all available taxonomies on your sitelist_terms
: List terms in any taxonomyget_term
: Get specific term by IDcreate_term
: Create new term in any taxonomyupdate_term
: Update existing termdelete_term
: Delete term from any taxonomyassign_terms_to_content
: Assign terms to any content typeget_content_terms
: Get all terms for any contentlist_media
: List all media items (supports pagination and searching).get_media
: Retrieve a specific media item by ID.create_media
: Create a new media item from a URL.update_media
: Update an existing media item.delete_media
: Delete a media item.list_users
: List all users with filtering, sorting, and pagination options.get_user
: Retrieve a specific user by ID.create_user
: Create a new user.update_user
: Update an existing user.delete_user
: Delete a user.list_comments
: List all comments with filtering, sorting, and pagination options.get_comment
: Retrieve a specific comment by ID.create_comment
: Create a new comment.update_comment
: Update an existing comment.delete_comment
: Delete a comment.list_plugins
: List all plugins installed on the site.get_plugin
: Retrieve details about a specific plugin.activate_plugin
: Activate a plugin.deactivate_plugin
: Deactivate a plugin.create_plugin
: Create a new plugin.search_plugins
: Search for plugins in the WordPress.org repository.get_plugin_info
: Get detailed information about a plugin from the repository.The find_content_by_url
tool can:
/documentation/
→ documentation custom post type)All content operations use a single content_type
parameter:
{ "content_type": "post", // for blog posts "content_type": "page", // for static pages "content_type": "product", // for WooCommerce products "content_type": "documentation" // for custom post types }
All taxonomy operations use a single taxonomy
parameter:
{ "taxonomy": "category", // for categories "taxonomy": "post_tag", // for tags "taxonomy": "product_category", // for WooCommerce "taxonomy": "skill" // for custom taxonomies }
You can run this MCP server directly using npx without installing it globally:
npx -y @instawp/mcp-wp
Make sure you have a .env
file in your current directory with the following variables:
WORDPRESS_API_URL=https://your-wordpress-site.com WORDPRESS_USERNAME=wp_username WORDPRESS_PASSWORD=wp_app_password
Clone the Repository:
git clone <repository_url> cd wordpress-mcp-server
Install Dependencies:
npm install
Create a .env
file:
Create a .env
file in the root of your project directory and add your WordPress API credentials:
WORDPRESS_API_URL=https://your-wordpress-site.com WORDPRESS_USERNAME=wp_username WORDPRESS_PASSWORD=wp_app_password
Replace the placeholders with your actual values.
Build the Server:
npm run build
Configure Claude Desktop:
claude_desktop_config.json
file.mcpServers
section. You will need to provide the absolute path to the build/server.js
file and your WordPress environment variables.Once you've configured Claude Desktop, the server should start automatically whenever Claude Desktop starts.
You can also run the server directly from the command line for testing:
npm start
or in development mode:
npm run dev
The server uses a unified tool architecture to reduce complexity:
src/
├── server.ts # MCP server entry point
├── wordpress.ts # WordPress REST API client
├── cli.ts # CLI interface
├── types/
│ └── wordpress-types.ts # TypeScript definitions
└── tools/
├── index.ts # Tool aggregation
├── unified-content.ts # Universal content management (8 tools)
├── unified-taxonomies.ts # Universal taxonomy management (8 tools)
├── media.ts # Media management (~5 tools)
├── users.ts # User management (~5 tools)
├── comments.ts # Comment management (~5 tools)
├── plugins.ts # Plugin management (~5 tools)
└── plugin-repository.ts # WordPress.org plugin search (~2 tools)
npm install
.env
file with your WordPress credentialsnpm run build
Feel free to open issues or make pull requests to improve this project. Check out CLAUDE.md
for detailed development guidelines.