Sponsored by Deepsite.site

Mcp Phpcs Server

Created By
larspohlmann2 months ago
Content

MCP PHPCS Server (Local, No Dependencies)

A minimal Model Context Protocol (MCP) server implemented in pure PHP that exposes two tools:

  • phpcs_check: Runs PHP_CodeSniffer and returns a readable report.
  • phpcbf_fix: Runs PHP Code Beautifier and Fixer.

No Composer dependencies. Designed to be copied into any project.

Structure (DDD)

  • src/Domain: Tool contracts and results
  • src/Application: JSON-RPC MCP server and registry
  • src/Infrastructure: Process runner, config, ruleset discovery, tool implementations
  • bin/mcp-phpcs: STDIO entrypoint

Configure

You can configure via environment variables or config/config.json:

  • MCP_PHPCS_PATH – path to phpcs binary (default: phpcs on PATH)
  • MCP_PHPCBF_PATH – path to phpcbf binary (default: phpcbf on PATH)
  • MCP_PHPCS_RULESET – path to a ruleset (e.g. phpcs.xml)

If no ruleset is provided, the server searches upwards from the current working directory for one of: phpcs.xml, phpcs.xml.dist, ruleset.xml.

Run

Mark the script executable once:

chmod +x mcp/phpcs-server/bin/mcp-phpcs

Then configure your MCP client to start the server via stdio using the command:

/absolute/path/to/mcp/phpcs-server/bin/mcp-phpcs

Example: Claude Desktop config

Add this to your MCP config file:

{
  "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"
      }
    }
  }
}

The server speaks JSON-RPC 2.0 over STDIN/STDOUT and implements:

  • initialize
  • tools/list
  • tools/call

Tools

phpcs_check

Input schema:

{
  "type": "object",
  "properties": {
    "path": {"type": "string"}
  },
  "required": ["path"]
}

phpcbf_fix

Same input schema as phpcs_check.

Notes

  • Output to STDOUT is strictly JSON-RPC messages. Logs go to STDERR.
  • Non-zero exit codes from phpcs are treated as violations (not necessarily fatal errors).
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
CursorThe AI Code Editor
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
WindsurfThe new purpose-built IDE to harness magic
Tavily Mcp
Serper MCP ServerA Serper MCP Server
ChatWiseThe second fastest AI chatbot™
Amap Maps高德地图官方 MCP Server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Playwright McpPlaywright MCP server
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
DeepChatYour AI Partner on Desktop
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.