Tree-sitter MCP Server
Provides Tree-sitter syntax tree parsing for C++ code snippets, enabling agents to inspect node kinds, field names, and zero-based positions before writing queries or AST-walking code.
Provides Tree-sitter syntax tree parsing for GraphQL code snippets, enabling agents to inspect node kinds, field names, and zero-based positions before writing queries or AST-walking code.
Provides Tree-sitter syntax tree parsing for HCL code snippets, enabling agents to inspect node kinds, field names, and zero-based positions before writing queries or AST-walking code.
Provides Tree-sitter syntax tree parsing for JavaScript code snippets, enabling agents to inspect node kinds, field names, and zero-based positions before writing queries or AST-walking code.
Provides Tree-sitter syntax tree parsing for Kotlin code snippets, enabling agents to inspect node kinds, field names, and zero-based positions before writing queries or AST-walking code.
Provides Tree-sitter syntax tree parsing for PHP code snippets, enabling agents to inspect node kinds, field names, and zero-based positions before writing queries or AST-walking code.
Provides Tree-sitter syntax tree parsing for Prisma schema code snippets, enabling agents to inspect node kinds, field names, and zero-based positions before writing queries or AST-walking code.
Provides Tree-sitter syntax tree parsing for Python code snippets, enabling agents to inspect node kinds, field names, and zero-based positions before writing queries or AST-walking code.
Provides Tree-sitter syntax tree parsing for Ruby code snippets, enabling agents to inspect node kinds, field names, and zero-based positions before writing queries or AST-walking code.
Provides Tree-sitter syntax tree parsing for Rust code snippets, enabling agents to inspect node kinds, field names, and zero-based positions before writing queries or AST-walking code.
Provides Tree-sitter syntax tree parsing for Swift code snippets, enabling agents to inspect node kinds, field names, and zero-based positions before writing queries or AST-walking code.
Provides Tree-sitter syntax tree parsing for Terraform code snippets, enabling agents to inspect node kinds, field names, and zero-based positions before writing queries or AST-walking code.
Provides Tree-sitter syntax tree parsing for TOML code snippets, enabling agents to inspect node kinds, field names, and zero-based positions before writing queries or AST-walking code.
Provides Tree-sitter syntax tree parsing for TypeScript code snippets, enabling agents to inspect node kinds, field names, and zero-based positions before writing queries or AST-walking code.
Provides Tree-sitter syntax tree parsing for YAML code snippets, enabling agents to inspect node kinds, field names, and zero-based positions before writing queries or AST-walking code.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Tree-sitter MCP Servershow me the AST for this Python code: x = 1"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Tree-sitter MCP Server
An MCP server that shows coding agents the Tree-sitter syntax tree of a code snippet, so they can check node kinds, field names, and positions before writing Tree-sitter queries or code that walks a syntax tree.
Installation
Claude Code:
claude mcp add tree-sitter -- npx -y tree-sitter-mcp-serverCodex:
codex mcp add tree-sitter -- npx -y tree-sitter-mcp-serverOther clients:
{
"mcpServers": {
"tree-sitter": {
"command": "npx",
"args": ["-y", "tree-sitter-mcp-server"]
}
}
}npx needs Node.js. Without it, install the binary with cargo install --locked tree-sitter-mcp-server or download
it from the releases, and use tree-sitter-mcp-server as
the command.
Clients that browse the MCP Registry, such as VS Code, can also install it from there.
mcp-name: io.github.joowani/tree-sitter-mcp-server
Related MCP server: TreeSitter Code Structure MCP Server
Supported Languages
c, cpp, csharp, go, graphql, hcl, java, javascript, json, jsx, kotlin, php, prisma,
protobuf, python, ruby, rust, sql, swift, terraform, thrift, toml, tsx, typescript, yaml
Names are case-insensitive, and common aliases such as c++, c#, py, and ts also work. javascript and jsx
use the TypeScript and TSX grammars, and terraform uses the HCL grammar. PHP code must start with <?php.
Tool
get_tree_sitter_ast returns the syntax tree of code in language, one named node per line, with field names and
zero-based (row-column) ranges. ERROR and MISSING nodes mark syntax errors.
{
"language": "python",
"code": "x = 1"
}module (0-0) - (0-5)
expression_statement (0-0) - (0-5)
assignment (0-0) - (0-5)
left: identifier (0-0) - (0-1)
right: integer (0-4) - (0-5)This server cannot be deployed
Maintenance
Related MCP Connectors
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Codebase intelligence for agents: 152 structured artifacts across 21 programs, one call.
Code-map tools for AI agents: see a repo's structure first, then edit only what matters.
11
Related MCP Servers
- AlicenseBqualityAmaintenanceAnalyzes source code structure across multiple languages using tree-sitter, extracting classes, functions, methods, and metadata with precise line numbers for efficient codebase exploration and AI-assisted development.1397 PyPI3MIT
- FlicenseAqualityDmaintenanceAnalyzes source code across multiple languages to extract structural elements like classes, functions, and parameters using tree-sitter. It provides LLM-optimized markdown output that includes nesting levels, line numbers, and signatures to facilitate codebase navigation.1-
- AlicenseNot gradedqualityDmaintenanceEnables precise code extraction from 30+ languages using tree-sitter parsing, allowing AI assistants to retrieve functions, classes, and code snippets with accurate line numbers.8MIT
- AlicenseAqualityDmaintenanceGives coding agents structured code understanding via tree-sitter with 23 tools and 10 languages, enabling precise queries instead of reading entire files.2330MIT