code-health-suite

v0.8.1
io.github.neogeweb3/code-health-suite Checked 1 day ago Published 8 months ago

16 engines, 28 MCP tools for Python code quality.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

analyze_complexity

Analyze Python code complexity for a file or directory. Returns per-function metrics: cyclomatic complexity (McCabe), cognitive complexity, nesting depth, function length, and letter grades (A-F).

ParameterTypeDescription
path *stringFile or directory path to analyze.
sort_bystringSort metric (default: complexity).
thresholdintegerCyclomatic complexity threshold (default: 10).
topintegerReturn only top N functions by complexity. 0 = all.

get_complexity_score

Get an overall complexity health score (0-100) with letter grade (A-F), complexity profile classification, and top offenders. Quick project health check.

ParameterTypeDescription
path *stringDirectory path to analyze.

find_dead_code

Detect unused imports, functions, variables, and arguments in Python code. Supports cross-module analysis to reduce false positives.

ParameterTypeDescription
path *stringFile or directory path to scan.
categorystringFilter by category. Omit for all categories.
min_severitystringMinimum severity level (default: info).

security_scan

Scan Python code for security vulnerabilities: command injection, SQL injection, path traversal, hardcoded secrets, unsafe deserialization, XSS, and more. Maps findings to CWE identifiers.

ParameterTypeDescription
path *stringFile or directory path to scan.

get_security_score

Get an overall security health score (0-100) with grade, profile, and top vulnerability rules. Quick security posture assessment.

ParameterTypeDescription
path *stringDirectory path to scan.

analyze_imports

Analyze Python import dependency graph. Returns module metrics, circular dependencies (cycles), orphan modules, hub modules, and instability scores. Use to understand project architecture.

ParameterTypeDescription
path *stringRoot directory of the Python project to analyze.

get_import_health

Get an import graph health score (0-100) with grade. Penalizes circular dependencies, orphan modules, unstable modules, and hub concentration. Quick architecture health check.

ParameterTypeDescription
path *stringRoot directory to analyze.

find_clones

Detect code clones (duplicated code blocks) in a Python project. Finds Type-1 (exact), Type-2 (renamed), and Type-3 (near-miss) clones. Returns clone pairs with similarity scores and cluster analysis.

ParameterTypeDescription
path *stringDirectory path to scan for clones.
min_linesintegerMinimum function length to consider (default: 5).
thresholdnumberSimilarity threshold 0.0-1.0 (default: 0.8).

analyze_test_quality

Analyze test suite quality: assertion density, test length, naming conventions, magic numbers, and more. Returns per-file and per-test metrics with a quality score (0-100) and grade.

ParameterTypeDescription
path *stringRoot directory containing test files.
max_lengthintegerMax test function length before flagging (default: 50).

find_hotspots

Find code hotspots — files with high git churn AND high complexity. These are the riskiest files in a project: frequently changed AND hard to understand. Requires a git repository. Returns hotspot scores, risk levels, and churn/complexity breakdown.

ParameterTypeDescription
path *stringGit repository root path.
since_daysintegerLook back N days for churn data (default: 180).
topintegerReturn top N hotspots (default: 20).

get_hotspot_score

Get overall hotspot health score (0-100) with grade. Measures concentration of risk (churn x complexity). Lower scores indicate more hotspots that need attention.

ParameterTypeDescription
path *stringGit repository root path.

audit_dependencies

Audit Python project dependencies for outdated packages and known vulnerabilities. Reads requirements.txt and/or pyproject.toml. Returns per-dependency status, latest versions, and CVE/vulnerability details.

ParameterTypeDescription
path *stringProject root directory containing requirements.txt or pyproject.toml.

analyze_change_impact

Analyze the ripple effect of changing specific files. Shows direct dependents, transitive impact, affected tests, and an impact score (fraction of project affected). Use before refactoring to understand blast radius.

ParameterTypeDescription
changed_files *arrayList of file paths (relative to root) that are being changed.
path *stringProject root directory.
max_depthintegerMax transitive dependency depth (default: 10).

analyze_coupling

Analyze module coupling metrics: afferent coupling (Ca), efferent coupling (Ce), instability (Ce/(Ca+Ce)), and hub scores. Identifies tightly-coupled modules that may resist change.

ParameterTypeDescription
path *stringProject root directory.

analyze_type_coverage

Analyze Python type annotation coverage: function signatures, parameters, return types, Any usage, and type: ignore comments. Returns per-file metrics and coverage percentages.

ParameterTypeDescription
path *stringFile or directory path to analyze.

get_type_score

Get overall type coverage health score (0-100) with grade. Measures annotation completeness, Any usage, and type: ignore density.

ParameterTypeDescription
path *stringFile or directory path to analyze.

audit_env_vars

Audit environment variable usage: find undefined vars referenced in code, unused vars in .env files, secrets in templates, and missing .env.example entries. Supports Python, JavaScript, and shell scripts.

ParameterTypeDescription
path *stringProject root directory.

audit_git_commits

Audit recent git commits in a repository. Extracts changed files and runs static analysis (security scan, complexity) on each commit. Returns per-commit grades, security findings, and complexity violations.

ParameterTypeDescription
repo *stringPath to the git repository to audit.
authorstringFilter commits by author name.
commitsintegerNumber of recent commits to audit (default: 10).
severitystringMinimum security finding severity (default: low).
sincestringAudit commits since date (e.g., '3 days ago', '2026-03-01').
thresholdintegerComplexity threshold for flagging functions (default: 10).

get_git_audit_score

Get a quick overall grade and score for recent commits in a repo. Returns the aggregate score, grade, commit count, and security summary.

ParameterTypeDescription
repo *stringPath to the git repository.
commitsintegerNumber of recent commits to audit (default: 10).

check_naming

Check Python naming conventions (PEP 8). Detects violations: functions/methods must be snake_case, classes must be CamelCase, constants must be UPPER_SNAKE_CASE. Returns violations with suggestions.

ParameterTypeDescription
path *stringFile or directory path to check.

get_naming_score

Get a naming convention health score (0-100) with grade. Measures PEP 8 naming compliance: snake_case functions, CamelCase classes, UPPER_SNAKE_CASE constants.

ParameterTypeDescription
path *stringDirectory path to check.

scan_todos

Scan source code for technical debt markers: TODO, FIXME, HACK, XXX, BUG, NOTE, OPTIMIZE, REFACTOR comments. Returns items with file, line, tag, severity, and message. Optionally enriches with git blame metadata.

ParameterTypeDescription
path *stringFile or directory path to scan.
blamebooleanEnrich with git blame metadata (author, date). Slower.
severitystringFilter by minimum severity level.
tagstringFilter by specific tag (e.g., TODO, FIXME, HACK).

get_todo_score

Get a technical debt health score (0-100) with grade based on density and severity of TODO/FIXME/HACK markers. Shows hotspot files.

ParameterTypeDescription
path *stringDirectory path to scan.

detect_bugs

Detect common Python semantic bugs using AST analysis. Finds 8 categories: missing f-strings, mutable class variables, late-binding closures, call-expression defaults (datetime.now()), mutable default arguments, assert-on-tuple, unreachable code, and unreachable exception handlers. Every finding indicates a likely real bug, not a style violation.

ParameterTypeDescription
path *stringFile or directory path to scan.
min_severitystringMinimum severity to report (default: info).
rulesarrayFilter by specific rules. Options: missing-fstring, mutable-class-var, late-binding-closure, call-default, mutable-default-arg, assert-tuple, unreachable-code, unreachable-except. Omit for all rules.

get_bug_score

Get a bug detection health score (0-100) with grade (A-F), bug profile classification (clean/fstring_heavy/closure_heavy/etc.), and breakdown by rule and severity. Quick bug health check.

ParameterTypeDescription
path *stringDirectory path to scan.

audit_docstrings

Audit Python docstring coverage and quality. Checks public functions, methods, classes, and modules for missing or low-quality docstrings. Returns per-entity coverage, missing docstrings, and quality issues.

ParameterTypeDescription
path *stringFile or directory path to audit.

get_docstring_score

Get a docstring coverage health score (0-100) with grade. Measures what percentage of public entities have docstrings and penalizes low-quality docstrings. Shows worst files.

ParameterTypeDescription
path *stringDirectory path to audit.

full_health_check

Run all analyses (complexity + dead code + security + imports + clones + test quality + type coverage + env audit + naming + TODO debt + bug detection + docstring coverage) on a Python project and return a combined health report with scores, grades, and top issues. Note: hotspot, dependency, and change impact require additional context (git repo, requirements files, changed files) so are excluded from this scan.

ParameterTypeDescription
path *stringDirectory path to analyze.