MCP Tree-sitter Server

MCP Tree-sitter Server is an MCP server that provides structure-aware code analysis capabilities using tree-sitter parsers to language models. It connects local code repositories to AI assistants like Claude Desktop, allowing software engineers and developers to inspect source code without overflowing model context windows. The server parses source code across languages such as Python, JavaScript, TypeScript, Go, Rust, C, C++, and Java through tree-sitter language packs. Instead of loading whole files indiscriminately, the server allows clients to register local projects, inspect directory structures, generate abstract syntax trees, and extract specific symbols such as functions and classes. It also enables structural tree-sitter pattern queries, text searches, and cyclomatic complexity analysis. By caching parse trees in memory and preserving project registrations between calls, the server reduces parse overhead and enables efficient, multi-step code exploration workflows for code reviews, refactoring, and code understanding.

Category: AI Memory & Context

Tags: ast, code analysis, context, parsing, tree-sitter

Visit MCP Tree-sitter Server

How to install and configure MCP Tree-sitter Server

To install and configure MCP Tree-sitter Server for Claude Desktop: 1. Ensure Python 3.10+ is installed on your system. 2. Install the package using pip: pip install mcp-server-tree-sitter 3. Open your Claude Desktop configuration file: - macOS/Linux: ~/Library/Application Support/Claude/claude_desktop_config.json - Windows: %APPDATA%\Claude\claude_desktop_config.json 4. Add the server definition inside mcpServers using uvx or python: json { "mcpServers": { "tree_sitter": { "command": "uvx", "args": ["--directory", "/ABSOLUTE/PATH/TO/YOUR/PROJECT", "mcp-server-tree-sitter"] } } } 5. Replace /ABSOLUTE/PATH/TO/YOUR/PROJECT with your actual project path. 6. Restart Claude Desktop to begin using the registered tools.

What you can do with MCP Tree-sitter Server

  • Registering local code repositories and listing files with glob patterns to map project structure before reading files. - Extracting code symbols like classes and functions to understand component interfaces without reading full source implementations. - Executing Tree-sitter structural queries across source files to find specific language patterns or syntax constructs. - Inspecting abstract syntax trees up to a specified maximum depth to diagnose complex code structures. - Calculating complexity metrics across files to identify heavily branched methods requiring refactoring during code reviews.

Key facts

  • https://github.com/wrale/mcp-server-tree-sitter
  • AI Memory & Context, Developer Tools & Code Intelligence
  • ast, code analysis, context, parsing, tree-sitter

Part of MCP Servers

Related MCP servers

  • MCP LaTeX Server β€” MCP LaTeX Server is an MCP server that provides tools for creating, editing, validating, and compiling LaTeX documents directly through…
  • MCP JSON β€” MCP JSON is an MCP server collection that bundles tools for file system operations, Google search, browser-based web automation, and…
  • MCP Jupyter Complete β€” MCP Jupyter Complete is an MCP server that provides tools for manipulating Jupyter notebook files through position-based cell operations and…
  • MCP LSP Go β€” MCP LSP Go is an MCP server that connects AI assistants to the official Go Language Server Protocol implementation, gopls,…
  • MCP Memory Dashboard β€” MCP Memory Dashboard is an MCP server desktop interface that connects to the MCP Memory Service to provide visual semantic…
  • MCP Kanban Memory β€” MCP Kanban Memory is an MCP server that provides a kanban-based task management and state retention system for AI-driven workflows.…

How do I install MCP Tree-sitter Server?

You can install MCP Tree-sitter Server using pip by running pip install mcp-server-tree-sitter. Alternatively, you can run it directly using uvx with uvx --directory /path/to/project mcp-server-tree-sitter in your client configuration.

Which MCP clients work with MCP Tree-sitter Server?

Claude Desktop is the primary reference implementation target documented for the server. It can also be inspected and run using the MCP CLI via direct commands or the MCP Inspector development tool.

What programming languages does MCP Tree-sitter Server support?

The server supports multiple languages via tree-sitter-language-pack, including Python, JavaScript, TypeScript, Go, Rust, C, C++, C#, Swift, Java, Kotlin, Dart, Julia, and APL. Parsers can be loaded on-demand or pre-loaded via configuration.

What tools does MCP Tree-sitter Server provide?

It provides tools to register projects, list project files, retrieve file content, inspect abstract syntax trees, extract symbols like functions and classes, perform text and Tree-sitter query searches, and analyze code complexity.

Does MCP Tree-sitter Server cache parse trees?

Yes. It maintains state in memory, caching parse trees and registered projects between client calls to maximize performance. Caching behavior, size limits, and time-to-live settings can be adjusted through YAML configuration files or environment variables.

  • AI Tools
  • Categories
  • Industries
  • CLI Coding Agents
  • MCP Servers
  • MCP Categories