Tree-sitter MCP Server

io.github.joowaniv0.1.0Updated Oct 2, 2026

Parse code into Tree-sitter ASTs to see node kinds, field names, and positions

VerifiedSTDIODesktop onlyDeveloper Tools

Overview

AI-generated overview

Lets an assistant parse a code snippet with Tree-sitter and inspect the resulting syntax tree, including node kinds, field names, and positions.

What it does
Exposes a single tool, get_tree_sitter_ast, which takes a code string and a language name and returns the Tree-sitter syntax tree, one named node per line, with field names and zero-based row-column ranges. ERROR and MISSING nodes flag syntax errors. It supports many languages, including C, C++, C#, Go, GraphQL, HCL, Java, JavaScript, JSON, JSX, Kotlin, PHP, Prisma, Protobuf, Python, Ruby, Rust, SQL, Swift, Terraform, Thrift, TOML, TSX, TypeScript, and YAML, with case-insensitive names and common aliases.
When to use it
Useful when an assistant is writing Tree-sitter queries or code that walks a syntax tree and needs to confirm exact node kinds, field names, and positions for a snippet. It is a small, focused helper for parser-related development work rather than a general code analysis tool.
Requirements
Runs locally over stdio. The npm package is started with npx, which needs Node.js; alternatively install the binary with cargo or from the releases and use tree-sitter-mcp-server as the command. No accounts, API keys, or environment variables are declared.
Before you install
The server parses code snippets supplied to it; avoid sending secrets or sensitive source if that matters to you. No authentication, credentials, payments, or write actions are declared.

Installation

In SourceWeft

  1. Open Tree-sitter MCP Server in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

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:

shell
claude mcp add tree-sitter -- npx -y tree-sitter-mcp-server

Codex:

shell
codex mcp add tree-sitter -- npx -y tree-sitter-mcp-server

Other clients:

json
{  "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

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.

json
{  "language": "python",  "code": "x = 1"}
text
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)

Source: README.md at commit d12ee35

Tools

0
Tool metadata has not been indexed yet.

Version history

1
  1. v0.1.0LatestOct 2, 2026