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

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 aforloop → 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)
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
👀 See Also

Mind Keg MCP: Persistent Memory for Claude Code and MCP-Compatible Agents
Mind Keg MCP v0.1.1 is an open-source MCP server that provides persistent memory for Claude Code and other MCP-compatible agents. It stores learnings locally via SQLite and retrieves them via semantic search, allowing AI coding assistants to remember context between sessions.

OpenClaw: Revolutionizing Website Maintenance with Continuous Surveillance
OpenClaw, an innovative AI-driven agency, redefines website maintenance by operating tirelessly around the clock. Harnessing advanced automation, it ensures optimal website functionality and promptly addresses issues.

Understudy: A Teachable Desktop Agent That Learns Tasks by Demonstration
Understudy is a local-first desktop agent runtime that can operate GUI apps, browsers, shell tools, files, and messaging in one session. You demonstrate a task once, it records screen video and semantic events, extracts intent rather than coordinates, and turns it into a reusable skill.

AskAlf: Open-source multi-agent orchestration platform for self-hosted AI workflows
AskAlf is an open-source multi-agent orchestration platform that runs on your own hardware, dynamically creating specialized workers that coordinate through an autonomous system with a 10-layer cognitive memory stored in pgvector.