mcp-server-tree-sitter

mcp-server-tree-sitter

4.4

mcp-server-tree-sitter is hosted online, so all tools can be tested directly either in theInspector tabor in theOnline Client.

If you are the rightful owner of mcp-server-tree-sitter and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The MCP Tree-sitter Server is a Model Context Protocol server that provides code analysis capabilities using tree-sitter, designed to give AI assistants intelligent access to codebases with appropriate context management.

configure

Configure the server. Args: config_path: Path to YAML config file cache_enabled: Whether to enable parse tree caching max_file_size_mb: Maximum file size in MB log_level: Logging level (DEBUG, INFO, WARNING, ERROR) Returns: Current configuration

Try it

            Result:

            register_project_tool

            Register a project directory for code exploration. Args: path: Path to the project directory name: Optional name for the project (defaults to directory name) description: Optional description of the project Returns: Project information

            Try it

                    Result:

                    list_projects_tool

                    List all registered projects. Returns: List of project information

                    Try it

                      Result:

                      remove_project_tool

                      Remove a registered project. Args: name: Project name Returns: Success message

                      Try it

                          Result:

                          list_languages

                          List available languages. Returns: Information about available languages

                          Try it

                            Result:

                            check_language_available

                            Check if a tree-sitter language parser is available. Args: language: Language to check Returns: Success message

                            Try it

                                Result:

                                list_files

                                List files in a project. Args: project: Project name pattern: Optional glob pattern (e.g., "**/*.py") max_depth: Maximum directory depth extensions: List of file extensions to include (without dot) Returns: List of file paths

                                Try it

                                      Unsupported field schema for field root_extensions: Missing items definition.

                                      {
                                        "default": null,
                                        "title": "Extensions",
                                        "type": [
                                          "array",
                                          "null"
                                        ]
                                      }

                                          Result:

                                          get_file

                                          Get content of a file. Args: project: Project name path: File path relative to project root max_lines: Maximum number of lines to return start_line: First line to include (0-based) Returns: File content

                                          Try it

                                                    Result:

                                                    get_file_metadata

                                                    Get metadata for a file. Args: project: Project name path: File path relative to project root Returns: File metadata

                                                    Try it

                                                          Result:

                                                          get_ast

                                                          Get abstract syntax tree for a file. Args: project: Project name path: File path relative to project root max_depth: Maximum depth of the tree (default: 5) include_text: Whether to include node text Returns: AST as a nested dictionary

                                                          Try it

                                                                    Result:

                                                                    get_node_at_position

                                                                    Find the AST node at a specific position. Args: project: Project name path: File path relative to project root row: Line number (0-based) column: Column number (0-based) Returns: Node information or None if not found

                                                                    Try it

                                                                              Result:

                                                                              find_text

                                                                              Search for text pattern in project files. Args: project: Project name pattern: Text pattern to search for file_pattern: Optional glob pattern (e.g., "**/*.py") max_results: Maximum number of results case_sensitive: Whether to do case-sensitive matching whole_word: Whether to match whole words only use_regex: Whether to treat pattern as a regular expression context_lines: Number of context lines to include Returns: List of matches with file, line number, and text

                                                                              Try it

                                                                                                Result:

                                                                                                run_query

                                                                                                Run a tree-sitter query on project files. Args: project: Project name query: Tree-sitter query string file_path: Optional specific file to query language: Language to use (required if file_path not provided) max_results: Maximum number of results Returns: List of query matches

                                                                                                Try it

                                                                                                            Result:

                                                                                                            get_query_template_tool

                                                                                                            Get a predefined tree-sitter query template. Args: language: Language name template_name: Template name (e.g., "functions", "classes") Returns: Query template information

                                                                                                            Try it

                                                                                                                  Result:

                                                                                                                  list_query_templates_tool

                                                                                                                  List available query templates. Args: language: Optional language to filter by Returns: Available templates

                                                                                                                  Try it

                                                                                                                      Result:

                                                                                                                      build_query

                                                                                                                      Build a tree-sitter query from templates or patterns. Args: language: Language name patterns: List of template names or custom patterns combine: How to combine patterns ("or" or "and") Returns: Combined query

                                                                                                                      Try it

                                                                                                                        Patterns

                                                                                                                        No items yet. Use the button below to add some.

                                                                                                                              Result:

                                                                                                                              adapt_query

                                                                                                                              Adapt a query from one language to another. Args: query: Original query string from_language: Source language to_language: Target language Returns: Adapted query

                                                                                                                              Try it

                                                                                                                                      Result:

                                                                                                                                      get_node_types

                                                                                                                                      Get descriptions of common node types for a language. Args: language: Language name Returns: Dictionary of node types and descriptions

                                                                                                                                      Try it

                                                                                                                                          Result:

                                                                                                                                          get_symbols

                                                                                                                                          Extract symbols from a file. Args: project: Project name file_path: Path to the file symbol_types: Types of symbols to extract (functions, classes, imports, etc.) Returns: Dictionary of symbols by type

                                                                                                                                          Try it

                                                                                                                                              Unsupported field schema for field root_symbol_types: Missing items definition.

                                                                                                                                              {
                                                                                                                                                "default": null,
                                                                                                                                                "title": "Symbol Types",
                                                                                                                                                "type": [
                                                                                                                                                  "array",
                                                                                                                                                  "null"
                                                                                                                                                ]
                                                                                                                                              }

                                                                                                                                                  Result:

                                                                                                                                                  analyze_project

                                                                                                                                                  Analyze overall project structure. Args: project: Project name scan_depth: Depth of detailed analysis (higher is slower) ctx: Optional MCP context for progress reporting Returns: Project analysis

                                                                                                                                                  Try it

                                                                                                                                                        Result:

                                                                                                                                                        get_dependencies

                                                                                                                                                        Find dependencies of a file. Args: project: Project name file_path: Path to the file Returns: Dictionary of imports/includes

                                                                                                                                                        Try it

                                                                                                                                                              Result:

                                                                                                                                                              analyze_complexity

                                                                                                                                                              Analyze code complexity. Args: project: Project name file_path: Path to the file Returns: Complexity metrics

                                                                                                                                                              Try it

                                                                                                                                                                    Result:

                                                                                                                                                                    find_similar_code

                                                                                                                                                                    Find similar code to a snippet. Args: project: Project name snippet: Code snippet to find language: Language of the snippet threshold: Similarity threshold (0.0-1.0) max_results: Maximum number of results Returns: List of similar code locations

                                                                                                                                                                    Try it

                                                                                                                                                                                Result:

                                                                                                                                                                                find_usage

                                                                                                                                                                                Find usage of a symbol. Args: project: Project name symbol: Symbol name to find file_path: Optional file to look in (for local symbols) language: Language to search in Returns: List of usage locations

                                                                                                                                                                                Try it

                                                                                                                                                                                          Result:

                                                                                                                                                                                          clear_cache

                                                                                                                                                                                          Clear the parse tree cache. Args: project: Optional project to clear cache for file_path: Optional specific file to clear cache for Returns: Status message

                                                                                                                                                                                          Try it

                                                                                                                                                                                                Result:

                                                                                                                                                                                                diagnose_config

                                                                                                                                                                                                Diagnose issues with YAML configuration loading. Args: config_path: Path to YAML config file Returns: Diagnostic information

                                                                                                                                                                                                Try it

                                                                                                                                                                                                    Result: