Code to Tree

v1.0.0โ€ขDeveloper Toolsโ€ขstable

๐ŸŒŠ ๐Ÿ  ๐Ÿ“Ÿ ๐Ÿง ๐ŸชŸ ๐ŸŽ - A single-binary MCP server that converts source code into AST, regardless of language.

abstract-syntax-treeagenticastclaudedependency-free
Share:
83
Stars
0
Downloads
0
Weekly
0/5

What is Code to Tree?

Code to Tree is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to ๐ŸŒŠ ๐Ÿ  ๐Ÿ“Ÿ ๐Ÿง ๐ŸชŸ ๐ŸŽ - a single-binary mcp server that converts source code into ast, regardless of language.

๐ŸŒŠ ๐Ÿ  ๐Ÿ“Ÿ ๐Ÿง ๐ŸชŸ ๐ŸŽ - A single-binary MCP server that converts source code into AST, regardless of language.

This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • ๐ŸŒŠ ๐Ÿ  ๐Ÿ“Ÿ ๐Ÿง ๐ŸชŸ ๐ŸŽ - A single-binary MCP server that converts sourc

Use Cases

AST generation for any language
Code structure visualization
Language-agnostic syntax parsing
micl2e2

Maintainer

LicenseMIT License
Languagec
Versionv1.0.0
UpdatedApr 26, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx code-to-tree

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Code to Tree

Code-to-Tree is a zero-dependency, single-binary MCP server that parses source code files into Abstract Syntax Trees (ASTs) using tree-sitter parsers, supporting C, C++, Rust, Ruby, Go, Java, and Python. Because LLMs work more accurately with structured AST representations than raw source text, this server enables AI assistants to reason about code structure, detect patterns, generate documentation, and perform refactoring analysis with higher precision. The server ships as a standalone native binary with no Node.js, Python, or other runtime required, making it easy to distribute and run on Linux, macOS, and Windows.

Prerequisites

  • A pre-built binary downloaded from the GitHub releases page (https://github.com/micl2e2/code-to-tree/releases), or a C build toolchain (make, gcc/clang) to compile from source
  • An MCP-compatible client such as Claude Desktop, Cursor, or Windsurf
  • Source code files in one of the supported languages: C, C++, Rust, Ruby, Go, Java, or Python
1

Download the pre-built binary

Visit the GitHub releases page and download the binary for your platform (Linux x86_64, macOS arm64/x86_64, or Windows). Place it in a directory on your PATH or note its absolute path.

# macOS example (adjust version and platform as needed)
curl -L https://github.com/micl2e2/code-to-tree/releases/latest/download/code-to-tree-macos-arm64 \
  -o /usr/local/bin/code-to-tree
chmod +x /usr/local/bin/code-to-tree
2

Verify the binary works

Run the binary directly to confirm it starts without errors. A working binary will initialize and wait for MCP protocol input.

code-to-tree --version
3

Configure your MCP client (macOS/Linux)

Open your MCP client configuration file and add the code-to-tree server entry. Use the absolute path to the binary.

{
  "mcpServers": {
    "code-to-tree": {
      "command": "/usr/local/bin/code-to-tree"
    }
  }
}
4

Configure your MCP client (Windows)

On Windows, use the .exe file path in your MCP client configuration.

{
  "mcpServers": {
    "code-to-tree": {
      "command": "C:\\tools\\code-to-tree.exe"
    }
  }
}
5

Restart your MCP client and test

Restart your MCP client so it connects to the new server. Ask Claude to parse a source file into an AST to verify the tool is working.

Code to Tree Examples

Client configuration

Minimal Claude Desktop configuration for the code-to-tree single-binary server on macOS.

{
  "mcpServers": {
    "code-to-tree": {
      "command": "/usr/local/bin/code-to-tree"
    }
  }
}

Prompts to try

Example prompts that use the AST server to analyze and document code.

- "Parse src/main.rs into an AST and list all function definitions with their signatures"
- "Convert app.py to an AST and identify all class definitions and their methods"
- "Parse lib/parser.c using AST and find all places where malloc is called without a matching free"
- "Generate documentation for every exported function in src/api.go based on its AST structure"
- "Compare the AST structure of old_impl.java and new_impl.java and summarize structural differences"
- "Parse the Ruby file models/user.rb and list all method names and their argument counts"

Troubleshooting Code to Tree

Permission denied when running the binary on macOS

Run 'chmod +x /path/to/code-to-tree' to make it executable. On macOS, you may also need to allow it in System Settings > Privacy & Security > Security if it is blocked by Gatekeeper.

MCP client shows 'server disconnected' immediately

Test the binary by running it directly in a terminal. Confirm the path in your config is the absolute path to the binary, not a relative one. On Windows, make sure you use double backslashes in the JSON path string.

Language not supported or AST parse fails

Code-to-Tree currently supports C, C++, Rust, Ruby, Go, Java, and Python. Files in other languages will not parse. Check that the file extension matches one of the supported languages.

Frequently Asked Questions about Code to Tree

What is Code to Tree?

Code to Tree is a Model Context Protocol (MCP) server that ๐ŸŒŠ ๐Ÿ  ๐Ÿ“Ÿ ๐Ÿง ๐ŸชŸ ๐ŸŽ - a single-binary mcp server that converts source code into ast, regardless of language. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Code to Tree?

Follow the installation instructions on the Code to Tree GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Code to Tree?

Code to Tree works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Code to Tree free to use?

Yes, Code to Tree is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.

Browse More Developer Tools MCP Servers

Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "code-to-tree": { "command": "npx", "args": ["-y", "code-to-tree"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide โ†’

Ready to use Code to Tree?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides