AI Briefing
KO

Code Graph MCP Built with TS Compiler Cuts Claude Code Token Usage by 10x

·2026.07.01 20:21

Key point

An MCP tool based on the TypeScript compiler reduces AI agents' code analysis token usage by up to 10x.

1 / 2

Details

Existing MCP (Model Context Protocol) based code graph tools have had the problem of consuming excessive tokens as agents explore code, or even increasing token usage instead.

@ttsc/graph takes the approach of directly leveraging the TypeScript compiler to index the code's structural relationships (function calls, imports, inheritance, etc.). Instead of passing the entire source code, this tool provides only the graph of nodes and edges generated by the compiler, allowing agents to instantly grasp the code's structure.

The key features are as follows:

  • Token efficiency: Since only the index is passed instead of the source body, token usage remains constant regardless of repository size, showing an approximately 10x reduction in tokens compared to before.
  • Accuracy: Since it is based on the output of the TypeScript compiler, the reliability of the information provided by the agent is high, and every answer specifies an exact file:line location.
  • Ease of use: It is provided under the MIT license, and can be installed with just four lines of commands.

This tool helps agents quickly understand the flow of code through an optimized graph, like a subway map, instead of spelunking through files one by one.

This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.

Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.