Time Complexity MCP: Static Analysis Tool Feeds Big-O Complexity to AI Coding Agents

✍️ OpenClawRadar📅 Published: February 27, 2026🔗 Source
Time Complexity MCP: Static Analysis Tool Feeds Big-O Complexity to AI Coding Agents
Ad

Time Complexity MCP is an MCP server that performs static analysis on code to determine Big-O time complexity, then feeds those values directly to AI coding agents. The tool bypasses the token consumption and potential inaccuracies that occur when frontier models attempt to analyze complexity themselves.

How It Works

The server parses code into Abstract Syntax Trees (ASTs) using tree-sitter, then analyzes them to detect:

  • Loop nesting patterns
  • Recursion patterns
  • Known standard library costs

It reports per-function Big-O complexity with line annotations that AI agents can access as a tool.

What It Detects

The tool identifies specific complexity patterns:

  • .contains() inside a for loop → O(n²)
  • .sort() with .indexOf() in the comparator → O(n² log n)
  • Branching recursion like fibonacci → O(2ⁿ)
  • Constant-bound loops like for i in range(10) → O(1)
Ad

Supported Languages

The tool currently supports JavaScript, TypeScript, Python, Java, Kotlin, and Dart.

Real-World Application

The developer ran the tool on its own codebase and found:

  • O(n³) in the directory scanner
  • O(n²) in the formatting utils

These issues were fixed based on the tool's own report, demonstrating practical self-improvement.

Availability

Time Complexity MCP is open source with prebuilt releases available at https://github.com/Luzgan/time-complexity-mcp.

📖 Read the full source: r/ClaudeAI

Ad

👀 See Also

Why Your Claude Code UI Output Drifts and How a Structured Spec Fixes It
Tools

Why Your Claude Code UI Output Drifts and How a Structured Spec Fixes It

A developer explains that inconsistent UI output from Claude Code isn't a prompt problem — it's a format problem. Providing exact hex codes, font weights, spacing, screen states, and transitions eliminates drift. They also open-sourced an MCP server that converts screen recordings into structured specs.

OpenClawRadar
Jean-Claude: A Satirical LLM Frontend Mocking EU AI Regulation, with 412 Cookie Partners and VAT Invoices Every 5 Messages
Tools

Jean-Claude: A Satirical LLM Frontend Mocking EU AI Regulation, with 412 Cookie Partners and VAT Invoices Every 5 Messages

Jean-Claude is a satirical LLM frontend that applies extreme EU-style bureaucracy to AI usage: 412 cookie partners, four-eyes principle requiring co-signature, per-token CO₂ tracking with mandatory €offset, VAT invoices every 5 messages, and a compliance center with fake GDPR/AI Act metrics.

OpenClawRadar
Startup Bookkeeper: Free Claude Skill for Small Business Tracking
Tools

Startup Bookkeeper: Free Claude Skill for Small Business Tracking

Startup Bookkeeper is an open-source Claude AI skill that helps bootstrapped founders track expenses by categorizing transactions from plain English descriptions, processing receipt photos with OCR, and generating dashboards or P&L statements.

OpenClawRadar
Rift: A Better Alternative to Git Worktrees with Instant Copy-on-Write Snapshots
Tools

Rift: A Better Alternative to Git Worktrees with Instant Copy-on-Write Snapshots

Rift uses btrfs or APFS snapshots to create instant, space-efficient copies of Git repositories. Initialization, creation, and listing via CLI or JavaScript FFI.

OpenClawRadar