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

jsc-typescript-ast-mcp

v1.1.8

Published

A Model Context Protocol (MCP) server that provides an abstract syntax tree (AST) representation of TypeScript code using the ts-morph library. It allows clients to analyze and manipulate TypeScript code structures, making it easier for AI models to under

Readme

TypeScript AST MCP Server

A Model Context Protocol (MCP) server that provides TypeScript AST (Abstract Syntax Tree) analysis capabilities. This server allows you to find references for classes and methods, analyze component trees, and find dependencies in TypeScript code using the ts-morph library. Great to represent JSON structure of your React components.

Features

  • MCP Server: Implements the Model Context Protocol for integration with AI assistants
  • TypeScript Analysis: Uses ts-morph for powerful TypeScript AST parsing and analysis
  • Reference Finding: Find all references to a given class method in your codebase
  • Dependency Finding: Use the find_dependency tool to list all files that import a specified library.
  • Component Tree Analysis: Use the component_tree tool to analyze React component structures in your codebase.
  • The tools are part of the MCP server and can be invoked via Claude Code or other MCP clients.

Prerequisites

  • Node.js (version compatible with the project)
  • Yarn package manager

Setup

  1. Create .env with your project's tsconfig path:
    PROJECT_TSCONFIG_PATH=/path/to/your/project/tsconfig.json

How to Run

Add this package as dependency and run

yarn typescript-ast

This will start the MCP server that can be connected to by MCP-compatible clients.

Installing in Claude Code

To use this MCP server in Claude Code:

  1. Configure Claude Code:
  • Copy a .mcp.json (or update your existing one with the content of the MCP configuration):
{
  "mcpServers": {
    "typescript-ast": {
      "type": "stdio",
      "command": "yarn",
      "args": [
        "typescript-ast"
      ],
      "env": {
        "PROJECT_TSCONFIG_PATH": "PATH/TO/YOUR/TYPESCRIPT/PROJECT/tsconfig.json"
      }
    }
  }
}

For the project path, if you're using Vite you might want to use the tsconfig.app.json instead.

  • Edit your .claude/settings.local.json and add the MCP section (or the subset needed if you already have some MCPs configured)
  “enableAllProjectMcpServers”: true,
  “enabledMcpjsonServers”: [
    “typescript-ast”
  ]
  • Start Claude Code
  • Type the /mcp command and check the MCP is connected

Tool Descriptions

The server provides three tools:

1. find_reference

Find all references to a given class method in your codebase.

  • Input:
    • filePath: Path to the file
    • className: Name of the class
    • methodName: Name of the method
  • Output: List of file paths with line numbers where the method is referenced

2. find_dependency

List all files that import a specified library.

  • Input:
    • dependencyName: Name of the dependency to search for
  • Output: List of file paths that import the specified dependency

3. component_tree

Analyze React component structures in your codebase.

  • Input:
    • entryFilePath: Path to the entry file
    • maxDepth: Maximum depth of the component tree (default: 3)
    • data-id (optional): Attribute name to capture into TreeNode.dataId (example: data-attribute-id)
  • Output: JSON representation of the component tree structure, including optional element metadata such as props, dataId, and onClick

License

MIT