Use codeql_create_database then codeql_analyze (mantis_codeql MCP server) when you need dataflow-aware SAST beyond what regex/pattern tools (semgrep, ast-grep) can prove -- CodeQL's query suites trace actual source-to-sink data flow through the codebase.
Workflow:
codeql_create_database({ source_root, language, database_path })once per target/language. This is slow (can take minutes on large repos); don't repeat it unless the source changed.codeql_analyze({ database_path, query_suite }). Defaultquery_suiteis"security-extended"; use"security-and-quality"only if the user wants broader quality findings too.- Treat every SARIF result as a
candidatewith a dataflow-backed path, which is stronger recall evidence than a plain grep match -- but it is still not a confirmed finding. CodeQL's own dataflow models can miss framework-specific sanitization; verify the path manually before validating. - If
codeqlreportsavailable: false, fall back tosemgrep_scanandprogram-analysis'ssource_sink_scan/ast_grep_scanfor recall, and tell the user CodeQL-grade dataflow coverage wasn't available for this run.