loading…
Search for a command to run...
loading…
An MCP server that enables AI agents to discover, manage, and interact with LocalWP sites through integrated WP-CLI, SQL access, and backup workflows. It provid
An 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.
localwp-mcp gives AI agents direct access to LocalWP sites through MCP.
It automatically finds your Local sites, uses the correct Local PHP and MySQL runtimes for each one, and lets an agent work with WordPress through WP-CLI, MySQL, logs, diagnostics, backups, and restore flows.
Use npx in your MCP client:
{
"mcpServers": {
"localwp": {
"command": "npx",
"args": ["-y", "localwp-mcp"],
"env": {
"LOCALWP_MCP_PROFILE": "safe"
}
}
}
}
localwp-mcp currently supports STDIO clients. Streamable HTTP is not supported yet.
If you want the MCP to focus on one site by default, set:
{
"LOCAL_SITE_NAME": "example-site"
}
Use these settings across supported clients:
STDIOnpx-y, localwp-mcpLOCALWP_MCP_PROFILE=safeLOCAL_SITE_NAMELOCAL_SITE_IDLOCALWP_MCP_BACKUPS_DIRDo not choose Streamable HTTP. localwp-mcp currently runs as a local stdio MCP server.
In Codex Desktop:
SettingsMCP serversSTDIOThen enter:
localwpnpx-ylocalwp-mcpLOCALWP_MCP_PROFILE = safeLOCAL_SITE_NAME = your-site-nameAdd this to your Cursor MCP config, for example .cursor/mcp.json:
{
"mcpServers": {
"localwp": {
"command": "npx",
"args": ["-y", "localwp-mcp"],
"env": {
"LOCALWP_MCP_PROFILE": "safe"
}
}
}
}
Add the MCP through the Claude Code CLI.
macOS and Linux:
claude mcp add localwp -- npx -y localwp-mcp
Windows:
claude mcp add localwp -- cmd /c npx -y localwp-mcp
The space before and after -- is intentional. -- is the separator between the Claude command and the command Claude should launch.
After adding the server, configure:
LOCALWP_MCP_PROFILE=safeLOCAL_SITE_NAME=your-site-nameUse a local MCP server entry in your OpenCode config:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"localwp": {
"type": "local",
"command": ["npx", "-y", "localwp-mcp"],
"enabled": true,
"environment": {
"LOCALWP_MCP_PROFILE": "safe"
}
}
}
}
If your MCP client supports launching a local server over STDIO, use:
npx-y, localwp-mcpLOCALWP_MCP_PROFILE=safeIf a client only accepts an MCP URL and cannot launch a local command, it cannot use localwp-mcp yet.
localwp-mcp has 2 access modes:
safe
Best default for most people. Safe WordPress inspection commands, read-oriented runtime calls, diagnostics, logs, database reads, and backup/export flows.full-access
Best when you want the agent to fully work on your local site, including SQL writes, imports, restore operations, and explicit WordPress runtime PHP execution.safe is the default.
To enable full local access:
{
"LOCALWP_MCP_PROFILE": "full-access"
}
Start with:
local_environment_checklocal_doctorlist_local_sitesThose will tell you:
Use:
local_site_infolocal_doctorlocal_logslocal_logs accepts:
siteglobalallboth, combinedUse:
list_site_filesread_site_filesearch_site_fileswrite_site_filedelete_site_fileThese tools are always scoped to the selected site's root directory.
safe, you can list, read, and search files.full-access, you can also write and delete files.Use:
start_local_sitestop_local_siterestart_local_siteUse:
execute_wp_cliwp_call_functionwp_call_static_methodexecute_wp_php_readonlyexecute_wp_phpExamples:
full-accessexecute_wp_cli is for ordinary WP-CLI commands. It intentionally blocks eval, eval-file, shell, and db query, and blocked commands return structured policy details with suggested alternatives.
wp_call_function and wp_call_static_method are read-oriented runtime inspection tools. They run inside the loaded WordPress runtime with explicit JSON arguments and add best-effort read-only guardrails around common SQL writes, HTTP requests, and outgoing email.
execute_wp_php_readonly is the protected arbitrary-snippet companion to those tools. It runs a PHP snippet or workspace/site .php file inside the loaded WordPress runtime with the same best-effort read-only guardrails, so you can inspect composed logic without jumping straight to unrestricted PHP execution. For snippet workflows, stdout is usually the primary output field, while rawResultType and rawResult preserve the underlying PHP include return value for debugging.
When a read-only tool blocks side effects, the top-level response becomes explicit instead of exposing a success-looking raw mutation result as authoritative. Those responses set outcome to blocked_side_effects, return a wrapped result, preserve the raw callable/snippet return value in rawResultType and rawResult, and include a richer readOnlyState with:
blockedSideEffectsblockedSqlVerbsblockedSqlCountblockedHttpCountblockedMailCountwritesBlockedsideEffectsPreventedtransactionStartedtransactionRolledBacktransactionCommittedexecute_wp_php is the explicit high-trust runtime path for full-access. It runs a PHP snippet or workspace/site .php file inside the selected site's loaded WordPress runtime using a file-based eval-file flow.
Use:
mysql_query
Read-only SQL in safemysql_execute
Full SQL execution in full-accessmysql_schema
Table listing and table description helpersUse:
backup_sitelist_backupsdelete_backupcleanup_backupsdb_exportdb_importpreview_restore_backuprestore_backupbackup_site supports:
databasefullThe full backup format is folder-based and includes the site's app, conf, and logs directories plus a fresh SQL dump.
If you want to manage backup storage over time:
list_backups
Shows the managed backup directories and SQL artifacts for a site.delete_backup
Removes one managed backup artifact in full-access.cleanup_backups
Cleans up older backups by age and/or retention count in full-access.Use preview_restore_backup when you want to inspect the restore plan, effective restore mode, compatibility warnings, and current site state before making changes.
list_local_sitesstart_local_sitestop_local_siterestart_local_sitelocal_environment_checklocal_doctorlocal_logslocal_site_infolist_site_filesread_site_filesearch_site_fileswrite_site_filedelete_site_fileexecute_wp_cliwp_call_functionwp_call_static_methodexecute_wp_php_readonlyexecute_wp_phpmysql_querymysql_executemysql_schemadb_exportdb_importbackup_sitelist_backupsdelete_backupcleanup_backupspreview_restore_backuprestore_backuplocalwp://siteslocalwp://sites/{siteName}/summarylocalwp://sites/{siteName}/doctorlocalwp://sites/{siteName}/logsdiagnose_local_siterestore_local_sitelocalwp-mcp is designed for:
It supports both current Local lightning-services layouts and older site-binaries layouts.
Live validation has been completed on:
Linux support is implemented in the code paths and tests, but has not yet been live-validated on a machine with LocalWP.
Most users only need these:
LOCALWP_MCP_PROFILELOCAL_SITE_NAMELOCAL_SITE_IDLOCALWP_MCP_BACKUPS_DIRAdvanced override variables also exist for custom Local layouts, but most installations do not need them.
If the MCP does not find your site or cannot run WP-CLI/MySQL:
local_environment_check.local_doctor.local_logs.Those tools are the fastest way to see whether the problem is:
If plain shell wp behaves differently from MCP, call local_site_info.
local_site_info now includes wpCliRuntime, mysqlRuntime, and shellReproduction sections that show the exact Local-managed binaries, working directory, environment overrides, and command arrays this MCP uses. MCP does not rely on your ambient shell wp; it resolves the selected site's Local runtime directly.
Contributor and maintainer docs live outside the main user guide:
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"localwp-mcp": {
"command": "npx",
"args": []
}
}
}