How to Use the WordPress Playground MCP Server with AI Coding Agents

Connect AI Coding Agents to WordPress Playground via MCP

WordPress Playground just got a major upgrade for developers: an official Model Context Protocol (MCP) server that lets AI coding agents like Claude Code and Gemini CLI interact directly with a browser-based WordPress instance. This means your AI agent can read and write files, execute PHP, manage sites, and navigate pages — all locally, without ever touching the WordPress admin.

Here’s how to get it set up and what you can do with it.

What Is the WordPress Playground MCP Server?

The @wp-playground/mcp package is an official MCP server that bridges AI coding agents to a live WordPress Playground instance over WebSocket. It exposes a rich set of tools across four categories: site management, code execution, navigation, and filesystem operations.

Step 1: Install the MCP Server

You don’t need to install anything permanently. The MCP server runs via npx. To wire it up with Claude Code, run:

claude mcp add --transport stdio --scope user wordpress-playground -- npx -y @wp-playground/mcp

For Gemini CLI, follow the equivalent MCP configuration steps in your agent’s settings.

Step 2: Open WordPress Playground in Your Browser

Navigate to playground.wordpress.net and start a new WordPress instance. The MCP server connects to this browser-based instance over WebSocket — no local server setup required.

Step 3: Explore the Available MCP Tools

Once connected, your AI agent has access to the following tool categories:

Site Management

  • playground_get_website_url — Get the current site URL
  • playground_list_sites — List all available Playground sites
  • playground_open_site — Open a specific site
  • playground_rename_site — Rename a site
  • playground_save_site — Save the current site state

Code Execution

  • playground_execute_php — Run arbitrary PHP code in the Playground environment
  • playground_request — Make HTTP requests to the WordPress instance

Navigation

  • playground_navigate — Navigate to a specific URL within the site
  • playground_get_current_url — Get the current page URL
  • playground_get_site_info — Retrieve site metadata

Filesystem

  • playground_read_file — Read a file from the WordPress filesystem
  • playground_write_file — Write or update a file
  • playground_list_files — List files in a directory
  • playground_mkdir — Create a new directory
  • playground_delete_file — Delete a file

Step 4: Practical Use Cases

Here are some powerful workflows you can now automate with AI agents:

  • Plugin testing: Ask your agent to install a plugin, activate it, and verify it works — all via conversation.
  • Live database debugging: Execute PHP to query the database and inspect data without opening phpMyAdmin.
  • Theme scaffolding: Have your agent create theme files, write template code, and preview changes instantly.
  • Block development: Scaffold custom Gutenberg blocks and test them in a live WordPress environment.
  • Migration testing: Simulate content migrations and verify data integrity before running on production.

Step 5: Why This Matters for WordPress Developers

The WordPress Playground MCP server represents a fundamental shift in how developers can interact with WordPress. Instead of manually clicking through the admin, writing test scripts, or spinning up Docker containers, you can now describe what you want in plain English and let your AI agent handle the execution — all in a safe, sandboxed environment.

This is especially powerful for:

  • Rapid prototyping of plugins and themes
  • Automated testing workflows driven by AI
  • Onboarding new developers with guided, agent-assisted WordPress exploration
  • Debugging complex issues with AI-assisted PHP execution

Key Takeaway: The WordPress Playground MCP server is one of the most developer-friendly additions to the WordPress ecosystem in years. If you’re using AI coding agents in your workflow, this is a must-try integration that can dramatically speed up your WordPress development process.

Hashtags: #WordPress #WordPressDevelopment #MCP #AIAgents #ClaudeCode #WordPlayground #WebDevelopment #PHP #Gutenberg

Resources: