# PhpCodeArcheology/PhpCodeArcheology [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/PhpCodeArcheology/PhpCodeArcheology  
**GitHub Stars:** 94  
**Views:** 3  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/phpcodearcheology-phpcodearcheology

## Description
PHP static analysis MCP server for architecture and maintainability. 11 tools exposing 60+ code quality metrics, problem detection, refactoring priorities, dependency graphs, git hotspots, test coverage, and impact analysis. Installable via Composer.

## Tools
Capabilities this server exposes over MCP:

- **get_health_score** — Overall code health score, grade, and project statistics
- **get_problems** — Code quality problems, filterable by severity and type
- **get_metrics** — Detailed metrics for a specific class, file, or function
- **get_hotspots** — Git hotspots ranked by churn × complexity
- **get_refactoring_priorities** — Ranked refactoring candidates with recommendations
- **get_dependencies** — Class dependency analysis (incoming/outgoing)
- **get_class_list** — All classes with key metrics, sortable and filterable
- **get_graph** — Knowledge graph as JSON (nodes, edges, cycles)
- **get_impact_analysis** — Impact analysis: what breaks if you change a method? Shows callers and call chains
- **get_test_coverage** — Test coverage summary — tested/untested classes, coverage gaps, test mapping
- **search_code** — Search entities by name with metric overview

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/PhpCodeArcheology/PhpCodeArcheology), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Install:

```sh
composer require --dev php-code-archeology/php-code-archeology
```

2. Install:

```sh
composer global require php-code-archeology/php-code-archeology
```

3. Install:

```sh
docker build -t phpcodearcheology https://github.com/PhpCodeArcheology/PhpCodeArcheology.git
```

4. Start the server:

```sh
docker run --rm -v "$(pwd)":/project -v "$(pwd)/report":/output phpcodearcheology /project
```

5. Install:

```sh
curl -LO https://github.com/PhpCodeArcheology/PhpCodeArcheology/releases/latest/download/phpcodearcheology.phar
```

6. Install:

```sh
curl -LO https://github.com/PhpCodeArcheology/PhpCodeArcheology/releases/latest/download/phpcodearcheology.phar.sha256
```

## Documentation

## What PhpCodeArcheology/PhpCodeArcheology MCP server does

PhpCodeArcheology/PhpCodeArcheology MCP server connects an MCP client to the analysis results of a PHP codebase. Its focus is architecture and maintainability: complexity, coupling, cohesion, code-quality problems, Git churn, test coverage, and the likely consequences of changing code. The project describes more than 60 underlying metrics and provides 11 MCP tools for querying those results.

The server is a fit for developers reviewing an unfamiliar PHP project, planning technical-debt work, or checking whether a proposed change may affect callers elsewhere. It complements tools centered on type safety or bug detection rather than replacing them.

## How it works

Install the PHP analyzer through Composer, run it against the project, and expose its analysis through the MCP server. The analysis can inspect files, classes, methods, functions, Git history, and coverage data. Test analysis can detect PHPUnit, Pest, and Codeception setups, map tests to production classes, and use Clover XML for line-level coverage information.

Queries can start with a project health score and then narrow into problems, entities, dependencies, or hotspots. The graph tool returns nodes, edges, and cycles as JSON. Impact analysis follows callers and call chains to show what may be affected by a method change. Git hotspots combine churn and complexity to identify code that may deserve attention first.

## Setup and configuration

The documented installation path requires PHP 8.2 or newer and Composer. The package can be added as a development dependency, installed globally, run through its Composer plugin, or used as a standalone PHAR when project dependency conflicts make a Composer installation unsuitable. Docker is also documented for running analysis against a mounted project.

The command-line analyzer works without a configuration file for its basic use. Its `init` subcommand can create `php-codearch-config.yaml`, and options cover source paths, excluded directories, file extensions, Git root, report output, and Clover coverage input.

## Tools and capabilities

PhpCodeArcheology/PhpCodeArcheology provides tools for:

- Overall health scores, grades, and project statistics.
- Severity- or type-filtered problem detection.
- Metrics for individual classes, files, and functions.
- Class inventories with sorting and filtering.
- Git hotspot ranking based on churn and complexity.
- Refactoring candidates with recommendations.
- Incoming and outgoing class dependencies.
- Knowledge-graph JSON containing nodes, edges, and cycles.
- Method impact analysis with callers and call chains.
- Test coverage summaries, gaps, and test mappings.
- Entity search with a metric overview.

The analyzer also supports HTML, Markdown, JSON, SARIF, AI-summary, and graph report formats, plus baselines and history tracking. Those features describe the underlying analysis workflow; the MCP listing specifically exposes the tools above.

## Limitations and notes

The material identifies Claude Code as an AI integration but does not document support for particular other MCP clients. It also does not provide MCP transport details, authentication behavior, or server-specific environment variables. Results depend on the PHP project, available Git history, and any coverage file supplied. The tool is intended for architecture and maintainability analysis, so it should be paired with type-analysis or bug-detection tools when those checks are required.

_Full upstream README: https://allmcps.com/mcp/phpcodearcheology-phpcodearcheology/readme_

