cert-review

v1.4.4
io.github.RaminNietzsche/cert-review-mcp Checked 17 hours ago Published 9 days ago

SEI CERT C/C++ code review: rule lookup, clang-tidy and cppcheck findings mapped to CERT rules

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

list_rules List coding-standard rules by filter

List rules from the bundled databases, filtered by standard, language, category, kind, risk level, CERT detectability, MISRA/AUTOSAR classification or checker coverage. Default standard is SEI CERT C/C++ (388 rules and recommendations); standard='misra' or 'autosar' lists MISRA C:2012 (221), MISRA C++:2023 (178) or AUTOSAR C++14 (397) guidelines. Use to enumerate rules by structured criteria, e.g. all L1 C++ rules no checker detects or all mandatory MISRA C rules. Do not use for free-text lookup (use search_rules) or one rule's details (use get_rule). Reads bundled data only; fast. Returns sum…

ParameterTypeDescription
categorystringSEI CERT three-letter category, e.g. EXP expressions, MEM memory, INT integers, STR strings, CON concurrency. Ignored for other standards' sections.
classificationstringMISRA/AUTOSAR classification; SEI CERT rules have none and are excluded when this is set.
coveragestringChecker coverage tier: deterministic = a rule-specific checker exists; partial = only general checkers; llm-only = no checker, manual review needed. Matches either the all-mappings or the pinned-toolc…
detectableCERT's own 'Detectable' flag (true = automatable in principle). Omit for both.
kindstringrule = normative rule; recommendation = CERT advisory (C only); directive = MISRA directive.
langstringc = C rules (SEI CERT C, MISRA C), cpp = C++ rules (SEI CERT C++, MISRA C++, AUTOSAR).
levelstringCERT priority level; L1 is the most urgent.
limitintegerMaximum summaries returned (each ~400 bytes).
standardstringRule set: cert = SEI CERT C and C++ (default; the only standard with full rule text); misra = MISRA C:2012 (with Amendments 1-4, i.e. the MISRA C:2023 set) and MISRA C++:2023; autosar = AUTOSAR C++14;…

search_rules Search coding-standard rules by keyword

Rank rules by keyword relevance to a free-text query: API names (strcpy, malloc, pthread_mutex_lock), concepts (integer overflow) or a rule ID in any accepted form (EXP34-C, misra-c2012-10.4, A5-2-2). Searches SEI CERT C/C++ by default; set `standard` for MISRA or AUTOSAR, where only our one-line summaries, section names and facts are searchable (plus licensed texts when loaded). Use when you know what the code does but not which rule applies. Do not use for structured filters (use list_rules) or to read a rule (use get_rule). Case-insensitive term counting, not semantic search; 1-character to…

ParameterTypeDescription
query *stringKeywords separated by spaces; title hits weigh 8x body hits.
langstringRestrict to C (c) or C++ (cpp) rules.
limitintegerMaximum results.
standardstringRule set: cert = SEI CERT C and C++ (default; the only standard with full rule text); misra = MISRA C:2012 (with Amendments 1-4, i.e. the MISRA C:2023 set) and MISRA C++:2023; autosar = AUTOSAR C++14;…

get_rule Get one coding-standard rule

Return the full record of one rule. SEI CERT: text, noncompliant and compliant code examples, exceptions, risk assessment, CWE IDs, related MISRA/AUTOSAR guidelines (cross_references), the checkers that detect it, and how the profile adjusts or disables it. MISRA/AUTOSAR: classification, section, enforcement, related CERT rules, checkers and our one-line summary; the official text appears only when the user loaded a licensed rule-texts file (text_source, quote_required). Use before judging or explaining a finding, or to copy the verbatim `quote` validate_findings requires. Do not use to discov…

ParameterTypeDescription
rule_id *stringRule ID, case-insensitive. SEI CERT: category, two digits, -C or -CPP (EXP34-C). MISRA C:2012: MISRA-C-2012-<n.n> or MISRA-C-2012-DIR-<n.n>. MISRA C++:2023: MISRA-CPP-2023-<n.n.n> (DIR- for directives…
include_examplesbooleanInclude code examples in `text` and `examples`.
profilestringReview profile: 'default' (plain SEI CERT), 'ceph' (Ceph severities, suppressions and idioms), 'misra' (MISRA C:2012 + MISRA C++:2023), 'autosar' (AUTOSAR C++14) or an absolute path to a profile .yaml…

get_rule_coverage Summarize checker coverage per standard

Count rules per detection tier: deterministic (a rule-specific checker exists, e.g. a clang-tidy cert-* alias or the cppcheck MISRA addon), partial (only general checkers map) and llm-only (no checker; manual review needed), for all checker mappings, for the pinned reference toolchain (clang-tidy and Clang Static Analyzer 19.1.7, cppcheck 2.17.1, Semgrep with the bundled rules) and for the extended toolchain (plus Infer and the CodeQL CERT packs). SEI CERT by default; set `standard` for MISRA or AUTOSAR (adds by_standard and licensed_texts). Use to judge how much of a review static analysis ca…

ParameterTypeDescription
include_idsbooleanAdd rules_all_mappings, rules_runnable and rules_extended: rule ID lists per tier (~15 KB).
kindstringCount only rules, CERT recommendations or MISRA directives.
langstringCount only C (c) or C++ (cpp) rules.
standardstringRule set: cert = SEI CERT C and C++ (default; the only standard with full rule text); misra = MISRA C:2012 (with Amendments 1-4, i.e. the MISRA C:2023 set) and MISRA C++:2023; autosar = AUTOSAR C++14;…

check_files Check C/C++ files for coding-standard violations

Run clang-tidy, the Clang Static Analyzer and cppcheck (plus Semgrep and Infer when installed, CodeQL on request; see `tools`) on a C/C++ file or a directory (recursive) and return every finding mapped to SEI CERT rule IDs, or to MISRA C:2012 / MISRA C++:2023 / AUTOSAR C++14 IDs when `standards` (or the profile) selects them; MISRA C adds the cppcheck MISRA addon on .c files. Use for whole-file or whole-tree audits; for a change set use check_diff, which keeps only changed lines. Runs the analyzers as local subprocesses (4 in parallel, 300 s timeout per file and tool) and writes no files. Take…

ParameterTypeDescription
path *stringAbsolute path of a C/C++ file or a directory to scan recursively. Files are picked by the profile's extensions and exclude_paths.
baseline_pathAbsolute path of a baseline JSON written by `cert-review baseline create`. Findings recorded there are left out and counted in `baseline`; file paths in it are relative to its directory. Matching uses…
compdbAbsolute path of the directory that contains compile_commands.json. Strongly recommended: without it files are compiled with guessed flags and often fail to parse. Omitted: auto-detected in root, root…
include_suppressedbooleanAlso return findings hidden by the profile or by `// cert-review: ignore <RULE>` comments, each with its suppression reason (for audits).
langstringAnalyse only .c files (c) or only C++ files (cpp).
min_confidencenumberDrop findings below this confidence. Rule-specific checkers score 0.9, general checkers 0.3-0.65, +0.1 when two tools agree. 0.5 keeps most real hits.
profilestringReview profile: 'default' (plain SEI CERT), 'ceph' (Ceph severities, suppressions and idioms), 'misra' (MISRA C:2012 + MISRA C++:2023), 'autosar' (AUTOSAR C++14) or an absolute path to a profile .yaml…
rootAbsolute project root: adds root/src, root/include and similar as include paths, enables compdb auto-detection, and is the base for the profile's path globs.
standardsStandards to map findings to, overriding the profile's `standards` (default profile: cert). misra-c-2012 applies to .c files (adds the cppcheck MISRA addon); misra-cpp-2023 and autosar-cpp14 to C++ fi…
toolsAnalyzers to run; omit for the default set: clang-tidy, clangsa and cppcheck plus semgrep and infer when installed. clang-tidy = cert-*/bugprone checks plus Clang Static Analyzer checks; clangsa = sta…

check_diff Check changed C/C++ lines for coding-standard violations

Run the check_files analyzers on the C/C++ files of a change and keep only findings on added or modified lines, mapped to the same standards (`standards` or the profile; SEI CERT by default). The change is `base`..`head` in the git repo at `repo`, `base` against the working tree when head is omitted, or a pasted unified diff (`diff_text`, paths relative to repo). Use for pull-request or pre-commit review; for whole files use check_files. Runs `git diff` and the analyzers locally; writes nothing. For git refs, files must exist at `head` or line numbers will not match. With `diff_text`, files ar…

ParameterTypeDescription
repo *stringAbsolute path of the git checkout; diff paths are resolved against it.
baseBase git ref (branch, tag or SHA). Required unless diff_text is given.
baseline_pathAbsolute path of a baseline JSON written by `cert-review baseline create`. Findings recorded there are left out and counted in `baseline`; file paths in it are relative to its directory. Matching uses…
compdbAbsolute path of the directory that contains compile_commands.json. Strongly recommended: without it files are compiled with guessed flags and often fail to parse. Omitted: auto-detected in root, root…
diff_contextintegerAlso report findings within this many lines of a changed line (confidence scaled by 0.85).
diff_textUnified diff text (git diff format, a/ b/ prefixes allowed). Overrides base and head.
headHead git ref. Omit to compare base with the working tree (uncommitted changes included).
include_suppressedbooleanAlso return findings hidden by the profile or by `// cert-review: ignore <RULE>` comments, each with its suppression reason (for audits).
min_confidencenumberDrop findings below this confidence. Rule-specific checkers score 0.9, general checkers 0.3-0.65, +0.1 when two tools agree. 0.5 keeps most real hits.
profilestringReview profile: 'default' (plain SEI CERT), 'ceph' (Ceph severities, suppressions and idioms), 'misra' (MISRA C:2012 + MISRA C++:2023), 'autosar' (AUTOSAR C++14) or an absolute path to a profile .yaml…
standardsStandards to map findings to, overriding the profile's `standards` (default profile: cert). misra-c-2012 applies to .c files (adds the cppcheck MISRA addon); misra-cpp-2023 and autosar-cpp14 to C++ fi…
toolsAnalyzers to run; omit for the default set: clang-tidy, clangsa and cppcheck plus semgrep and infer when installed. clang-tidy = cert-*/bugprone checks plus Clang Static Analyzer checks; clangsa = sta…

explain_finding Explain a SEI CERT finding and suggest a fix

Explain one finding: a short rule summary, why the finding matches the rule (checker mapping, APIs, shared identifiers), the rule's noncompliant/compliant example pair most similar to the flagged code (token overlap), a unified diff between them, and concrete fix steps derived from that compliant example plus per-API and per-category advice. Use after check_files or check_diff when you need to explain or fix a finding; pass the finding object unchanged, or rule_id with file and line, or with a code snippet. Use get_rule instead for the full rule text and all examples, and validate_findings (no…

ParameterTypeDescription
finding *The finding: an item of check_files/check_diff `findings` as is, or {rule_id, file, line} or {rule_id, code}.
context_linesintegerLines shown around the flagged line in finding.snippet (and used as fallback tokens when the line is blank).
profilestringReview profile: 'default' (plain SEI CERT), 'ceph' (Ceph severities, suppressions and idioms), 'misra' (MISRA C:2012 + MISRA C++:2023), 'autosar' (AUTOSAR C++14) or an absolute path to a profile .yaml…

build_review_packet Build a SEI CERT review packet

Build a packet for reviewing code against SEI CERT rules that analyzers cannot decide: code hunks, each with up to max_rules_per_hunk candidate rules (picked by token/API heuristics and profile idioms, rules fully covered by a specific checker left out) and their text excerpts. Diff mode (`repo` plus `base` or `diff_text`): changed lines with 3 lines of context. Path mode (`path`): whole files. Hunks are cut into 60-line windows. Use after check_diff or check_files; judge each hunk, then send your findings to validate_findings. Read-only; run_static=true also runs the analyzers (same cost as c…

ParameterTypeDescription
baseDiff mode: base git ref; required with repo unless diff_text is given.
compdbAbsolute path of the directory that contains compile_commands.json. Strongly recommended: without it files are compiled with guessed flags and often fail to parse. Omitted: auto-detected in root, root…
diff_contextintegerLines around a change to include in static analysis (confidence * 0.85).
diff_textDiff mode: unified diff text, paths relative to repo.
headDiff mode: head git ref; omit for the working tree.
max_rules_per_hunkCandidate rules per hunk. Omit to use the profile's value (6 in both bundled profiles).
min_confidencenumberMinimum confidence for bundled static analysis when run_static is true.
pathPath mode: absolute path of a file or directory. Ignored when diff mode applies.
profilestringReview profile: 'default' (plain SEI CERT), 'ceph' (Ceph severities, suppressions and idioms), 'misra' (MISRA C:2012 + MISRA C++:2023), 'autosar' (AUTOSAR C++14) or an absolute path to a profile .yaml…
repoDiff mode: absolute path of the git checkout.
run_staticbooleanAlso run the analyzers and list their findings per hunk so they are not repeated. Set false if you already ran check_diff/check_files.
standardsStandards to map findings to, overriding the profile's `standards` (default profile: cert). misra-c-2012 applies to .c files (adds the cppcheck MISRA addon); misra-cpp-2023 and autosar-cpp14 to C++ fi…
toolsAnalyzers to run; omit for the default set: clang-tidy, clangsa and cppcheck plus semgrep and infer when installed. clang-tidy = cert-*/bugprone checks plus Clang Static Analyzer checks; clangsa = sta…

validate_findings Validate manual SEI CERT findings

Accept or reject findings written from a build_review_packet review, with reasons. A finding passes only if its rule_id exists (C++ rules are rejected on .c files, MISRA C rules on C++ files), its quote is a passage of 20+ characters found in that rule's text or examples (case, whitespace, curly quotes and markdown are normalised; MISRA/AUTOSAR need a quote only when a licensed rule-texts file is loaded, otherwise accepted findings carry grounding='rule-id-only'), it has a file, a line >= 1 and a message, and the profile does not disable the rule. With `packet`, the line must also fall inside…

ParameterTypeDescription
findings *arrayFindings to check; an empty list is valid.
packetThe build_review_packet result (or just {hunks}) to enforce hunk and candidate-rule bounds. Strongly recommended.
profilestringReview profile: 'default' (plain SEI CERT), 'ceph' (Ceph severities, suppressions and idioms), 'misra' (MISRA C:2012 + MISRA C++:2023), 'autosar' (AUTOSAR C++14) or an absolute path to a profile .yaml…

format_pr_review Draft PR comment with hints and style nits

Build a single markdown PR comment from `check_diff` output and `build_review_packet`: static tool summary, heuristic candidate-rule table, Ceph idiom hints, CodingStyle nits, and optional functional bullets. Does not post anywhere.

ParameterTypeDescription
check_resultFull object returned by check_diff (tools, findings, warnings, summary).
functional_notesExtra functional review bullets; omit to auto-suggest from packet code.
github_footerAppend collapsible footer: pull_request_target, mcp, or github-action. Omit to skip.
packetResult from build_review_packet (needs `hunks`).
profilestringReview profile: 'default' (plain SEI CERT), 'ceph' (Ceph severities, suppressions and idioms), 'misra' (MISRA C:2012 + MISRA C++:2023), 'autosar' (AUTOSAR C++14) or an absolute path to a profile .yaml…
rootRepo root for relative paths in the markdown.
scopeOne line: merge-base..head and file list.
titleHeading for the comment, e.g. the PR title.

review_pr Review a PR change (static + hints + draft comment)

Run check_diff on `base`..`head`, build_review_packet for heuristic hints, and format_pr_review into one markdown comment (static table, candidate rules, idioms, style nits, functional bullets). Does not post. Prefer this over three separate calls. profile ceph auto-builds synthetic compdb when needed.

ParameterTypeDescription
base *stringBase git ref (merge-base or target branch SHA).
repo *stringAbsolute path of the git checkout.
baseline_pathAbsolute path of a baseline JSON written by `cert-review baseline create`. Findings recorded there are left out and counted in `baseline`; file paths in it are relative to its directory. Matching uses…
compdbAbsolute path of the directory that contains compile_commands.json. Strongly recommended: without it files are compiled with guessed flags and often fail to parse. Omitted: auto-detected in root, root…
diff_contextOmit to use profile default (ceph: 3).
functional_notesExtra functional bullets for the comment.
github_footerAppend collapsible footer: pull_request_target, mcp, github-action. Omit when drafting for manual paste.
headHead ref (PR branch). Default: working tree.
min_confidencenumberDrop findings below this confidence. Rule-specific checkers score 0.9, general checkers 0.3-0.65, +0.1 when two tools agree. 0.5 keeps most real hits.
profilestringReview profile: 'default' (plain SEI CERT), 'ceph' (Ceph severities, suppressions and idioms), 'misra' (MISRA C:2012 + MISRA C++:2023), 'autosar' (AUTOSAR C++14) or an absolute path to a profile .yaml…
scopeOptional scope line; auto-generated when omitted.
standardsStandards to map findings to, overriding the profile's `standards` (default profile: cert). misra-c-2012 applies to .c files (adds the cppcheck MISRA addon); misra-cpp-2023 and autosar-cpp14 to C++ fi…
titlePR title for the comment heading.
toolsAnalyzers to run; omit for the default set: clang-tidy, clangsa and cppcheck plus semgrep and infer when installed. clang-tidy = cert-*/bugprone checks plus Clang Static Analyzer checks; clangsa = sta…

format_findings Format SEI CERT findings as a report

Render findings as a report or review payload without sending it. style: markdown (string); github (object for POST /repos/{owner}/{repo}/pulls/{n}/reviews, event COMMENT, one comment per finding); gitlab (array of merge-request discussion bodies; position SHAs are placeholders to fill from diff_refs); sarif (SARIF 2.1.0 object); codequality (GitLab Code Quality array); gitlab-sast (GitLab SAST report object). Use as the last step, then show drafted comments to the user before anyone posts them. Pass findings unchanged from check_files/check_diff `findings` or validate_findings `accepted`. Pur…

ParameterTypeDescription
findings *arrayFindings exactly as returned by check_files, check_diff (findings) or validate_findings (accepted).
rootAbsolute repository root; file paths in the output are made relative to it. Omit and paths become relative to the server's working directory.
stylestringOutput format; see the tool description for each shape.
warnings`warnings` from check_files/check_diff; shown as a partial-analysis notice in markdown, github and sarif.