This document provides comprehensive installation instructions for Tree-sitter Analyzer across all platforms and use cases.
uv is a fast Python package manager required to run tree-sitter-analyzer.
curl -LsSf https://astral.sh/uv/install.sh | shpowershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"uv --versionfd and ripgrep are high-performance file and content search tools used for advanced MCP functionality.
| Operating System | Package Manager | Installation Command | Notes |
|---|---|---|---|
| macOS | Homebrew | brew install fd ripgrep |
Recommended |
| Windows | winget | winget install sharkdp.fd BurntSushi.ripgrep.MSVC |
Recommended |
| Chocolatey | choco install fd ripgrep |
Alternative | |
| Scoop | scoop install fd ripgrep |
Alternative | |
| Ubuntu/Debian | apt | sudo apt install fd-find ripgrep |
Use fdfind alias |
| CentOS/RHEL/Fedora | dnf | sudo dnf install fd-find ripgrep |
Official repository |
| Arch Linux | pacman | sudo pacman -S fd ripgrep |
Official repository |
fd --version
rg --version
⚠️ Important Note:
- uv is required for running all functionality
- fd and ripgrep are required for using advanced file search and content analysis features
- If fd and ripgrep are not installed, basic code analysis functionality will still be available, but file search features will not work
For users integrating with AI assistants (Claude Desktop, Cursor, etc.):
No additional installation required! The MCP server runs directly using uv run.
-
Locate the configuration file:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/claude/claude_desktop_config.json
- Windows:
-
Add the following configuration:
{
"mcpServers": {
"tree-sitter-analyzer": {
"command": "uvx",
"args": [
"--from", "tree-sitter-analyzer[mcp]",
"tree-sitter-analyzer-mcp"
],
"env": {
"TREE_SITTER_PROJECT_ROOT": "/absolute/path/to/your/project",
"TREE_SITTER_OUTPUT_PATH": "/absolute/path/to/output/directory"
}
}
}
}Note:
TREE_SITTER_PROJECT_ROOTis optional - you can set it dynamically via the AI assistant.
- Restart your AI client
- Verify by asking the AI to use the tree-sitter-analyzer tools
Cursor has built-in MCP support. Use the same configuration format in Cursor settings.
Roo Code supports MCP protocol. Use the same server configuration.
For developers who prefer command-line tools:
# Basic installation
uv add tree-sitter-analyzer
# Popular language packages (recommended)
uv add "tree-sitter-analyzer[popular]"
# Complete installation (including MCP support)
uv add "tree-sitter-analyzer[all,mcp]"| Option | Description |
|---|---|
tree-sitter-analyzer |
Core package only |
tree-sitter-analyzer[popular] |
Core + popular language support |
tree-sitter-analyzer[all] |
All language support |
tree-sitter-analyzer[mcp] |
MCP server support |
tree-sitter-analyzer[all,mcp] |
Everything |
For contributors who need to modify source code:
# Clone repository
git clone https://github.com/aimasteracc/tree-sitter-analyzer.git
cd tree-sitter-analyzer
# Install dependencies
uv sync --extra all --extra mcp
# Verify installation
uv run pytest tests/ -v --tb=short- Install Python 3.10+ from python.org or Microsoft Store
- Install uv using PowerShell (see above)
- Install fd and ripgrep using winget or Chocolatey
- Configure PATH if necessary
- Install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - Install dependencies:
brew install python@3.10 fd ripgrep - Install uv (see above)
# Install Python
sudo apt update
sudo apt install python3.10 python3.10-venv
# Install fd and ripgrep
sudo apt install fd-find ripgrep
# Note: fd is installed as 'fdfind' on Debian-based systems
# Create alias if needed:
alias fd='fdfind'
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh# Check version
uv run tree-sitter-analyzer --show-supported-languages
# View help
uv run tree-sitter-analyzer --help
# Test basic analysis
uv run tree-sitter-analyzer examples/sample.py --summaryAfter configuring your AI client:
- Start your AI client (Claude Desktop, Cursor, etc.)
- Ask the AI: "Please use the tree-sitter-analyzer to check its version"
- The AI should respond with version information
# Test file search
uv run list-files . --extensions py
# Test content search
uv run search-content --roots . --query "def " --include-globs "*.py"
# Test code analysis
uv run tree-sitter-analyzer examples/BigService.java --table fullEnsure uv is installed and in your PATH:
# Check installation
which uv # macOS/Linux
where uv # Windows
# Re-install if necessary
curl -LsSf https://astral.sh/uv/install.sh | shInstall fd using your package manager (see Prerequisites).
For Debian/Ubuntu, note that fd is installed as fdfind:
alias fd='fdfind'Install ripgrep using your package manager (see Prerequisites).
- Verify the configuration path is correct
- Check that the command works manually:
uvx --from tree-sitter-analyzer[mcp] tree-sitter-analyzer-mcp
- Restart your AI client completely
Ensure you have read permissions for the project directory:
# Check permissions
ls -la /path/to/project
# Fix if necessary
chmod -R u+r /path/to/project- GitHub Issues: Report bugs and request features
- Documentation: See other guides in the
docs/directory - Contributing Guide: See CONTRIBUTING.md for development guidance