MCP PHPStan Server
About
An MCP server that runs PHPStan static analysis on PHP code — analyze files at a configurable rule level and memory limit, with support for PHPStan Pro, directly from your MCP client.
Details
- Author
- larspohlmann
- Categories
- Developer Tools
Jump to
Setup
Install MCP PHPStan Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/larspohlmann/mcp-phpstan-server
Follow the installation instructions in the repository README, then restart your MCP client.
An MCP server that runs PHPStan static analysis on PHP code — analyze files at a configurable rule level and memory limit, with support for PHPStan Pro, directly from your 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.
- paths(required) — array of absolute or project-relative paths to analyze
- level(optional) — override the configured rule level (e.g."max"or8)
- PHP 8.1+
- Aphpstanbinary available (projectvendor/bin/phpstanor a global install)
-
Clone the repository (or copy it into your project):
git clone https://github.com/larspohlmann/mcp-phpstan-server.git
chmod +x mcp-phpstan-server/bin/mcp-phpstan
Register it with your MCP client (see below).
Configure via environment variablesorconfig/config.json. Environment variables take precedence.
If no config path is provided, the server searches upward from the current working directory forphpstan.neonorphpstan.neon.dist.
{ "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" } } } }
Then ask your assistant something like"Run PHPStan on the src directory and explain the errors."
{ "name": "phpstan_analyze", "arguments": { "paths": ["src", "tests"], "level": "max" } }
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, tool implementations
- bin/mcp-phpstan— 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 fromphpstancan mean findings as well as failures — the server parses the output to determine the error state.
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.
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.
AI-powered code quality analysis to detect best practice violations, security issues, and architectural problems in real-time.
An experimental MCP server that uses the ast-grep CLI for code structural search, linting, and rewriting.
MCP server that gives coding agents program-analysis primitives — data flow, call graphs, taint analysis — so they reason from ground truth instead of grep-and-guess. (same as the GitHub About — keeps your messaging consistent across the web).
An MCP service that equips your workspace with a complete set of AI-accessible development tools for reading, editing, executing, and managing code.
A development tool for real-time debugging, code quality monitoring, and AI insights for React/Next.js applications.
Visual Studio extension with 20 Roslyn-powered MCP tools for AI assistants. Semantic code navigation, symbol search, inheritance, call graphs, safe rename, build/test.
A VS Code extension that provides real-time diagnostic problems like errors and warnings via the Model Context Protocol.
A server for detecting critical performance issues in code, providing concise analysis and output.
A server for code analysis using Tree-sitter, with context management capabilities.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





