wp-cli-mcp
wp-cli-mcp
Claude 可以用它做什么?
"Install WooCommerce and activate it"
"Create a new page called About Us with this content..."
"List all plugins and deactivate the ones I'm not using"
"Scaffold a new child theme called my-theme"
"Create a navigation menu with Home, About, Contact links"
"Search and replace old domain with new domain in database"
"Export the database before I make changes"
"Generate a custom Gutenberg block for testimonials"所有功能均由底层的 WP-CLI 提供支持。支持本地运行或通过 SSH 连接到远程服务器。
工具 (30+)
分类 | 工具 |
核心 |
|
插件 |
|
主题 |
|
文章 |
|
用户 |
|
选项 |
|
菜单 |
|
媒体 |
|
数据库 |
|
脚手架 |
|
缓存 |
|
原始命令 |
|
要求
已安装 WP-CLI 并添加到 PATH 环境变量中
WordPress 安装(本地或可通过 SSH 访问)
Node.js 18+
设置
安装
npm install -g wp-cli-mcp使用 Claude Code 配置
添加到你的 Claude Code MCP 设置中 (~/.claude/claude_desktop_config.json):
{
"mcpServers": {
"wordpress": {
"command": "wp-cli-mcp",
"env": {
"WP_PATH": "/path/to/your/wordpress"
}
}
}
}通过 SSH 连接远程服务器
{
"mcpServers": {
"wordpress": {
"command": "wp-cli-mcp",
"env": {
"WP_SSH": "user@yourserver.com:/var/www/html"
}
}
}
}环境变量
变量 | 描述 | 示例 |
| 本地 WordPress 路径 |
|
| SSH 连接字符串 |
|
| 站点 URL (多站点) |
|
示例
主题开发工作流
You: "Scaffold a child theme based on twentytwentyfour"
Claude: Uses wp_scaffold_theme → creates child theme files
You: "Install and activate it"
Claude: Uses wp_theme_activate → theme is live
You: "Create the homepage with a hero section and 3 feature cards"
Claude: Uses wp_post_create → creates page with HTML content插件管理
You: "What plugins do I have installed?"
Claude: Uses wp_plugin_list → shows all plugins with status
You: "Install Contact Form 7 and WooCommerce"
Claude: Uses wp_plugin_install twice → both installed and activated数据库操作
You: "I'm migrating from staging.example.com to example.com"
Claude: Uses wp_db_export → backup first
Uses wp_search_replace (dry_run) → preview changes
Uses wp_search_replace → apply changes
Uses wp_cache_flush → clear cache搭配推荐
Elementor MCP — 97 个用于 Elementor 页面构建的工具
WordPress MCP — Automattic 官方 REST API 工具
wordpress-claude-stack — WordPress 的 CLAUDE.md + Cursor 规则
将这三者结合使用,可实现完整的 AI 驱动 WordPress 开发。
许可证
MIT — Mustafa Vatandas
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mvtandas/wp-cli-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server