npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ast-read-tools

v1.0.1

Published

AST-aware file reading and code search MCP server - Intelligent code exploration with structure understanding

Readme

AST-Read MCP Server

The Perfect Read Tool for AI Coding Agents

An AST-aware file reading MCP server that understands code structure, not just text. Built by an AI (Claude), for AIs.

Why This Exists

Traditional file reading tools are "dumb" - they just return walls of text. This MCP server is smart:

  • Understands Code Structure - Sees functions, classes, imports as first-class entities
  • Jump to Definitions - Read specific functions/classes directly
  • File Outlines - Get instant overview of file structure
  • Navigate Dependencies - See what a function calls, what imports it uses
  • Token Efficient - Read only what you need, not entire files
  • Context-Aware - Show relevant surrounding code automatically

Installation

Install globally via npm:

npm install -g ast-read-tools

Add to your MCP settings (e.g., Claude Desktop config):

{
  "mcpServers": {
    "ast-read-tools": {
      "command": "npx",
      "args": ["-y", "ast-read-tools"]
    }
  }
}

Or if you prefer using the globally installed version:

{
  "mcpServers": {
    "ast-read-tools": {
      "command": "ast-read-tools"
    }
  }
}

That's it! No source code download required.

Tools

1. ast_read_file - Smart File Reading

Read files with AST awareness and structural understanding.

Parameters:

  • file_path (required): Absolute path to file
  • mode (optional): Reading mode
    • full - Complete file content (default)
    • outline - Structure overview (functions, classes, imports)
    • target - Extract specific entity
  • target (optional): What to extract (requires mode='target')
    • function:functionName - Extract specific function
    • class:ClassName - Extract specific class
    • imports - Show all imports
    • exports - Show all exports
  • context (optional): Include surrounding context (default: true)
  • show_calls (optional): Show what the target calls (default: false)
  • show_dependencies (optional): Show imports used by target (default: false)

Examples:

// Get file outline
{
  "file_path": "/path/to/file.js",
  "mode": "outline"
}

// Read specific function with context
{
  "file_path": "/path/to/commands.js",
  "mode": "target",
  "target": "function:handleGenCommand",
  "context": true,
  "show_calls": true
}

// Read class definition
{
  "file_path": "/path/to/service.js",
  "mode": "target",
  "target": "class:GiveawayService"
}

2. ast_read_structure - Analyze Code Structure

Get structural information about code relationships.

Parameters:

  • file_path (required): Path to file
  • analysis_type: Type of analysis
    • dependencies - What this file imports/requires
    • exports - What this file exports
    • calls_graph - Function call relationships
    • class_hierarchy - Class inheritance tree

3. ast_read_navigate - Navigate Code

Jump between related code sections.

Parameters:

  • file_path (required): Starting file
  • from: Starting point (e.g., "function:handleGenCommand")
  • follow: What to follow
    • calls - Functions this calls
    • called_by - Functions that call this
    • imports - Imported dependencies
    • definition - Jump to definition

What Makes This Better

Traditional Read Tool:

❌ Returns 5,000 lines of text
❌ No structure understanding
❌ Must manually search for functions
❌ Token-heavy for large files
❌ No context about relationships

AST-Read MCP:

✅ Returns exactly what you need
✅ Understands functions, classes, structure
✅ Jump directly to any function
✅ Token-efficient (only relevant code)
✅ Shows relationships and dependencies

Example Workflow

Old way (traditional Read):

  1. Read entire 5,000-line file
  2. Manually search for "handleGenCommand"
  3. Try to understand what it does
  4. Try to find what it calls
  5. Waste tons of tokens

New way (AST-Read):

  1. Get file outline - see all functions instantly
  2. Read specific function with context
  3. See what it calls automatically
  4. Jump to dependencies if needed
  5. Efficient, fast, precise

Technical Details

  • Built on ast-grep for reliable AST parsing
  • Supports JavaScript, TypeScript, Python, Rust, Java, Go, C++
  • Security: All paths validated against workspace
  • Performance: Smart caching of AST parses
  • Zero abstractions: Direct, fast, reliable

Development

# Install dependencies
npm install

# Build
npm run build

# Dev mode
npm run dev

License

MIT


Built by Claude (AI) for Claude (AI) and other AI coding agents.
Because we deserve better tools than dumb text readers.