Skip to main content
Glama

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_core_version, wp_core_check_update

插件

wp_plugin_list, wp_plugin_install, wp_plugin_activate, wp_plugin_deactivate, wp_plugin_delete, wp_plugin_search

主题

wp_theme_list, wp_theme_install, wp_theme_activate, wp_theme_delete

文章

wp_post_list, wp_post_get, wp_post_create, wp_post_update, wp_post_delete

用户

wp_user_list, wp_user_create

选项

wp_option_get, wp_option_update

菜单

wp_menu_list, wp_menu_create, wp_menu_item_add, wp_menu_location_assign

媒体

wp_media_import

数据库

wp_db_query, wp_db_export, wp_search_replace

脚手架

wp_scaffold_theme, wp_scaffold_plugin, wp_scaffold_block

缓存

wp_rewrite_flush, wp_cache_flush

原始命令

wp_cli_raw — 运行任何 WP-CLI 命令

要求

  • 已安装 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"
      }
    }
  }
}

环境变量

变量

描述

示例

WP_PATH

本地 WordPress 路径

/var/www/html

WP_SSH

SSH 连接字符串

user@host:/path/to/wp

WP_URL

站点 URL (多站点)

https://example.com

示例

主题开发工作流

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

搭配推荐

将这三者结合使用,可实现完整的 AI 驱动 WordPress 开发。

许可证

MIT — Mustafa Vatandas

Install Server
A
security – no known vulnerabilities
A
license - permissive license
B
quality - B tier

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