Provides pre-commit workflow integration for checking staged PHP files, auto-fixing violations, and re-staging files before commits, with the ability to block commits when coding standard errors are found.
Enables automatic WordPress Coding Standards (WPCS) validation and auto-fixing for WordPress plugins and themes, including pre-commit checks, individual file/directory scanning, and integration with WordPress coding standards rulesets (WordPress-Core, WordPress-Extra, WordPress-Docs).
WPCS MCP Server
A Model Context Protocol (MCP) server that integrates WordPress Coding Standards (WPCS) with Claude AI. This server enables automatic code quality checks and fixes for WordPress plugins and themes before commits.
Features
Pre-commit WPCS validation - Automatically check staged PHP files against WordPress Coding Standards
Auto-fix support - Automatically fix coding standard violations using phpcbf
Block commits on errors - Prevent commits when WPCS errors are found
Claude Code integration - Seamless integration with Claude Code CLI
Multiple check modes - Check individual files, directories, or all staged files
Available Tools
Tool | Description |
| Check all staged PHP files against WPCS |
| Check a single PHP file |
| Check all PHP files in a directory |
| Auto-fix WPCS violations in a file |
| Full pre-commit workflow: auto-fix, re-stage, and report |
Prerequisites
1. Install PHP CodeSniffer and WordPress Coding Standards
2. Node.js 18+
Ensure you have Node.js version 18 or higher installed.
Installation
Option 1: Clone and Build
Option 2: NPM Install (Coming Soon)
Configuration
For Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
For Claude Code CLI
Add to ~/.claude/settings.json:
Pre-commit Hook (Optional)
Create ~/.claude/hooks/wpcs-pre-commit.sh:
Then add to ~/.claude/settings.json:
Usage
With Claude
Simply ask Claude to check your WordPress code:
Example Workflow
Make changes to your WordPress plugin/theme
Stage your changes:
git add .Ask Claude: "Run wpcs_pre_commit"
Claude will:
Auto-fix what can be fixed
Re-stage the fixed files
Report any remaining issues
If no errors, commit proceeds; otherwise, fix remaining issues
Tool Details
wpcs_pre_commit
The most commonly used tool. It performs a complete pre-commit workflow:
wpcs_check_file
Check a single PHP file:
wpcs_fix_file
Auto-fix a single file:
WordPress Coding Standards
This server uses the WordPress ruleset which includes:
WordPress-Core - Essential WordPress coding standards
WordPress-Extra - Additional best practices
WordPress-Docs - Documentation standards
Development
Troubleshooting
phpcs not found
Ensure composer bin is in your PATH:
Add this to your shell profile (~/.zshrc or ~/.bashrc).
WordPress standard not found
Reinstall WPCS:
MCP server not loading
Check the path in your config is correct
Ensure the server is built:
npm run buildRestart Claude Desktop or Claude Code
License
GPL-2.0-or-later
Author
Varun Dubey (@vapvarun)
Website: wbcomdesigns.com
Email: varun@wbcomdesigns.com
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add some amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request