About this project

Scantool is a code structure analysis tool designed to help AI coding agents (Claude Code, Cursor, VS Code Copilot, and others) understand codebases efficiently. Instead of reading entire files to find a function or class, agents get a structural map—every class, function, caller, and heading with line numbers—in a single call. It operates as both an MCP (Model Context Protocol) server and a shell command (`sct`), so agents can use it through either interface. The tool is powered by tree-sitter parsers for 20+ languages and requires no index, no API keys, and no setup beyond one command. Key capabilities include: searching for structures with enclosing context and caller leads; scanning a directory for entry points, hot functions, and central files; focusing on a single function or heading with its verbatim code and one-level outline; computing structural diffs between git refs; finding actual call sites of a function; detecting branch overlap and merge conflicts; checking public API surface changes; identifying functions that diverge from sibling call patterns; and resolving addresses across git refs. Beyond source code, Scantool handles documents—Markdown headings, SQL tables and views, YAML/TOML/JSON keys, CSS selectors, and more—as addressable structure with line ranges. The tool parses files on demand and caches by git blob ID, so the same bytes at a ref, on stdin, or in the next process do not parse twice. Functions are shown as condensed skeletons with control flow, calls, and returns kept while trivial statements are folded. Every answer includes a coverage line counting files seen, structures shown, and what was excluded. Measured on real agent episodes, Scantool reduced token usage by 25x for targeted searches (378 tokens vs 9,370 for grep) and 75% for focused reads (13,523 vs 54,337 tokens) at unchanged fact coverage. Across 22 episodes, Scantool agents achieved 88% fact coverage versus 73% for grep-only agents. Grep still wins plain literal lookups and top-level overviews by 1.4x and 1.6x respectively. Supported languages include Python, JavaScript, TypeScript, Rust, Go, C, C++, Java, PHP, C#, Ruby, Zig, Swift, SQL, HTML, CSS, SCSS, YAML, Markdown, Jupyter notebooks, plain text, JSON, TOML, and images. Broken files fall back to regex extraction. Compared to other code-exploration MCP servers: Repomix packs the whole repo into one file; Serena uses language servers symbol by symbol and can edit code; claude-context uses an embedding index with a vector database and requires API keys. Scantool's approach—parsing on demand with no index—avoids those costs while also extracting document structure that none of the others address. Installation requires uv, then a single command to register the MCP server. The tool is MIT licensed and built on FastMCP, tree-sitter, and uv.