Skip to content

Use via MCP

Integrate axm-audit into AI agent workflows through the AXM MCP server.

Setup

The axm-audit tool is exposed as audit by the axm-mcp server. No separate installation needed — if axm-mcp is running, the audit tool is available.

Usage

From an AI agent

Call the audit MCP tool with the project path:

JSON
{"tool": "audit", "kwargs": {"path": "/path/to/project"}}

The result includes both a structured data dict (via format_agent) and a compact text summary (via format_agent_text) optimised for token count. The text field uses / lines for ~55-60% token savings:

JSON
{
  "data": {
    "score": 85.0,
    "grade": "B",
    "passed": ["QUALITY_LINT: Lint score: 100/100 (0 issues)"],
    "failed": [{"rule_id": "...", "details": {...}, "fix_hint": "..."}]
  },
  "text": "audit | B 85 | 1 pass · 1 fail\n✓ QUALITY_LINT\n✗ ... details ..."
}

One-shot verification

Use verify instead of audit for a combined quality + governance check:

JSON
{"tool": "verify", "kwargs": {"path": "/path/to/project"}}

This runs audit + init_check + AST enrichment in a single call.

Structured test runner

Use audit_test for structured, token-efficient test feedback:

JSON
{"tool": "audit_test", "kwargs": {"path": "/path/to/project"}}
Parameter Type Default Description
path str "." Path to project root
files list[str] None Specific test files to run
markers list[str] None Pytest markers to filter
stop_on_first bool True Stop on first failure

The result includes a structured data dict (full TestReport fields) and a compact text summary via format_audit_test_text, optimised for token count (~27 tokens green path, ~240 tokens with failures):

Text Only
audit_test | ✅ 42 passed | 1.2s | cov 95.0%

Failure output adds blocks and a coverage section for files below 95%:

Text Only
audit_test | ❌ 10 passed · 2 failed | 3.4s | cov 88.0%
✗ test_foo.py::test_bar (foo.py:42)
  AssertionError: expected 5 got 3
    assert 5 == 3
cov< utils.py 80%

Output Format

The MCP tool returns a structured result:

Key Type Content
score float Composite quality score (0–100)
grade str Letter grade A–F
passed list Strings or dicts with actionable details
failed list Dicts with rule_id, message, details, fix_hint

For scoring details, see Scoring & Grades.