mcp-phpstan-server MCP Server

A Model Context Protocol server that brings PHPStan static analysis into your AI coding workflow — analyze PHP for bugs and type errors, straight from any MCP client.

Local serverstdio

What is the mcp-phpstan-server MCP Server?

mcp-phpstan-server is an MCP project maintained in the larspohlmann/mcp-phpstan-server repository. The maintainer describes its purpose as “A Model Context Protocol server that brings PHPStan static analysis into your AI coding workflow — analyze PHP for bugs and type errors, straight from…”. Read the project documentation for the complete scope.

Local setup

The project provides a local client configuration using /absolute/path/to/mcp-phpstan-server/bin/mcp-phpstan. Follow the repository’s build and installation steps before copying it, and replace example paths with the paths on your own computer.

Configuration values

The example declares MCP_PHPSTAN_PATH, MCP_PHPSTAN_CONFIG, MCP_PHPSTAN_LEVEL, MCP_PHPSTAN_MEMORY_LIMIT. Secret-looking values have been replaced with placeholders. Required and optional labels are shown only when the documentation states them.

Source

Project documentation · Repository · Discovery listing. This profile records the public documentation checked on 2026-10-08.

Recorded tools

Check the linked publisher documentation and your connected client's tool list. Names and availability can vary with the server version and account permissions.

ToolWhat it does
pathsrequired) — array of absolute or project-relative paths to analyze
leveloptional) — override the configured rule level (e.g. "max" or 8)
phpstan_analyzeRuns PHPStan on one or more paths and returns a readable report of errors.
phpstan_proRuns PHPStan with JSON output for richer, structured diagnostics (works with PHPStan Pro when available).

How to install the mcp-phpstan-server MCP Server

{
  "mcpServers": {
    "phpstan": {
      "command": "/absolute/path/to/mcp-phpstan-server/bin/mcp-phpstan",
      "env": {
        "MCP_PHPSTAN_PATH": "/usr/local/bin/phpstan",
        "MCP_PHPSTAN_CONFIG": "/path/to/your/phpstan.neon",
        "MCP_PHPSTAN_LEVEL": "max",
        "MCP_PHPSTAN_MEMORY_LIMIT": "1G"
      }
    }
  }
}

From the project documentation. Replace placeholders and example paths before connecting.

Configuration

VariableDescriptionRequired
MCP_PHPSTAN_PATHDeclared in the maintainer’s client configuration.Check documentation
MCP_PHPSTAN_CONFIGDeclared in the maintainer’s client configuration.Check documentation
MCP_PHPSTAN_LEVELDeclared in the maintainer’s client configuration.Check documentation
MCP_PHPSTAN_MEMORY_LIMITDeclared in the maintainer’s client configuration.Check documentation