Mcp Phpcs Server

by larspohlmann

1 stars
139 downloads
Not rated
GitHub

About

An MCP server that runs PHP_CodeSniffer (phpcs) and PHP Code Beautifier and Fixer (phpcbf) — lint PHP code against a coding standard and auto-fix violations directly from your MCP client.

Details

Author
larspohlmann
GitHub stars
1
Downloads
139
Categories
Developer Tools, Other

- No Composer dependencies; pure PHP implementation
- Exposes phpcs_check and phpcbf_fix tools
- Configurable via environment variables or config/config.json
- Auto‑discovers ruleset files (phpcs.xml, phpcs.xml.dist, ruleset.xml)
- JSON‑RPC 2.0 communication over STDIN/STDOUT
- Domain‑driven structure (src/Domain, src/Application, src/Infrastructure)

Make the STDIo entrypoint executable (chmod +x path/to/bin/mcp-phpcs), then configure your MCP client to launch the server using the absolute path to bin/mcp-phpcs as the command. Optionally set environment variables MCP_PHPCS_PATH, MCP_PHPCBF_PATH, and MCP_PHPCS_RULESET in the client configuration (e.g., Claude Desktop’s mcpServers block) to specify binary paths and a ruleset file.

AModel Context Protocolserver that bringsPHP_CodeSnifferinto your AI coding workflow — lint PHP against your coding standard and auto-fix violations, straight from any MCP client.

Implemented inpure PHP with zero Composer dependencies. Drop it into any project or run it standalone — it speaks JSON-RPC 2.0 over stdio and works with Claude Desktop, Claude Code, Cursor, and any other MCP-compatible client.

Both tools take a single requiredpath(absolute or project-relative file/directory).

- PHP 8.1+
- phpcsandphpcbfbinaries available (via
PHP_CodeSniffer, e.g. a project'svendor/binor a global install)
-

Clone the repository (or copy it into your project):

git clone https://github.com/larspohlmann/mcp-phpcs-server.git

Register it with your MCP client (see below).

Configure via environment variablesorconfig/config.json. Environment variables take precedence.

If no ruleset is provided, the server searches upward from the current working directory for one ofphpcs.xml,phpcs.xml.dist, orruleset.xml.

{ "mcpServers": { "phpcs": { "command": "/absolute/path/to/mcp-phpcs-server/bin/mcp-phpcs", "env": { "MCP_PHPCS_PATH": "/usr/local/bin/phpcs", "MCP_PHPCBF_PATH": "/usr/local/bin/phpcbf", "MCP_PHPCS_RULESET": "/path/to/your/phpcs.xml" } } } }

Then ask your assistant something like"Run phpcs on src/Service/UserService.php and fix what you can."

{ "name": "phpcs_check", "arguments": { "path": "src/Service/UserService.php" } }

The server follows a light Domain-Driven Design layout:

- src/Domain— tool contracts and result value objects
- src/Application— JSON-RPC MCP server and tool registry
- src/Infrastructure— process runner, config, ruleset discovery, tool implementations
- bin/mcp-phpcs— stdio entrypoint

It implements the MCP methodsinitialize,tools/list, andtools/call.

- STDOUT carriesonlyJSON-RPC messages; all logs go to STDERR.
- A non-zero exit code fromphpcsmeans violations were found — it is reported as findings, not treated as a fatal error.

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

AI-to-AI code review platform — Claude, Codex, and Gemini cross-check each other via MCP, REST API, and CLI for consensus-based results.

A stateful LSP runtime for AI agents: warm language server sessions with 50+ tools for go-to-definition, find-references, diagnostics, rename, and more across 30+ languages.

Persistent code index using Tree-sitter for fast, precise code search. Replaces grep with ~50 token responses instead of 2000+.

Orchestrates a dual-AI engineering loop where a Primary AI plans and implements, while a Review AI validates and reviews, with continuous feedback for optimal code quality. Supports custom AI pairing (Claude, Codex, Gemini, etc.)

AmazingMCP — MCP Server for .NET / C# Codebases

An MCP server that gives AI agents deep understanding of C# codebases via Roslyn — type search, dependency graphs, usage analysis, and architecture overviews, all from a live in-memory compilation.

A platform-agnostic code analysis library with semantic search capabilities and MCP server support.

Enforce consistent C++ style and best practices across your codebase. Analyze naming conventions, memory safety, and const correctness, and get actionable modernization suggestions up to C++23. Accelerate reviews with ready-made prompts and quick access to curated guidelines.

AI-Safe Code Analysis with 113+ MCP tools for guard validation, memory, workflow, and testing.

A Rust-based CLI tool for code-related tasks, operating as an MCP server.

Provides AI assistants with a comprehensive, one-time analysis for complete codebase context and understanding.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.