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

Open-Source JARVIS Desktop Assistant Built with Claude Code in 2 Days
A developer built a macOS desktop AI assistant called JARVIS in 1-2 days using Claude Code as the primary development tool. The application features a holographic UI, 18 native tools for system control, voice interface, and integrations with Gmail, Google Calendar, Notion, GitHub, and Obsidian.

Claude VS Code Extension Reasoning Effort Slider Sends Inconsistent Values
The reasoning effort slider in the Claude VS Code extension sends inconsistent numeric values to the model, with non-monotonic mapping where moving the slider up can send a lower number.

Agent frameworks waste 350,000+ tokens per session resending static files
A benchmark on a local Qwen 3.5 122B setup revealed agent frameworks waste over 350,000 tokens per session by resending static files. A compile-time approach reduced query context from 1,373 tokens to 73, achieving a 95% reduction.

Lisp Development with AI Agents: High Costs and Technical Challenges
A DevOps engineer found AI agents struggle with Lisp development, costing $10-$20 in minutes for subpar code, while Python and Go work efficiently. He created tmux-repl-mcp to improve REPL interaction but still faced high token costs and tooling issues.