codeTree
by ThinkyMiner·★ 25·综合分 46
MCP 服务器,通过 tree-sitter 提供 10 种语言的 23 个结构化代码理解工具。
概述
codeTree 是一个 MCP 服务器,通过 tree-sitter 解析为 AI 编码代理提供结构化代码理解。它提供 23 个代码分析工具,包括骨架提取、符号解析、调用图生成、复杂度分析、死代码检测和变更影响分析。该服务器支持 10 种流行的编程语言,包括 Python、JavaScript、TypeScript、Go、Rust、Java、C、C++ 和 Ruby,可通过 uv 一键安装。
试试问 AI
装完之后,这里有 5 个你可以让 AI 做的事:
什么时候选它
当您需要为跨多种语言的 AI 代理提供高效代码分析,而不想使用向量数据库或复杂配置时,选择 codeTree。
什么时候不要选它
如果您需要实时代码修改功能,或使用的语言不在其支持的 10 种语言列表中,则不要选择 codeTree。
此 server 暴露的工具
从 README 抽取出 12 个工具get_file_skeletonget_file_skeleton(file_path)Get classes, functions, methods with line numbers + doc comments
get_symbolget_symbol(file_path, symbol_name)Get full source of a function or class
find_referencesfind_references(symbol_name)Find all usages of a symbol across the repository
get_call_graphget_call_graph(file_path, function_name)Get what a function calls and what calls it
get_complexityget_complexity(file_path, function_name)Get cyclomatic complexity breakdown
search_symbolssearch_symbols(query?, type?, parent?)Flexible symbol search with filters
get_repository_mapget_repository_map(max_items?)Get compact repo overview: languages, entry points, hotspots
get_change_impactget_change_impact(symbol_query?, diff_scope?)Analyze impact of code changes with risk levels
analyze_dataflowanalyze_dataflow(file_path, function_name, mode?)Analyze variable dataflow or taint tracing
get_dependency_graphget_dependency_graph(file_path?, format?)Get file-level dependency graph as Mermaid or list
find_testsfind_tests(file_path, symbol_name)Find test functions for a specific symbol
suggest_docssuggest_docs(file_path?, symbol_name?)Find undocumented functions with context for doc generation
可对比工具
安装
安装
**先决条件:** 如果没有 [uv](https://docs.astral.sh/uv/getting-started/installation/),请安装它(curl -LsSf https://astral.sh/uv/install.sh | sh)。
然后进入任何项目目录并运行:
claude mcp add codetree -- uvx --from mcp-server-codetree codetree --root .Claude Desktop
添加到 ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) 或 %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"codetree": {
"command": "uvx",
"args": ["--from", "mcp-server-codetree", "codetree", "--root", "/path/to/your/project"]
}
}
}FAQ
- codeTree 与直接读取文件有何不同?
- codeTree 通过提供结构化代码理解,将令牌消耗减少高达 25 倍,而无需读取整个文件。代理可以请求特定符号、骨架或关系,而不是处理原始代码。
- codeTree 是否会取代 LSP 服务器?
- 不会,codeTree 通过 MCP 提供了一种轻量级、语言无关的代码理解方法,补充了 LSP 服务器。它是专门为 AI 代理而非人类开发人员设计的。
codeTree 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。