Skip to main content
Glama
CodeHealth MCP Server

CodeHealth MCP Server

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
JAVA_HOMENoJava runtime for PMD (else `java` on `PATH`).
CODEHEALTH_NO_PMDNoSet to `1` to not use PMD.
CODEHEALTH_PMD_HOMENoPMD `pmd-bin-*` directory (or a directory that holds one); also the `install-pmd` target.
CODEHEALTH_CACHE_DIRNoPMD cache and scratch copies (default `~/.cache/codehealth`).
CODEHEALTH_PMD_TIMEOUTNoSeconds per PMD run (default 120).

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

Maintainability analysis for the ~30 languages lizard reads (Python, JavaScript, TypeScript/TSX, Java, Go, C/C++, C#, Ruby, Kotlin, Swift, Rust, PHP and more). Scores files 1-10 (Healthy >= 9, Warning >= 4, Alert < 4) and lists code smells. All paths must be absolute.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}

Tools

Functions exposed to the LLM to take actions

NameDescription
code_health_scoreA

Score one source file for maintainability.

When to use: a quick health check of a file before or after editing it.
Limitations: one file at a time; some smells need a tree-sitter adapter
(Python, JS, TS/TSX, Java, Go) or PMD, see the analyzers field.
Returns: {path, language, score 1-10, category, optimal, analyzers}.
code_health_reviewA

Review one source file and list its code smells.

When to use: to decide what to refactor, or to check that an edit did not
add smells. Fix the findings with the highest severity first.
Limitations: static analysis of a single file; duplication within the
file only (needs PMD). analyzers lists which analyzers ran and which
smells were unavailable for this language.
Returns: {score, category, findings:[{smell, level, function,
start_line, end_line (null for whole-file findings), value, threshold,
severity, message, hint, details}],
pmd_violations?, analyzers:{lizard, tree_sitter, pmd, unavailable_smells}}.
pre_commit_code_health_safeguardA

Check staged and modified files against HEAD before committing.

When to use: before every commit made by an agent.
Limitations: tracked files only (untracked files are skipped); compares
the working tree with HEAD using HEAD's root rules file for both sides.
Returns: {quality_gate: passed|failed, counts, rules_changed?,
files:[{path, verdict (improved|degraded|stable|removed|unknown),
old_score, new_score, new_findings, worsened, improved, fixed}],
cross_file_duplication?: CPD copies and renamed clones between changed files (informational),
analyzers?}.
analyze_change_setA

Compare every changed file on the current branch with its merge base.

When to use: before opening or merging a pull request.
Limitations: compares committed HEAD content only; uncommitted edits are
ignored. The merge base's root rules file is used for both sides.
Returns: {quality_gate, merge_base, counts, rules_changed?, files:[{path, verdict, ...}],
cross_file_duplication?, analyzers?}.
rules_config_validateA

Validate the repository's code health rules file.

When to use: after editing .codehealth/rules.json.
Limitations: checks structure, rule names and threshold names only.
Returns: {rules_file, valid, errors}.
rules_config_list_thresholdsA

List every threshold with its default value and source.

When to use: before overriding a threshold, to see names and defaults.
Limitations: shows defaults, not a repository's overrides.
Languages without their own template fall back to the baseline values
(template: false).
Returns: {language, template, thresholds:[{name, value, operator, published, description}], rules:[names]}.
rules_config_set_ruleA

Set a rule's weight in the repository rules file (0 disables the rule).

When to use: to silence or soften a smell for part of a repository.
Limitations: writes the rules file in the repository root; the first
matching rule set wins, so a new specific glob is placed first.
Returns: {rules_file, rule, weight, matching_content_path}.
rules_config_set_thresholdB

Override a threshold in the repository rules file.

When to use: when a team agrees on a different limit, e.g. longer functions in tests.
Limitations: names must come from rules_config_list_thresholds.
Returns: {rules_file, threshold, value, matching_content_path}.
explain_code_healthA

Explain the Code Health model, a smell, or the score bands.

When to use: to understand a finding or how the score is computed.
Limitations: static documentation; pass a smell name or 'score' as topic.
Returns: {topic, text}.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A3.7/5.0

Scored across 9 tools

Disambiguation4/5

Most tools are clearly distinct (explain vs. analyze vs. rules configuration), and the two closest pairs — code_health_score vs. code_health_review and pre_commit_code_health_safeguard vs. analyze_change_set — are separated by explicit 'when to use' framing (quick score vs. full findings; staged/HEAD vs. merge base). The score/review pair still shares nearly identical inputs and only differs in output depth, so an agent could pick the lighter tool when it needed findings.

Naming Consistency3/5

Conventions are mixed: code_health_score and code_health_review use a noun-prefix form, explain_code_health flips to verb-first, analyze_change_set is verb_noun, pre_commit_code_health_safeguard has no verb at all, and the rules_config_* family uses a different noun_noun_verb ordering. Each name is individually readable, but there is no single predictable pattern to infer a tool from.

Tool Count5/5

Nine tools is well within the ideal range and each one earns its place: two analysis entry points, two change-comparison entry points, documentation, and four rules-file operations. Nothing appears redundant or bolted on.

Completeness4/5

The surface covers the lifecycle well — score, detailed review, explanation, pre-commit gate, branch-level change analysis, and full rules read/validate/write. Gaps remain around reading back the effective repository rules (only defaults are listed) and any multi-file or directory-level scan, since analysis is one file at a time.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues