- MCP Server: code-to-tree - Using code-to-tree - Configure MCP Clients - Building (Windows) - Building (macOS) The code-to-tree server's goals are: 1. Give LLMs the capability of accurately converting source code into AST(Abstract Syntax Tree), regardless of language. 2. One standalone binary should be everything the MCP client needs. These goals imply: 1. The underlying syntax parser should be v
Add this skill
npx mdskills install micl2e2/code-to-treeProvides accurate AST conversion for multiple languages via standalone MCP server
12# Table of Contents34- [MCP Server: code-to-tree](#orgf542482)5- [Using code-to-tree](#org862e7dc)6- [Configure MCP Clients](#orge54fa87)7- [Building (Windows)](#org48a8180)8- [Building (macOS)](#orgbaa740e)9101112<a id="orgf542482"></a>1314# MCP Server: code-to-tree1516The code-to-tree server's goals are:17181. Give LLMs the capability of **accurately** converting source code into19 AST(Abstract Syntax Tree), regardless of language.202. One **standalone** binary should be everything the MCP client needs.2122These goals imply:23241. The underlying syntax parser should be **versatile** enough. Here we25 choose [tree-sitter](https://github.com/tree-sitter/tree-sitter), and languages are: C, C++, Rust, Ruby, Go, Java, Python.262. The server should be able to carry all capabilities within27 itself, imposing **minimum** software dependencies on the end user's28 machine. Here we choose [mcpc](https://github.com/micl2e2/mcpc).2930**Screenshots:**3132<img src="./chathistory.png" width="450px" /><img src="./wholeast.png" width="200px" />3334The above screenshots are obtained by asking the question specified35in `q.md`.3637(**IMPORTANT NOTE**: LLMs have no responsibility of generating the identical38result for the same question, you will likely get a completely different39style or content. The screenshots or questions provided here are just for the reference)404142<a id="org862e7dc"></a>4344# Using code-to-tree4546Before everthing, you need to have the code-to-tree executable on your47machine (`code-to-tree.exe` for Windows, `code-to-tree` for macOS),48you can download at GitHub release [page](https://github.com/micl2e2/code-to-tree/releases) or build it yourself. Once49downloaded, you configure your MCP clients to install it, check the section50*"Configure MCP Clients"* for more details.515253<a id="orge54fa87"></a>5455# Configure MCP Clients5657Here we use Claude as the example.585960## Windows6162In your Claude configuration63(`C:\Users\YOUR_NAME\AppData\Roaming\Claude\claude_desktop_config.json`),64specify the location of `code-to-tree.exe`:6566 {67 "mcpServers": {68 "code-to-tree": { "command": "C:\\path\\to\\code-to-tree.exe" }69 }70 }717273## macOS7475In your Claude configuration,76(`~/Library/Application Support/Claude/claude_desktop_config.json`)77specify the location of `code-to-tree`7879 {80 "mcpServers": {81 "code-to-tree": { "command": "/path/to/code-to-tree" }82 }83 }848586<a id="org48a8180"></a>8788# Building (Windows)899091## 1. Prepare environment92931. download & install MSYS2.942. open application "MSYS2 MINGW64"953. run `pacman -S make gcc git`969798## 2. Prepare tree-sitter libraries99100Here we need to compile and install tree-sitter and all related grammars.101102Clone them:103104 git clone https://github.com/tree-sitter/tree-sitter105106 git clone https://github.com/tree-sitter/tree-sitter-c107108 git clone https://github.com/tree-sitter/tree-sitter-cpp109110 git clone https://github.com/tree-sitter/tree-sitter-rust111112 git clone https://github.com/tree-sitter/tree-sitter-ruby113114 git clone https://github.com/tree-sitter/tree-sitter-go115116 git clone https://github.com/tree-sitter/tree-sitter-java117118Compile and install them:119120 cd tree-sitter && OS=1 make install121122 cd tree-sitter-c && OS=1 make install123124 cd tree-sitter-cpp && OS=1 make install125126 cd tree-sitter-rust && OS=1 make install127128 cd tree-sitter-ruby && OS=1 make install129130 cd tree-sitter-go && OS=1 make install131132 cd tree-sitter-java && OS=1 make install133134135## 3. Build code-to-tree136137Install mcpc:138139 git clone https://github.com/micl2e2/mcpc140 cd mcpc && make install141142Compile code-to-tree:143144 cd mcpc/example/code-to-tree145146 CFLAGS="-I/usr/local/include -L/usr/local/lib" make147148 # Check the binary149 file code-to-tree.exe150151 # Remember the binary's location152 pwd153 # Assume the output is: /c/path/to/code-to-tree.exe154155156<a id="orgbaa740e"></a>157158# Building (macOS)159160161## 1. Prepare environment1621631. Xcode Command Line Tools164165166## 2. Prepare tree-sitter libraries167168Here we need to compile and install tree-sitter and all related grammars.169170Clone them:171172 git clone https://github.com/tree-sitter/tree-sitter173174 git clone https://github.com/tree-sitter/tree-sitter-c175176 git clone https://github.com/tree-sitter/tree-sitter-cpp177178 git clone https://github.com/tree-sitter/tree-sitter-rust179180 git clone https://github.com/tree-sitter/tree-sitter-ruby181182 git clone https://github.com/tree-sitter/tree-sitter-go183184 git clone https://github.com/tree-sitter/tree-sitter-java185186Compile and install them:187188 cd tree-sitter && make install189190 cd tree-sitter-c && make install191192 cd tree-sitter-cpp && make install193194 cd tree-sitter-rust && make install195196 cd tree-sitter-ruby && make install197198 cd tree-sitter-go && make install199200 cd tree-sitter-java && make install201202203## 3. Build code-to-tree204205Install mcpc:206207 git clone https://github.com/micl2e2/mcpc208 cd mcpc && make install209210Compile code-to-tree:211212 cd mcpc/example/code-to-tree213214 make215216 # Check the binary217 file ./code-to-tree218219 # Remember the binary's location220 pwd221 # Assume the output is: /path/to/code-to-tree222223
Full transparency — inspect the skill content before installing.