Get the FREE Ultimate OpenClaw Setup Guide →

wpcs

MCP server from vapvarun/wpcs-mcp-server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio vapvarun-wpcs-mcp-server node /Users/YOUR_USERNAME/.mcp-servers/wpcs-mcp-server/build/index.js \
  --env PATH="YOUR_PHP_PATH:/path/to/.composer/vendor/bin:/usr/local/bin:/usr/bin:/bin"

How to use

This MCP server integrates WordPress Coding Standards (WPCS) with Claude AI to automatically check and fix PHP code in WordPress plugins and themes to meet WordPress.org standards. When connected to Claude, you can request automated code fixes and guidance as part of your development workflow. The server exposes tools that can pre-emptively fix common issues in staged files or check all staged PHP files before committing. The available tools include wpcs_pre_commit for auto-fixing staged changes, and wpcs_check_staged to validate staged files prior to commit. Use Claude in combination with this MCP server to streamline adherence to coding standards during development and before pushing changes.

To use the MCP server with Claude, configure your Claude mcpServers entry to point to the Node.js build of the server (index.js). Once configured, invoke the tools from Claude's interface (or your project’s CLI) to run WPCS checks and fixes automatically. If you don’t want Claude AI integrations, the included Git hooks and CI/CD setups (as documented) can still run PHP_CodeSniffer with WPCS on commit or in CI environments.

How to install

Prerequisites

  • Node.js 18+ (for building/running the MCP server)
  • PHP 8.2+ and Composer (for WP Coding Standards dependencies)
  • Git (for cloning and setup)

Step 1: Quick Start (Git Hooks Only, optional Claude integration)

curl -sSL https://raw.githubusercontent.com/vapvarun/wpcs-mcp-server/main/scripts/install-hooks.sh | bash

Step 2: Quick Start (Clone, Build, and Install Dependencies)

git clone https://github.com/vapvarun/wpcs-mcp-server.git ~/.mcp-servers/wpcs-mcp-server
cd ~/.mcp-servers/wpcs-mcp-server
npm install --include=dev && npm run build

Step 3: Install WPCS Dependencies (manually, recommended for reliability)

# Allow the composer installer plugin
composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true

# Install phpcs, WPCS, and PHPCompatibility
composer global require squizlabs/php_codesniffer wp-coding-standards/wpcs phpcompatibility/phpcompatibility-wp dealerdirect/phpcodesniffer-composer-installer

# Verify installation
~/.composer/vendor/bin/phpcs -i

Step 4: Configure MCP Server in Claude (example)

claude mcp add wpcs --scope user -- node ~/.mcp-servers/wpcs-mcp-server/build/index.js

Optional Step: Project-level or global Claude configuration with PATH adjustments as shown in the README.

Additional notes

Notes and guidance:

  • The MCP server runs as a Node.js process and expects to be invoked via build/index.js. Update the path in mcp_config to match your environment.
  • PATH management is important: ensure the PHP binary and Composer vendor/bin directory are in PATH when the server runs, otherwise phpcs and WPCS dependencies may not be found.
  • If you don’t want Claude AI integrations, you can still enable pre-commit hooks and CI/CD workflows to run WPCS checks automatically.
  • When running locally, you can test the server by starting Node with the path to build/index.js and inspecting the output for the available standards and phpcs bin path.
  • The available WPCS standards include WordPress, WordPress-Core, WordPress-Docs, WordPress-Extra, and PHPCompatibility.

Related MCP Servers

Sponsor this space

Reach thousands of developers