MCP Servers

A collection of Model Context Protocol servers, templates, tools and more.

T
Tree Sitter MCP

A tree-sitter based MCP server for code analysis and security auditing

Created 1/24/2026
Updated 4 days ago
Repository documentation and setup instructions

tree-sitter-mcp

A code analysis toolkit using tree-sitter for AST-based code structure extraction, call graph analysis, and symbol reference tracking.

Features

  • Function/Class Extraction - Extract all function/method and class/struct/interface/field definitions
  • Inheritance Analysis - Extract class inheritance relationships, including parent classes and child classes
  • Call Graph Analysis - Build call graphs showing caller-callee relationships
  • Import Analysis - Extract import statements and dependencies
  • Variable Tracking - Identify variable declarations with scope information
  • Symbol Reference Tracking - Find all references to a specific symbol
  • Dual Interface - Use as MCP server or standalone CLI tool

Supported Languages

| Language | Extensions | |----------|------------| | Python | .py, .pyw, .pyi | | JavaScript | .js, .mjs, .cjs, .jsx | | TypeScript | .ts, .tsx | | Java | .java | | Go | .go |

Installation

# Using uv (recommended)
uv tool install git+https://github.com/X1r0z/tree-sitter-mcp

# Using pip
pip install git+https://github.com/X1r0z/tree-sitter-mcp

Usage

MCP Server

{
  "mcpServers": {
    "tree-sitter": {
      "command": "tree-sitter-mcp"
    }
  }
}

CLI Tool

Use tree-sitter-analyzer for command-line analysis:

# List all classes in a directory
tree-sitter-analyzer classes ./src/

# Find all callers of a function
tree-sitter-analyzer callers ./src/ --function process_data

# Get function definition
tree-sitter-analyzer definition ./src/ --function main

# Output as JSON
tree-sitter-analyzer functions ./src/ --json

# Output as YAML
tree-sitter-analyzer functions ./src/ --yaml

See CLI.md for complete CLI documentation.

Tools

Code Structure

| Tool | Description | |------|-------------| | get_functions | Extract all function/method definitions | | get_classes | Extract all class/struct/interface definitions | | get_fields | Extract all field definitions | | get_imports | Extract all import statements | | get_variables | Extract all variable declarations |

Inheritance Analysis

| Tool | Description | |------|-------------| | get_super_classes | Get all parent classes of a specific class | | get_sub_classes | Get all child classes that inherit from a specific class |

Call Graph Analysis

| Tool | Description | |------|-------------| | get_callers | Find functions that call a specific function | | get_callees | Find functions called by a specific function |

Function-Level Analysis

| Tool | Description | |------|-------------| | get_function_definition | Get the complete source code of a function | | get_function_variables | Get all variables declared in a function | | get_function_strings | Get all string literals in a function |

Symbol Reference Tracking

| Tool | Description | |------|-------------| | find_symbols | Find all references to a specific symbol |

Development

# Install with dev dependencies
uv pip install -e ".[dev]"

# Lint
uv run ruff check src/

# Format
uv run ruff format src/

License

MIT

Quick Setup
Installation guide for this server

Install Package (if required)

uvx tree-sitter-mcp

Cursor configuration (mcp.json)

{ "mcpServers": { "x1r0z-tree-sitter-mcp": { "command": "uvx", "args": [ "tree-sitter-mcp" ] } } }