PhpCodeArcheology logo

PhpCodeArcheology

by PhpCodeArcheology

Analyzes PHP architecture and maintainability through MCP tools for metrics, problems, dependencies, hotspots, and impact.

Install PhpCodeArcheology

Run the project’s own setup commands, in order.

Setup steps from the project

PhpCodeArcheology/PhpCodeArcheology installs with its own steps rather than a config we can generate, so these are copied as-is. Follow them in order and run the commands in a terminal. Source: github.com

  1. 1. Install
    composer require --dev php-code-archeology/php-code-archeology
    
  2. 2. Install
    composer global require php-code-archeology/php-code-archeology
    
  3. 3. Install
    docker build -t phpcodearcheology https://github.com/PhpCodeArcheology/PhpCodeArcheology.git
    
  4. 4. Start the server
    docker run --rm -v "$(pwd)":/project -v "$(pwd)/report":/output phpcodearcheology /project
    
  5. 5. Install
    curl -LO https://github.com/PhpCodeArcheology/PhpCodeArcheology/releases/latest/download/phpcodearcheology.phar
    
  6. 6. Install
    curl -LO https://github.com/PhpCodeArcheology/PhpCodeArcheology/releases/latest/download/phpcodearcheology.phar.sha256
    

Overview

PhpCodeArcheology/PhpCodeArcheology MCP server exposes PHP static-analysis data through 11 MCP tools. It reports health scores, code-quality problems, detailed metrics, Git hotspots, dependencies, test coverage, knowledge graphs, and change impact. Install the underlying analyzer with Composer and use it against a PHP project to investigate architecture or maintainability from an MCP-compatible client. Reach for it when an agent needs codebase-level analysis rather than type checking or general bug detection.

Use cases

  • Assess the health of a PHP project
  • Find complex and frequently changed hotspots
  • Prioritize refactoring candidates
  • Trace callers before changing a method
  • Identify untested classes and coverage gaps

Key features

  • Expose 11 MCP analysis tools
  • Calculate 60+ PHP code-quality metrics
  • Rank Git hotspots by churn and complexity
  • Analyze dependencies and change impact
  • Map tests and coverage gaps
  • Return knowledge graphs as JSON

Tools11

What PhpCodeArcheology lets your agent do. Expand a tool for its parameters.

Self-reported~192 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

30/31 checks healthy over the last 112d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars94Stargazers on the source repository.
Last commit1mo agoMost recent push to the default branch.
Tools exposed11Callable tools this server registers over MCP.
Directory activity3 viewsConfig copies, upvotes, and views on AllMCPs.

How PhpCodeArcheology works

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.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about PhpCodeArcheology

PhpCodeArcheology/PhpCodeArcheology is an MCP server that connects to PHP codebases for static analysis. It exposes tools for health scores, problem detection, metrics, hotspots, dependencies, impact analysis, test coverage, knowledge graphs, class discovery, and code search. Developers can use it to inspect architecture and maintainability, prioritize refactoring, and assess change risk from an…

Install the underlying analyzer with Composer, using PHP 8.2 or newer. The documented package can be added as a development dependency or installed globally; a standalone PHAR and Docker workflow are also available.

The README identifies Claude Code as an AI integration, but it does not list Cursor or describe client-specific configuration for it.

PHP 8.2 or newer is required. The README specifically lists PHP 8.2, 8.3, 8.4, and 8.5 as supported versions, with Composer required for the standard installation.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewPhpCodeArcheology AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/phpcodearcheology-phpcodearcheology?style=directory)](https://allmcps.com/mcp/phpcodearcheology-phpcodearcheology)
HTML Embed
<a href="https://allmcps.com/mcp/phpcodearcheology-phpcodearcheology"><img src="https://allmcps.com/api/badge/phpcodearcheology-phpcodearcheology?style=directory" alt="PhpCodeArcheology on AllMCPs" /></a>