Overview
MCP Tree-sitter Server is a Model Context Protocol (MCP) server that provides code analysis capabilities using tree-sitter, designed to give intelligent access to codebases with appropriate context management.
To use the MCP Tree-sitter Server, install it via pip and configure it with Claude Desktop either through the MCP CLI or manually. You can register projects and analyze code using various commands.
- Flexible exploration of code at multiple levels of granularity. - Context management to provide relevant information without overwhelming the user. - Language agnostic, supporting multiple programming languages. - Structure-aware with AST-based understanding. - Searchable code patterns using text search and tree-sitter queries. - Caching for optimized performance. - Symbol extraction and dependency analysis. - State persistence between invocations. - Built-in security features.
- Analyzing code structure and syntax trees.
- Searching for specific code patterns.
- Extracting symbols and analyzing code dependencies.
- Managing projects and their configurations.
Add to your AI client
Use these steps to connect MCP Tree-sitter Server in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"mcp-server-tree-sitter-wrale": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-server-tree-sitter-wrale"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"mcp-server-tree-sitter-wrale": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-server-tree-sitter-wrale"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"mcp-server-tree-sitter-wrale": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-server-tree-sitter-wrale"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"mcp-server-tree-sitter-wrale": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-server-tree-sitter-wrale"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"mcp-server-tree-sitter-wrale": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-server-tree-sitter-wrale"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"mcp-server-tree-sitter-wrale": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-server-tree-sitter-wrale"
]
}
}
}FAQ
**What languages does it support?**
It supports many programming languages including Python, JavaScript, TypeScript, Go, Rust, C, C++, Swift, Java, Kotlin, Julia, and APL.
**Is it easy to install?**
Yes! You can install it using pip with a simple command.
**Can it run as a standalone server?**
Yes! You can run it as a standalone server using the provided command.7:["$","div",null,{"className":"container mx-auto flex flex-col gap-4","children":["$L26","$L27",["$","$L28",null,{"currentProject":{"id":3033,"uuid":"4be5d72e-28ed-4aad-a9ab-314d18999358","name":"mcp-server-tree-sitter","title":"MCP Tree-sitter Server","description":"MCP Server for Tree-sitter","avatar_url":"https://avatars.githubusercontent.com/u/5721113?v=4","created_at":"2025-03-17T02:34:03.728Z","updated_at":"2025-03-17T03:16:05.952Z","status":"created","author_name":"wrale","author_avatar_url":"https://avatars.githubusercontent.com/u/5721113?v=4","tags":"tree-sitter,mcp,code-analysis,ast,code-search,claude,coding-assistant,ai-assistant,claude-ai,claude-desktop,model-context-protocol,model-context-protocol-servers","category":"developer-tools","is_featured":false,"sort":1,"url":"https://github.com/wrale/mcp-server-tree-sitter","target":"_self","content":"$29","summary":"$2a","img_url":"https://camo.githubusercontent.com/a2b5c76019722f58ff3fc6fed29bd09d4d8e4c8534842509efee5316be716f68/68747470733a2f2f6d736565702e6e65742f70722f7772616c652d6d63702d7365727665722d747265652d7369747465722d62616467652e706e67","type":null,"metadata":"{\"star\":\"32\",\"license\":\"MIT license\",\"language\":\"Python\",\"is_official\":false,\"latest_commit_time\":\"2025-05-03 18:04:37\"}","user_uuid":null,"tools":null,"sse_url":null,"sse_provider":null,"sse_params":null,"is_official":false,"server_command":null,"server_params":null,"server_config":null,"allow_call":false,"is_innovation":false,"is_dxt":false,"dxt_manifest":null,"dxt_file_url":null,"is_audit":false},"randomProjects":[],"currentServerKey":"$undefined"}]]}]