mcpField
T
Tree-sitter MCP Server

Tree-sitter MCP Server

Local
github.comDeveloper Tools0Updated 3d ago

About Tree-sitter MCP Server

Tree-sitter MCP Server exposes Tree-sitter syntax trees to coding agents, helping them inspect node kinds, field names, and source positions before writing queries or tree-walking code. It supports a range of programming and data languages.

Key features

  1. 01AST по одному именованному узлу на строку
  2. 02Показ типов узлов и имён полей
  3. 03Нулевые координаты строк и столбцов
  4. 04Маркировка ошибок ERROR и MISSING
  5. 05Поддержка множества языков и псевдонимов

Use cases

  1. 01Проверка структуры фрагмента перед написанием Tree-sitter-запроса
  2. 02Поиск нужных имён полей для обхода дерева
  3. 03Определение мест синтаксических ошибок

MCP support

MCP 服务将 get_tree_sitter_ast 工具提供给 MCP 客户端,用于返回代码片段的 Tree-sitter 语法树。

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository
Packages
npmtree-sitter-mcp-server0.1.1
cargotree-sitter-mcp-server0.1.1

Tools

1

Saved tool list · updated 2d ago

ParameterTypeRequiredDescription
codestringYesCode to parse. It can be a fragment rather than a whole file.
languagestringYesLanguage of the code, such as `python`, `tsx`, or an alias like `py`, `ts`, or `c#`; case-insensitive.

Details

From the project 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:

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

Codex:

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

Other 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

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)

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.