
code-to-tree
code-to-tree
README
Table of Contents
- MCP Server: code-to-tree
- Using code-to-tree
- Configure MCP Clients
- Building (Windows)
- Building (macOS)
<a id="orgf542482"></a>
MCP Server: code-to-tree
The code-to-tree server's goals are:
- Give LLMs the capability of accurately converting source code into AST(Abstract Syntax Tree), regardless of language.
- One standalone binary should be everything the MCP client needs.
These goals imply:
- The underlying syntax parser should be versatile enough. Here we choose tree-sitter, and languages are: C, C++, Rust, Ruby, Go, Java, Python.
- The server should be able to carry all capabilities within itself, imposing minimum software dependencies on the end user's machine. Here we choose mcpc.
Screenshots:
<img src="./chathistory.png" width="450px" /><img src="./wholeast.png" width="200px" />
The above screenshots are obtained by asking the question specified
in q.md
.
(IMPORTANT NOTE: LLMs have no responsibility of generating the identical result for the same question, you will likely get a completely different style or content. The screenshots or questions provided here are just for the reference)
<a id="org862e7dc"></a>
Using code-to-tree
Before everthing, you need to have the code-to-tree executable on your
machine (code-to-tree.exe
for Windows, code-to-tree
for macOS),
you can download at GitHub release page or build it yourself. Once
downloaded, you configure your MCP clients to install it, check the section
"Configure MCP Clients" for more details.
<a id="orge54fa87"></a>
Configure MCP Clients
Here we use Claude as the example.
Windows
In your Claude configuration
(C:\Users\YOUR_NAME\AppData\Roaming\Claude\claude_desktop_config.json
),
specify the location of code-to-tree.exe
:
{
"mcpServers": {
"code-to-tree": { "command": "C:\\path\\to\\code-to-tree.exe" }
}
}
macOS
In your Claude configuration,
(~/Library/Application Support/Claude/claude_desktop_config.json
)
specify the location of code-to-tree
{
"mcpServers": {
"code-to-tree": { "command": "/path/to/code-to-tree" }
}
}
<a id="org48a8180"></a>
Building (Windows)
1. Prepare environment
- download & install MSYS2.
- open application "MSYS2 MINGW64"
- run
pacman -S make gcc git
2. Prepare tree-sitter libraries
Here we need to compile and install tree-sitter and all related grammars.
Clone them:
git clone https://github.com/tree-sitter/tree-sitter
git clone https://github.com/tree-sitter/tree-sitter-c
git clone https://github.com/tree-sitter/tree-sitter-cpp
git clone https://github.com/tree-sitter/tree-sitter-rust
git clone https://github.com/tree-sitter/tree-sitter-ruby
git clone https://github.com/tree-sitter/tree-sitter-go
git clone https://github.com/tree-sitter/tree-sitter-java
Compile and install them:
cd tree-sitter && OS=1 make install
cd tree-sitter-c && OS=1 make install
cd tree-sitter-cpp && OS=1 make install
cd tree-sitter-rust && OS=1 make install
cd tree-sitter-ruby && OS=1 make install
cd tree-sitter-go && OS=1 make install
cd tree-sitter-java && OS=1 make install
3. Build code-to-tree
Install mcpc:
git clone https://github.com/micl2e2/mcpc
cd mcpc && make install
Compile code-to-tree:
cd mcpc/example/code-to-tree
CFLAGS="-I/usr/local/include -L/usr/local/lib" make
# Check the binary
file code-to-tree.exe
# Remember the binary's location
pwd
# Assume the output is: /c/path/to/code-to-tree.exe
<a id="orgbaa740e"></a>
Building (macOS)
1. Prepare environment
- Xcode Command Line Tools
2. Prepare tree-sitter libraries
Here we need to compile and install tree-sitter and all related grammars.
Clone them:
git clone https://github.com/tree-sitter/tree-sitter
git clone https://github.com/tree-sitter/tree-sitter-c
git clone https://github.com/tree-sitter/tree-sitter-cpp
git clone https://github.com/tree-sitter/tree-sitter-rust
git clone https://github.com/tree-sitter/tree-sitter-ruby
git clone https://github.com/tree-sitter/tree-sitter-go
git clone https://github.com/tree-sitter/tree-sitter-java
Compile and install them:
cd tree-sitter && make install
cd tree-sitter-c && make install
cd tree-sitter-cpp && make install
cd tree-sitter-rust && make install
cd tree-sitter-ruby && make install
cd tree-sitter-go && make install
cd tree-sitter-java && make install
3. Build code-to-tree
Install mcpc:
git clone https://github.com/micl2e2/mcpc
cd mcpc && make install
Compile code-to-tree:
cd mcpc/example/code-to-tree
make
# Check the binary
file ./code-to-tree
# Remember the binary's location
pwd
# Assume the output is: /path/to/code-to-tree
推荐服务器

Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。