code-to-tree is an MCP (Model Context Protocol) server whose core goal is to provide large language models with the ability to accurately convert source code into abstract syntax trees (ASTs), without depending on a specific programming language. The design of this tool emphasizes two key points: first, the underlying syntax parser needs to be sufficiently general, so tree-sitter was chosen, and the currently supported languages include C, C++, Rust, Ruby, Go, Java, and Python; second, the server should encapsulate all capabilities within itself and minimize software dependencies on the end user's machine, so mcpc was used for implementation. The final product is a standalone binary file, and an MCP client only needs this file to run.
Usage: Users first need to obtain the code-to-tree executable file (code-to-tree.exe on Windows, code-to-tree on macOS), which can be downloaded from the GitHub releases page or built by themselves. After downloading, specify the path to the executable file in the configuration file of the MCP client (for example, Claude). For Windows, the configuration file is located at C:\Users\YOUR_NAME\AppData\Roaming\Claude\claude_desktop_config.json; for macOS, the configuration file is located at ~/Library/Application Support/Claude/claude_desktop_config.json. After configuration is complete, the MCP client can call this server to convert source code into an AST.
Build method: If you choose to build it yourself, on Windows you first need to prepare the environment by downloading and installing MSYS2, opening the "MSYS2 MINGW64" application, and running pacman -S make gcc git. Then prepare the tree-sitter library, which requires compiling and installing tree-sitter and all related grammars. Finally, compile code-to-tree. On macOS, you need to install Xcode Command Line Tools, and then perform similar compilation steps. For specific build commands, refer to the project documentation.
Applicable scenarios: This tool is suitable for scenarios that require parsing source code into abstract syntax trees, especially when large language models need to understand code structure.It can be integrated into MCP-supporting clients, such as Claude Desktop, to help the model analyze code more accurately.
Limitations: The currently supported languages are limited, including only C, C++, Rust, Ruby, Go, Java, and Python. The tool itself does not provide a runtime; all dependencies are packaged into the binary file, but the corresponding compilation environment is required when building. More information regarding charging, pricing, platform compatibility, and so on is not yet provided.