MCP server
by qckfx
Tree Hugger JS offers advanced JavaScript and TypeScript code analysis, AST parsing, function extraction, and safe code
Provides JavaScript and TypeScript code analysis through AST parsing. Enables automated code transformations, refactoring, and dependency management with safety previews.
Tree Hugger JS is a community-built MCP server published by qckfx that provides AI assistants with tools and capabilities via the Model Context Protocol. Tree Hugger JS offers advanced JavaScript and TypeScript code analysis, AST parsing, function extraction, and safe code It is categorized under developer tools. This server exposes 12 tools that AI clients can invoke during conversations and coding sessions.
You can install Tree Hugger JS in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.
MIT
Tree Hugger JS is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.
Add new capabilities to Claude beyond text generation
Example
Access external data sources, execute code, interact with tools and services
Transform Claude from chatbot to action-taking agent
Provide Claude with access to relevant context and data
Example
Load project documentation, access knowledge bases, query databases
Get more accurate, context-aware responses
Automate multi-step workflows combining AI and external tools
Example
Research → Summarize → Create document → Send notification
Complete complex tasks end-to-end without manual steps
Share your MCP server with the developer community
We evaluated Tree Hugger JS against two servers with overlapping tools; this profile had the clearer scope statement.
Strong directory entry: Tree Hugger JS surfaces stars and publisher context so we could sanity-check maintenance before adopting.
Tree Hugger JS is among the better-indexed MCP projects we tried; the explainx.ai summary tracks the official description.
Useful MCP listing: Tree Hugger JS is the kind of server we cite when onboarding engineers to host + tool permissions.
We wired Tree Hugger JS into a staging workspace; the listing’s GitHub and npm pointers saved time versus hunting across READMEs.
Tree Hugger JS has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.
Tree Hugger JS reduced integration guesswork — categories and install configs on the listing matched the upstream repo.
According to our notes, Tree Hugger JS benefits from clear Model Context Protocol framing — fewer ambiguous “AI plugin” claims.
Useful MCP listing: Tree Hugger JS is the kind of server we cite when onboarding engineers to host + tool permissions.
Tree Hugger JS reduced integration guesswork — categories and install configs on the listing matched the upstream repo.
showing 1-10 of 37
An MCP (Model Context Protocol) server that provides AI agents with powerful JavaScript/TypeScript code analysis and transformation capabilities using the tree-hugger-js library.
<a href="https://glama.ai/mcp/servers/@qckfx/tree-hugger-js-mcp"> <img width="380" height="200" src="https://glama.ai/mcp/servers/@qckfx/tree-hugger-js-mcp/badge" alt="Tree-Hugger-JS Server MCP server" /> </a>function, class[name="MyClass"])Try immediately with npx - no installation required:
# Use with Claude Code or any MCP client
npx tree-hugger-js-mcp
# Install globally for repeated use
npm install -g tree-hugger-js-mcp
# Then run anywhere
tree-hugger-js-mcp
# Clone and build from source
git clone https://github.com/qckfx/tree-hugger-js-mcp.git
cd tree-hugger-js-mcp
npm install
npm run build
npm start
Add to your MCP client configuration:
{
"mcpServers": {
"tree-hugger-js": {
"command": "npx",
"args": ["tree-hugger-js-mcp"]
}
}
}
{
"mcpServers": {
"tree-hugger-js": {
// If installed globally
"command": "tree-hugger-js-mcp"
// Or if built from source
"command": "node",
"args": ["/path/to/tree-hugger-js-mcp/build/index.js"]
}
}
}
parse_codeParse JavaScript/TypeScript code from file or string.
Parameters:
source (string): File path or code string to parseisFilePath (boolean, optional): Whether source is a file path (auto-detected if not provided)language (string, optional): Language to use (javascript, typescript, jsx, tsx)Example:
// Parse a file
await callTool("parse_code", {
source: "./src/app.js",
isFilePath: true
});
// Parse code string
await callTool("parse_code", {
source: "function hello() { console.log('world'); }"
});
find_patternFind first node matching a pattern.
Parameters:
pattern (string): Pattern to match using tree-hugger-js syntaxExamples:
// Find any function
await callTool("find_pattern", { pattern: "function" });
// Find async functions
await callTool("find_pattern", { pattern: "function[async]" });
// Find class by name
await callTool("find_pattern", { pattern: "class[name='MyClass']" });
find_all_patternFind all nodes matching a pattern.
Parameters:
pattern (string): Pattern to matchlimit (number, optional): Maximum matches to returnget_functionsGet all functions with details.
Parameters:
includeAnonymous (boolean, optional): Include anonymous functions (default: true)asyncOnly (boolean, optional): Only return async functions (default: false)get_classesGet all classes with methods and properties.
Parameters:
includeProperties (boolean, optional): Include class properties (default: true)includeMethods (boolean, optional): Include class methods (default: true)get_importsGet all import statements.
Parameters:
includeTypeImports (boolean, optional): Include TypeScript type-only imports (default: true)rename_identifierRename all occurrences of an identifier.
Parameters:
oldName (string): Current identifier namenewName (string): New identifier namepreview (boolean, optional): Return preview only (default: false)Example:
await callTool("rename_identifier", {
oldName: "fetchData",
newName: "fetchUserData",
preview: true
});
remove_unused_importsRemove unused import statements.
Parameters:
preview (boolean, optional): Return preview only (default: false)transform_codeApply multiple transformations in sequence.
Parameters:
operations (array): Array of transformation operationspreview (boolean, optional): Return preview only (default: false)Example:
await callTool("transform_code", {
operations: [
{ type: "rename", parameters: { oldName: "oldFunc", newName: "newFunc" } },
{ type: "removeUnusedImports" },
{ type: "replaceIn", parameters: { nodeType: "string", pattern: /localhost/g, replacement: "api.example.com" } }
],
preview: true
});
insert_codeInsert code before or after nodes matching a pattern.
Parameters:
pattern (string): Pattern to match for insertion pointscode (string): Code to insertposition (string): "before" or "after"preview (boolean, optional): Return preview only (default: false)get_node_at_positionGet AST node at specific line and column.
Parameters:
line (number): Line number (1-based)column (number): Column number (0-based)analyze_scopesAnalyze variable scopes and bindings.
Parameters:
includeBuiltins (boolean, optional): Include built-in identifiers (default: false)The server provides three resources for accessing internal state:
ast://currentCurrent parsed AST state with metadata and statistics.
ast://analysisResults from the most recent code analysis (functions, classes, imports).
ast://transformsHistory of code transformations and available operations.
Tree-hugger-js uses intuitive patterns instead of verbose tree-sitter node types:
function - Any function (declaration, expression, arrow, method)class - Class declarations and expressionsstring - String and template literalsimport/export - Import/export statementscall - Function callsloop - For, while, do-while loops[name="foo"] - Nodes with specific name[async] - Async functions[text*="test"] - Nodes containing textclass method - Methods inside classesfunction > return - Return statements directly in functions:has() and :not() pseudo-selectors// Parse and analyze a React component
await callTool("parse_code", { source: "./components/UserProfile.jsx" });
// Get all functions
const functions = await callTool("get_functions", { asyncOnly: true });
// Find JSX elements
const jsxElements = await callTool("find_all_pattern", { pattern: "jsx" });
// Rename a function and remove unused imports
await callTool("transform_code", {
operations: [
{ type: "rename", parameters: { oldName: "getUserData", newName: "fetchUserProfile" } },
{ type: "removeUnusedImports" }
]
});
// Find all async functions that call console.log
await callTool("find_all_pattern", {
pattern: "function[async]:has(call[text*='console.log'])"
});
// Find classes with constructor methods
await callTool("find_all_pattern", {
pattern: "class:has(method[name='constructor'])"
});
# Install dependencies
npm install
# Build the project
npm run build
# Watch mode for development
npm run dev
# Test with MCP inspector
npm run inspector
The server provides detailed error messages and suggestions:
MIT
Prerequisites
Time Estimate
15-60 minutes depending on server complexity
Steps
Troubleshooting
✓ Do
✗ Don't
💡 Pro Tips
Architecture
Model Context Protocol standardizes how AI hosts (Claude, Cursor) communicate with external tools and data sources through server implementations.
Protocols
Compatibility
✓ Use when
Use when you need Claude to access external data, execute actions, or integrate with tools. Best for extending AI capabilities beyond conversation.
✗ Avoid when
Avoid when native integrations exist (use official APIs directly), for real-time critical systems, or when security/compliance requires zero external dependencies.