local-wp-mcp
Supports Elementor CLI commands for managing templates, pages, and design elements through WP-CLI.
Provides direct access to Local by Flywheel sites, including WP-CLI execution, MySQL queries, and filesystem operations for managing WordPress sites locally.
Enables direct SQL queries and schema inspection on WordPress site databases via Unix socket connection pooling with read-only mode by default.
Supports WooCommerce CLI commands for managing products, orders, customers, and other store data through WP-CLI with automatic read/write classification.
Comprehensive WordPress management through WP-CLI commands, including site info, plugin management, content operations, and multi-site support.
Supports Yoast SEO CLI commands for managing SEO settings, indexables, and content analysis through WP-CLI.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@local-wp-mcp what plugins are active on my site?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
local-wp-mcp
MCP server providing WP-CLI, MySQL, and filesystem access for Local by Flywheel WordPress sites.
Unlike REST API-based WordPress MCP servers, this connects directly through Local's native filesystem and process architecture — no application passwords, HTTP endpoints, or network requests needed.
Features
WP-CLI execution via Local's bundled PHP binary with command allowlisting
Direct MySQL queries via Unix socket connection pooling
Filesystem operations with path validation and WordPress core protection
Multi-site support with automatic site detection from
sites.jsonSecurity-first:
spawn()only (noexec()), symlink-safe path validation, tiered command permissions
Related MCP server: wp-cli-mcp
Tools
Tool | Description |
| Execute any WP-CLI command |
| Get WordPress version, URL, themes, plugins |
| List all Local by Flywheel sites |
| Run SQL queries (read-only by default) |
| Inspect database tables and columns |
| Get active plugins via direct DB query |
| Read files from the site directory |
| Write files (wp-content only, core protected) |
| List directory contents |
| Search for files by name pattern |
Setup
There are two ways to run this MCP server: from npm (recommended for general use) or from a local clone (for development or customization).
Important: All
envvalues must be strings (e.g.,"true"nottrue).
Option A: Install from npm (recommended)
This is the simplest approach. npm downloads and caches the package automatically — no cloning or building required.
Automatic setup (Claude Code)
From your Local site's project directory:
cd ~/Local\ Sites/mysite/app/public
npx -y @chrisfromthelc/local-wp-mcp --setupThis will auto-detect the Local site, create a .mcp.json (or merge into an existing one), and pre-fill SITE_NAME with write permissions set to false. Restart Claude Code to connect.
Manual setup
Choose your agent below. Each example uses npx to run the server — replace "My Site Name" with the name shown in Local.
Add a .mcp.json to your project root (e.g., ~/Local Sites/mysite/app/public/.mcp.json):
{
"mcpServers": {
"local-wp": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@chrisfromthelc/local-wp-mcp"],
"env": {
"SITE_NAME": "My Site Name",
"WPCLI_ALLOW_WRITES": "false",
"MYSQL_ALLOW_WRITES": "false",
"FS_ALLOW_WRITES": "false"
}
}
}
}Or add via the CLI:
claude mcp add -s project local-wp -- npx -y @chrisfromthelc/local-wp-mcpThen set environment variables with claude mcp add-json or by editing .mcp.json directly.
Edit the config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"local-wp": {
"command": "npx",
"args": ["-y", "@chrisfromthelc/local-wp-mcp"],
"env": {
"SITE_NAME": "My Site Name",
"WPCLI_ALLOW_WRITES": "false",
"MYSQL_ALLOW_WRITES": "false",
"FS_ALLOW_WRITES": "false"
}
}
}
}Restart Claude Desktop to connect.
Add a .cursor/mcp.json to your project root, or edit ~/.cursor/mcp.json for global config:
{
"mcpServers": {
"local-wp": {
"command": "npx",
"args": ["-y", "@chrisfromthelc/local-wp-mcp"],
"env": {
"SITE_NAME": "My Site Name",
"WPCLI_ALLOW_WRITES": "false",
"MYSQL_ALLOW_WRITES": "false",
"FS_ALLOW_WRITES": "false"
}
}
}
}Or add from Cursor Settings > Tools & MCP > New MCP Server.
Add a .vscode/mcp.json to your workspace root:
{
"servers": {
"local-wp": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@chrisfromthelc/local-wp-mcp"],
"env": {
"SITE_NAME": "My Site Name",
"WPCLI_ALLOW_WRITES": "false",
"MYSQL_ALLOW_WRITES": "false",
"FS_ALLOW_WRITES": "false"
}
}
}
}Note: VS Code uses
"servers"(not"mcpServers") and requires"type": "stdio".
Or use the Command Palette: MCP: Add Server.
Edit the config file:
macOS:
~/.codeium/windsurf/mcp_config.jsonWindows:
%USERPROFILE%\.codeium\windsurf\mcp_config.json
{
"mcpServers": {
"local-wp": {
"command": "npx",
"args": ["-y", "@chrisfromthelc/local-wp-mcp"],
"env": {
"SITE_NAME": "My Site Name",
"WPCLI_ALLOW_WRITES": "false",
"MYSQL_ALLOW_WRITES": "false",
"FS_ALLOW_WRITES": "false"
}
}
}
}Or use the Command Palette: MCP: Add Server.
Option B: Install from source (development)
Use this if you want to modify the server, run tests, or contribute changes. You clone the repo, build it once, and point .mcp.json at your local build output.
1. Clone and build
git clone https://github.com/chrisfromthelc/local-wp-mcp.git
cd local-wp-mcp
npm install
npm run build2. Configure your agent
Point your agent's config at the local dist/index.js instead of using npx. Use the same config format shown in the manual setup section for your agent, but replace command and args:
"command": "node",
"args": ["/absolute/path/to/local-wp-mcp/dist/index.js"]Note: The path must be absolute (e.g.,
/Users/you/Projects/local-wp-mcp/dist/index.js). Relative paths won't resolve correctly when the agent spawns the process.
3. Rebuild after changes
After editing source files, rebuild before restarting your agent:
npm run buildYou can also use npm run dev to watch for changes and rebuild automatically during development.
Development commands
npm run lint # ESLint
npm run build # TypeScript compile
npm test # unit tests (single run)
npm run test:watch # unit tests (watch mode)
npm run test:coverage # unit tests with coverage reportSwitching between npm and local
To switch from npm to local (or vice versa), update command and args in your agent's config:
Method |
|
|
npm (npx) |
|
|
Local clone |
|
|
Everything else (env, server name) stays the same. Restart your agent after switching.
Environment variables
Variable | Description | Default |
| Site name as shown in Local (e.g., | Auto-detected if only one site exists |
| Site ID from Local (takes precedence over | — |
| Enable write WP-CLI commands ( |
|
| Enable |
|
| Enable writing files via |
|
| Comma-separated list of additional read-only commands (see Plugin CLI commands) | — |
If only one site exists in Local, SITE_NAME and SITE_ID can both be omitted — the server will connect to it automatically.
Plugin CLI commands
This MCP server isn't limited to core WP-CLI commands — it automatically supports commands registered by plugins (WooCommerce, ACF, Yoast, Elementor, etc.).
How it works
WP-CLI commands are classified using a three-tier system:
Tier | Behavior | Examples |
Blocked | Always rejected (arbitrary code execution) |
|
Read-only | Always allowed | Core safe commands + any command with a read-only action verb |
Write | Requires | Everything else |
Read-only action verbs — any command whose subcommand is one of these is automatically allowed, regardless of whether it's a core or plugin command:
list, get, search, check, status, path, info, version, is-installed, check-update, pluck, has
This means commands like wc product list, acf field get my-group, or yoast index status work out of the box — no configuration needed.
Commands with write-action verbs like wc product create, acf field delete, or yoast index run are blocked unless WPCLI_ALLOW_WRITES=true is set.
Custom safe commands
If a plugin has read-only commands that don't match the built-in verb patterns (e.g., wc report sales), you can whitelist them with the WPCLI_SAFE_COMMANDS environment variable:
{
"mcpServers": {
"local-wp": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@chrisfromthelc/local-wp-mcp"],
"env": {
"SITE_NAME": "My Site Name",
"WPCLI_ALLOW_WRITES": "false",
"MYSQL_ALLOW_WRITES": "false",
"WPCLI_SAFE_COMMANDS": "wc report sales,wc report customers,my-plugin dump-config"
}
}
}
}Commands in WPCLI_SAFE_COMMANDS are always allowed without writes enabled. Use comma-separated values, matching the first 2–3 words of the command.
Security
All commands use
spawn()with argument arrays — no shell interpretationShell metacharacters rejected in both commands and arguments as defense-in-depth
WP-CLI
eval,eval-file, andshellare always blockedDangerous flags (
--exec,--require,--ssh, etc.) are blocked in all commandsWrite operations require explicit opt-in via env vars
Plugin commands with read-only verbs are auto-detected and allowed
File paths are validated with
realpath()to prevent symlink traversalFile reads and writes use open handles to mitigate TOCTOU race conditions
WordPress core directories (
wp-admin/,wp-includes/) are read-onlyChild processes inherit only necessary environment variables
Directory searches are capped at 10,000 files to prevent resource exhaustion
Output is truncated at 25,000 characters to preserve context windows
Requirements
Local by Flywheel installed
Node.js 18+
Site must be running in Local (services started)
License
MIT
Available Tools
10 toolslist_site_directoryList Site DirectoryARead-only
List files and directories in a Local by Flywheel site directory. Path is relative to the site root. Returns file names, types, and sizes.
Inputs: path, site.
mysql_queryRun MySQL QueryA
Execute a SQL query against the WordPress database. SELECT, SHOW, DESCRIBE, and EXPLAIN are always allowed. INSERT, UPDATE, DELETE require MYSQL_ALLOW_WRITES=true.
Inputs: query (required), site.
mysql_schemaGet Database SchemaARead-only
Get the schema of the WordPress database. Without a table name, lists all tables. With a table name, shows column details.
Inputs: site, table.
read_site_fileRead Site FileARead-only
Read a file from the Local by Flywheel site directory. Path is relative to the site root (e.g., "app/public/wp-config.php"). Files are limited to 512KB. All paths are validated against the site directory.
Inputs: path (required), site.
search_site_filesSearch Site FilesARead-only
Search for files by name pattern within the Local site directory. Searches recursively up to 10 levels deep, max 100 results. Skips node_modules, vendor, and dotfiles.
Inputs: pattern (required), path, site.
wp_active_pluginsGet Active Plugins (DB)ARead-only
Query the database directly to get the list of active WordPress plugins.
Inputs: site.
wp_cli_runRun WP-CLI CommandA
Execute a WP-CLI command against a Local by Flywheel WordPress site. Commands like "plugin list", "option get siteurl", "core version" are always allowed. Write commands require WPCLI_ALLOW_WRITES=true. Commands "eval", "eval-file", and "shell" are blocked for security.
Inputs: command (required), args, site, format.
wp_list_sitesList Local SitesARead-only
List all WordPress sites configured in Local by Flywheel, including their names, domains, IDs, and service versions.
Inputs: no named parameters.
wp_site_infoGet WordPress Site InfoARead-only
Get detailed information about the current Local by Flywheel WordPress site, including the site URL, WordPress version, active theme, and PHP version.
Inputs: site.
write_site_fileWrite Site FileADestructive
Write content to a file in the Local by Flywheel site directory. Requires FS_ALLOW_WRITES=true. Cannot write to wp-admin/ or wp-includes/ (WordPress core). Path is relative to the site root.
Inputs: path (required), content (required), site.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Most tools target distinct resources (sites, WP-CLI, database, files). The main overlap is wp_active_plugins vs wp_cli_run 'plugin list', but descriptions clarify the direct database query vs CLI execution. Otherwise, each tool serves a clear purpose.
Tools use clear prefixes for domains (wp_*, mysql_*) and consistent verb_noun for file operations (read_site_file, write_site_file). Minor inconsistency: wp_cli_run is noun_verb rather than verb_noun, and file operations lack a prefix, but the pattern is still predictable.
10 tools is well-scoped for a local WordPress development server covering sites, WP-CLI, database, and file operations. Each tool earns its place without feeling redundant or excessive.
The surface covers core workflows: read/write files, query database, run WP-CLI, list sites, and inspect schema. A minor gap is the lack of a tool to switch the 'current site' referenced by wp_site_info, but overall the lifecycle is adequately covered.
Maintenance
Related MCP Connectors
WordPress MCP server: publish posts, AI images, SEO and full site management, self-hosted
Official xCloud MCP: manage servers, sites, WordPress, SSL, backups and deploys from any MCP client.
A MCP server built for developers enabling Git based project management with project and personal…
Security-first WordPress MCP server. 129 tools for Claude, ChatGPT, Gemini. Free on wp.org.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables AI agents to discover, manage, and interact with LocalWP sites through integrated WP-CLI, SQL access, and backup workflows. It provides cross-platform site diagnostics and environment resolution for seamless local WordPress development.65 npm1ISC
- AlicenseBqualityDmaintenanceMCP server that gives AI tools full WordPress management via WP-CLI. 30+ tools for themes, plugins, posts, menus, users, database, scaffolding, and cache. Works locally or over SSH.3420 npm6MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for WordPress content management that provides a secure interface for AI assistants to interact with WordPress sites, enabling content creation, editing, and media management without destructive operations.MIT
- AlicenseNot gradedqualityBmaintenanceAn MCP server that enables safe reconnaissance, mutation, and verification of WordPress sites through guarded, typed verbs with dry-run previews and change-packet audit records.MIT