Cyclomatic Complexity Calculator

Cyclomatic Complexity Calculator MCP Connector for Claude

A+

Quantitatively analyze code maintainability using cyclomatic and cognitive complexity metrics.

2 tools Official Updated Oct 1, 2026 Official Vinkius Partner

This MCP server provides a specialized engine for evaluating the structural complexity of source code. By analyzing decision points such as loops, branches, and logical operators, it computes both Cyclomatic Complexity (structural paths) and Cognitive Complexity (mental effort). Use analyze_complexity to evaluate specific snippets or classify_risk_score to map numeric scores to risk levels like Low, Moderate, High, or Very High. It serves as a bridge for AI agents to perform deep structural analysis on codebases within Cursor, VS Code, Claude Desktop, and Windsurf.

complexitycyclomaticcognitivecode-metricsmaintainability

2 tools expose this connector's capabilities to your AI agent.

classify_risk_score

Classify a complexity score into a risk level

analyze_complexity

Analyze the cyclomatic and cognitive complexity of code

See how to talk to your AI agent using Cyclomatic Complexity Calculator.

Analyze this code snippet for complexity: 'if (x > 0) { return true; } else { return false; }'

The cyclomatic complexity score is 2, and the cognitive complexity score is 1. The risk level is Low.

What is the risk level for a cyclomatic complexity score of 25?

A complexity score of 25 is classified as Very High risk.

Calculate the complexity for a function with three nested if-statements and two while loops.

The analysis shows a cyclomatic complexity of 6 and a cognitive complexity of 8 due to the nesting depth.

The tool calculates Cyclomatic Complexity, which counts structural decision points, and Cognitive Complexity, which measures the mental effort required to understand the code.

Related Connectors