PHP static analysis MCP server for measuring code quality, architecture, maintainability, dependencies, hotspots, and test coverage.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
One-click editor setup isnβt available for this listing yet β we donβt have a confirmed install command, and weβd rather show nothing than point your editor at the wrong package or host. Follow the projectβs own setup instructions, linked above.
Inspect callable tools, capabilities, and parameters exposed to AI agents by PhpCodeArcheology.
get_health_scoreOverall code health score, grade, and project statistics
get_problemsCode quality problems, filterable by severity and type
get_metricsDetailed metrics for a specific class, file, or function
get_hotspotsGit hotspots ranked by churn Γ complexity
get_refactoring_prioritiesRanked refactoring candidates with recommendations
get_dependenciesClass dependency analysis (incoming/outgoing)
PhpCodeArcheology is a PHP static analysis tool that measures code quality through 60+ metrics including cyclomatic complexity, maintainability index, coupling, and cohesion. It generates comprehensive reports for files, classes, methods, and functions β detecting code smells, identifying hotspots via git churn analysis, and tracking quality trends over time.
Unlike PHPStan or Psalm (which focus on type safety and bug detection), PhpCodeArcheology focuses on architecture and maintainability β giving you the insights you need to understand and improve your codebase structure. Think of it as an alternative to PHPMetrics with deeper git integration, baseline management, and AI-ready output.

No config file needed β the tool works out of the box. It scans your src directory and creates an HTML report in tmp/report. Open tmp/report/index.html in your browser.
Tip: Add
tmp/reportto your.gitignoreto keep generated reports out of version control.
Make sure ~/.composer/vendor/bin (or ~/.config/composer/vendor/bin) is in your $PATH. Then run from any directory:
Run against a local project:
This mounts your project into the container and writes the HTML report to ./report/.
If your project has dependency conflicts with PhpCodeArcheology's requirements (e.g. an older nikic/php-parser version), download the standalone PHAR from the Releases page. The PHAR ships all dependencies bundled, so it works without touching your project's composer.json.
Use the PHAR when: your project's dependencies collide with PhpCodeArcheology's, you want a CI step without a composer require --dev, or you analyse a legacy codebase where adding dev-deps is risky.
PhpCodeArcheology registers itself as a Composer plugin, so you can run the analysis directly via Composer:
When no path is given and no config file exists, it automatically detects your PSR-4 source directories from composer.json. All CLI options are supported:
To create a config file interactively:
| Option | Description |
|---|---|
--report-type=TYPE | Report format: html (default), markdown, json, sarif, ai-summary, graph. Comma-separated for multiple: html,json |
--report-dir=DIR | Output directory (default: tmp/report) |
--quick | Fast analysis with terminal output only, no report generation |
--no-color | Disable coloured terminal output (also respects NO_COLOR env) |
--fail-on=LEVEL | Exit 1 on error or warning (for CI pipelines) |
--generate-claude-md | Generate a CLAUDE.md project overview |
--git-root=DIR | Git repository root (default: current directory) |
--extensions=EXT | File extensions to analyse (comma-separated, default: php) |
--exclude=DIR | Directories to exclude (comma-separated) |
--coverage-file=FILE | Clover XML coverage file from PHPUnit/Pest for line-level coverage data |
--source-code | Include source code with syntax highlighting and nesting heatmap in the HTML report (details below) |
--version | Show version |
init β Create Config FileInteractively creates a php-codearch-config.yaml with sensible defaults. Detects common source directories (src, app, lib) automatically.
compare β Compare Two ReportsShows a delta view of metrics, problem counts, and lists new/resolved problems. Useful for answering: "Did my refactoring actually help?"
baseline β Track New Problems Onlycreate saves the current problem set as a baseline. check runs a fresh analysis and reports only problems that are new compared to the baseline. Returns exit code 1 if new errors are found β ideal for CI pipelines on legacy projects.
Create a php-codearch-config.yaml in your project root (or use init):
Factual signals from GitHub, npm, and our automated checks β not a rating.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/phpcodearcheology-phpcodearcheology)<a href="https://allmcps.com/mcp/phpcodearcheology-phpcodearcheology"><img src="https://allmcps.com/api/badge/phpcodearcheology-phpcodearcheology?style=directory" alt="PhpCodeArcheology on AllMCPs" /></a>