AST Metrics MCP server for codebase architectural analysis

AST Metrics MCP server for codebase architectural analysis

ast-metrics•byhalleck45

AST Metrics runs as an MCP server that exposes complexity, coupling, dependency and risk analysis of a codebase to AI coding agents.

License: MIT•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Exposes on-demand access to complexity, coupling, dependencies and risk for AI coding agents such as Claude Code, Cursor or Copilot.
  • •Measures codebase complexity, architecture, coupling, bus factor and test quality, flagging only what got worse on each pull request.
  • •Works offline and deterministically, producing the same verdict for the same code.
  • •Analyzes projects in Go, PHP, Python, Rust, Java, C#, TypeScript and C++.

BEST FOR

  • •Asking an AI agent which files are the riskiest to refactor.
  • •Understanding what would break if a specific class changes.
  • •Giving AI coding agents architectural awareness of a codebase.

ABOUT AST-METRICS

AST Metrics MCP server for codebase architectural analysis is cataloged as an MCP server attributed to halleck45. AST Metrics runs as an MCP server that exposes complexity, coupling, dependency and risk analysis of a codebase to AI coding agents. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for AST Metrics MCP server for codebase architectural analysis are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

How is the MCP server launched?

The server is started with the command ast-metrics mcp pointed at a project directory.

Which AI coding agents can use it?

It works with Claude Code, Cursor or Copilot.

Upstream README

View this exact version on GitHub

README.md · d8e2a43bbc79 · Fetched 2026-11-13 12:10:27 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

AST Metrics

No server. No account. One binary.
Code is written faster than it can be reviewed. AST Metrics measures your codebase (complexity, architecture, coupling, bus factor, test quality) and, on every pull request, flags only what got worse.
Deterministic: same code, same verdict. Works offline: no data leaves your machine.
Fast: 20,000+ lines of code analyzed per second, on a laptop.

Go · PHP · Python · Rust · Java · C# · TypeScript · C++


CI GitHub Release License: MIT GitHub all releases Go Report Card codecov Go Reference Mentioned in Awesome Go AST-Metrics report

Documentation | Contributing

The AST Metrics report: a plain-language verdict, with scores for complexity, maintainability, test isolation and bus factor
AST Metrics analyzing itself. Explore this report live, or try it on any public repository, without installing anything.


Getting Started

Install with Homebrew (macOS, Linux):

brew install ast-metrics/tap/ast-metrics

or with the install script (any platform, downloads an ./ast-metrics binary in the current directory):

curl -fsSL https://install.ast-metrics.dev | sh

Then analyze your project:

ast-metrics analyze /path/to/your/code

You get a summary right in your terminal: maintainability, estimated bug probability, coupling, and the hotspots worth refactoring first. Add --report-html=<dir> when you want a full report, or --tui to explore the results in a full-screen dashboard. Nothing is written to disk unless you ask for it.

Docker image, npm, pip, Composer, .deb/.rpm packages and manual downloads: see the installation instructions.

Review a pull request, without the noise

ast-metrics review

It compares your branch with its base and reports only new or worsened findings: a new overly complex function, a coupling regression, a class that lost maintainability. Legacy code stays quiet. Unlike AI code reviewers, it is deterministic and free: same code, same verdict, no per-seat pricing. Add --fail-on=high when you want it to block the merge.

➡️ Reviewing your changes

What you get

PR reviewast-metrics review flags only what got worse against the base branch
Architectural analysisCoupling, instability, community detection: catch design drift early
Code metricsCyclomatic complexity, maintainability index, lines of code
Activity metricsCommit history and bus factor: know who owns what
LinterEnforce thresholds on complexity, coupling, volume and architecture
CI/CD readyGitHub Actions, GitLab CI, any pipeline; exits non-zero on violations
Report formatsHTML dashboard, JSON, Markdown, SARIF, OpenMetrics
MCP serverGive AI coding agents architectural awareness

The interactive dependency graph: hubs, natural communities and circular dependencies at a glance
The dependency graph: hubs, natural communities and circular dependencies at a glance.

Lint your architecture

ast-metrics init                      # create a .ast-metrics.yaml config file
ast-metrics ruleset add architecture  # pick rulesets (volume, complexity...)
ast-metrics lint

Thresholds live in your YAML config: maximum complexity, coupling limits, forbidden dependencies between components, size limits per method... Legacy codebase with hundreds of violations? Run ast-metrics baseline once: it snapshots today's violations, and lint only fails on new ones.

➡️ Rulesets, thresholds and baseline

Run it in CI

ast-metrics ci runs the linter, generates every report (HTML, JSON, Markdown, SARIF, OpenMetrics) and exits non-zero when violations are found. On GitHub, a single step is enough:

- uses: ast-metrics/action-ast-metrics@v2

On each pull request, the action runs ast-metrics review and comments with only the new or worsened findings.

➡️ CI/CD guides: GitHub Actions, GitLab CI

Give your AI agent architectural awareness

AI coding agents read code linearly. Running as an MCP server, AST Metrics gives Claude Code, Cursor or Copilot on-demand access to complexity, coupling, dependencies and risk, so you can ask things like "What are the riskiest files to refactor?" or "What would break if I change the UserService class?".

ast-metrics mcp .

➡️ MCP server setup and tools

Supported languages

Go, PHP, Python, Rust, Java, C#, TypeScript and C++.

C++ is read from its syntax alone, without a preprocessor or the build. A .h file is analyzed when its content looks like C++, so plain C headers are left alone. Both branches of an #ifdef are counted, code wrapped in a macro the parser cannot expand is only partly understood, and a lambda's complexity goes to the function that holds it. An #include is found from the including file, then from the project's own directories, never from the compiler's include paths.

Contributing

Discussions, bug reports and pull requests are welcome: start here. AST Metrics is open-source software licensed under the MIT license.

Support the project

AST Metrics is built and maintained on free time. If it saved you some of yours:

  • ⭐ Star the repository. It costs nothing and it is how most developers discover the tool.
  • ❤️ Become a sponsor. Sponsorship directly funds maintenance time and the addition of new languages and metrics.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for AST Metrics MCP server for codebase architectural analysis from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/ast-metrics)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools