Tree-Hugger-JS

Provides code analysis, transformation, and navigation for JavaScript and TypeScript via MCP to empower AI agents.
  • javascript

2

GitHub Stars

javascript

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "qckfx-tree-hugger-js-mcp": {
      "command": "npx",
      "args": [
        "tree-hugger-js-mcp"
      ],
      "env": {
        "NONE": "PLACEHOLDER"
      }
    }
  }
}

You run a capable MCP Server that empowers AI agents to analyze and transform JavaScript and TypeScript code using tree-hugger-js. It provides powerful code analysis, safe transformations, and code intelligence to help you refactor, understand, and navigate complex codebases with confidence.

How to use

Set up your MCP client to connect to the Tree-Hugger-JS MCP Server. You can run the server locally and connect via stdio, or connect through an HTTP endpoint if you expose one. The server exposes a suite of tools for parsing, pattern matching, transforming, and navigating code. Use these capabilities to analyze code, rename identifiers, remove unused imports, insert code around patterns, and preview changes before applying them.

How to install

Prerequisites: Node.js (LTS version recommended) and a modern npm installation. Ensure you can run commands from your shell without requiring special permissions.

# Quick Start: try immediately with npx (no installation required)
npx tree-hugger-js-mcp

# Global installation for repeated use
npm install -g tree-hugger-js-mcp

# Then run anywhere
tree-hugger-js-mcp

# Development setup: clone, install, build, and start

Additional setup and configuration

To connect your MCP client, use one of the explicit connection configurations shown below. The HTTP/URL method is not shown in this guide since the provided examples focus on local stdio usage.

Configuration examples

json
{
  "mcpServers": {
    "tree-hugger-js": {
      "command": "npx",
      "args": ["tree-hugger-js-mcp"]
    }
  }
}

Alternative local run configurations

json
{
  "mcpServers": {
    "tree-hugger-js": {
      // If installed globally
      "command": "tree-hugger-js-mcp",
      "args": []
    }
  }
}

Build-from-source run configuration

json
{
  "mcpServers": {
    "tree-hugger-js": {
      "command": "node",
      "args": ["/path/to/tree-hugger-js-mcp/build/index.js"]
    }
  }
}

Available tools

parse_code

Parse JavaScript/TypeScript code from a file or string. Supports specifying language and whether the source is a file.

find_pattern

Find the first AST node matching a given Tree-Hugger pattern using CSS-like selectors.

find_all_pattern

Find all AST nodes matching a given pattern, with an optional limit.

get_functions

Retrieve all functions with details, with options to include anonymous or async-only functions.

get_classes

Retrieve all classes with their methods and properties, with options to include properties and methods.

get_imports

Retrieve all import statements, including type imports if requested.

rename_identifier

Rename all occurrences of an identifier across the codebase, with an option to preview changes first.

remove_unused_imports

Remove unused import statements and clean up the codebase.

transform_code

Apply a sequence of transformations to code, with an option to preview changes before applying.

insert_code

Insert code before or after nodes matching a pattern, with optional preview.

get_node_at_position

Get the AST node at a specific line and column to inspect code structure.

analyze_scopes

Analyze variable scopes and bindings, with an option to include builtins.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational