AT

aimasteracc/tree-sitter-analyzer

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

61 stars 17 forks 质量 91 趋势 33MIT

跨语言安全的代码智能MCP:适用于AI代理:13种语言,族门呼叫图,爆炸半径,健康分级,8个外观工具,JSON信封,100%本地化。

概览

— 在支持的语言库中正确跨语言结构,代理原生(MCP + CLI)。 TSA通过树状工具索引你的代码库,向AI编码代理提供正确的呼叫图、符号搜索和结构查询——本地且无遥测数据。 * 仅仅名称匹配不会产生跨语言边界,强制执行此限制的门是可执行测试而非惯例。* 8个MCP工具提供结构化的JSON输出和裁决信封,支持CLI访问和策划的工作流程。* 生成的支持深度清单区分了流水线证据与未经验证的跨文件行为。 从v1.x升级?请参见docs/MIGRATION.md。 (检查:python3 --版本)。如果需要,可以从 python.org 安装。 如果缺少 uv 会自动安装,检测 Claude Desktop / Claude Code / Cursor / VS Code,并写入 MCP 条目。运行 tree-sitter-analyzer --doctor 验证。

概述(AI 翻译)

英语 |日本語 |简体中文

代码智能 AI 智能代理可信 — 在支持的语言库中正确跨语言结构,代理原生(MCP + CLI)。

TSA通过树状工具索引你的代码库,向AI编码代理提供正确的呼叫图、符号搜索和结构查询——本地且无遥测数据。

为什么它不同:

  • 跨语言绑定由语言族限制。 仅仅名称匹配并不能产生跨语言边界,执行此边界的门是可执行测试而非约定。
  • 构建了代理原生。 8个MCP工具提供结构化的JSON输出和裁决信封,支持CLI访问和精心策划的工作流程。
  • 广泛且正确分类。 生成的支持深度清单区分了流水线证据与未经验证的跨文件行为。

从 v1.x 升级?请参见文档/MIGRATION.md。


开始

需要Python 3.10+(检查:python3 --version)。如有需要,从 python.org 安装。

自动安装(推荐)

如果缺少 uv,会自动安装,检测 Claude 桌面/Claude 代码/光标/VS Code,并写入 MCP 条目。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

🌳 Tree-sitter Analyzer

English | 日本語 | 简体中文

Code intelligence AI agents can trust — correct cross-language structure across the supported language inventory, agent-native (MCP + CLI).

TSA indexes your codebase with tree-sitter and serves correct call graphs, symbol search, and structural queries to AI coding agents — locally, with no telemetry.

Why it’s different:

  • Cross-language bindings are gated by language family. A name match alone does not create a cross-language edge, and the gates that enforce this are executable tests rather than a convention.
  • Built agent-native. 8 MCP tools provide structured JSON output and verdict envelopes, with CLI access and curated workflows.
  • Broad and correctly classified. The generated support-depth inventory distinguishes pipeline evidence from unverified cross-file behavior.

Upgrading from v1.x? See docs/MIGRATION.md.


Get Started

Requires Python 3.10+ (check: python3 --version). Install from python.org if needed.

curl -fsSL https://raw.githubusercontent.com/aimasteracc/tree-sitter-analyzer/main/install.sh | bash

Auto-installs uv if missing, detects Claude Desktop / Claude Code / Cursor / VS Code, and writes the MCP entry. Run tree-sitter-analyzer --doctor to verify.

Bootstrap trust: for convenience, the command above downloads and executes the official uv installer when uv is missing or outdated. That installer is mutable and not content-bound; TSA warns before downloading it to a temporary file over TLS and performs a strict post-install version check. To avoid this unverified bootstrap, install uv >= 0.11.0 manually first, or use the secure opt-out (which exits with manual-install instructions when bootstrap is needed):

curl -fsSL https://raw.githubusercontent.com/aimasteracc/tree-sitter-analyzer/main/install.sh \
  | TSA_DISABLE_UNVERIFIED_UV_BOOTSTRAP=1 bash

Install command for Claude Code:

claude mcp add tree-sitter-analyzer \
  --env TREE_SITTER_PROJECT_ROOT="$PWD" \
在 GitHub 查看完整 README

安装

uvx --from tree-sitter-analyzer[mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "tree-sitter-analyzer": { "command": "uvx", "args": ["--from", "tree-sitter-analyzer[mcp]", "tree-sitter-analyzer-mcp"], "env": { "TREE_SITTER_PROJECT_ROOT": "/absolute/path/to/your/project" } } } }