MCP server for code analysis and vulnerability detection using Code Property Graph (CPG) with taint analysis for injection vulnerabilities (SQLi, XSS, Command Injection)
code-reason provides 9 well-structured tools with explicit schemas and descriptions. All tools have clear verb-noun naming (reason_analyze_project, reason_find_callees, etc.) and descriptions ranging 100 - 200 chars, meeting baseline expectations. Input schemas are visible and typed. However, output schemas are not documented in the source, responses are serialized JSON objects without explicit field documentation for downstream tool chaining. Error handling is minimal (basic require() checks); no recovery guidance or actionable error messages. Parameters lack enum constraints where applicable (e.g., direction in reason_query_dataflow accepts 'forward'/'backward' as free strings). No tool annotations (readOnlyHint, destructiveHint) despite all tools being read-only. Missing dependency documentation (e.g., 'reason_scan_injections requires reason_analyze_project first' is stated in description but not formalized). Average tool score: 62/100.
Analyze a project directory or source file, building the Code Property Graph with all analysis passes for vulnerability detection.
Find all functions called by a given function. Useful for understanding what a function does and tracing data flow forward through the call graph. Specify either functionName or file+line. Requires reason_analyze_project first.
Find all functions that call a given function. Useful for understanding how a function is used and tracing data flow backwards through the call graph. Specify either functionName or file+line. Requires reason_analyze_project first.
Identify HTTP handlers, API endpoints, CLI entry points, and other attack surface in the analyzed code. Detects Spring, Servlet, JAX-RS, Flask, and Django handlers. Requires reason_analyze_project to be called first.
Get detailed information about a specific finding including CWE description and remediation advice.
Output schemas not documented. Tools return serialized JSON (FindCalleesResult, AnalyzeProjectResult, etc.) but no explicit field documentation visible in source. Downstream tools cannot reliably extract required fields for chaining (e.g., does reason_find_callees return file paths for reason_query_dataflow?).
Enum constraints missing. Parameters like 'direction' (forward/backward) and 'filter' (http/cli/all) accept free strings instead of declared enums. LLMs may hallucinate invalid values (e.g., 'sideways', 'websocket').
No tool annotations. All 9 tools are read-only (no state modification), but none declare readOnlyHint. Agents cannot distinguish safe-to-retry tools from destructive ones without manual inspection.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | C | 68 | 2026-07-28+ | v2 |
List all supported vulnerability checks, including their source/sink/sanitizer definitions per language.
Query data flow reachability from a given code location. Shows all nodes reachable via DFG edges in the specified direction. Use forward to see where data flows to (e.g., from a source). Use backward to see where data comes from (e.g., into a sink). Requires reason_analyze_project first.
Scan for injection vulnerabilities (SQLi, XSS, Command Injection) using taint analysis with pre-configured source/sink/sanitizer definitions. Requires reason_analyze_project to be called first.
Trace the data-flow path between any two points in the code, returning every intermediate step with code context. Primary input: source and sink coordinates (sourceFile/sourceLine + sinkFile/sinkLine) — use this whenever you know where tainted data enters and where it is consumed, even if reason_scan_injections did not flag the flow. As a shortcut, pass findingId to replay a scanner-reported finding.
Minimal error handling. Tools use bare require() checks that throw IllegalArgumentException with generic messages ('No function found matching...'). No recovery guidance, no actionable next steps for LLMs.
Implicit tool dependencies. Descriptions state 'Requires reason_analyze_project first' but no formal dependency declaration. If reason_scan_injections is called before reason_analyze_project, it will fail with a cryptic error (globalAnalysisResult is null).