Skip to main content
Glama

MCP Source Tree Server

MCP 源树服务器

这是一个在指定目录下生成文件树的 MCP 服务器。根据以 开头的目录排除特定的文件或目录..gitignore中列出的条件。与 Claude 集成可以让 Claude 快速查看项目结构并帮助他确定要编辑的文件。

功能

  • 以 JSON 格式获取指定目录下的文件树。
  • 根据.gitignore条件排除文件/目录
  • 将目录结构表示为分层 JSON

设置

先决条件

  • Python 3.10 或更高版本
  • 紫外线

安装

# uvのインストール $ curl -LsSf https://astral.sh/uv/install.sh | sh $ cd /path/to/mcp-src-tree # ライブラリのインストール $ uv sync

Claude 用于桌面设置

将以下内容添加到claude_desktop_config.json

{ "mcpServers": { "src-tree": { "command": "uv", "args": [ "--directory", "/path/to/mcp-src-tree", # このプロジェクトディレクトリの絶対パスに書き換えてください "run", "tree.py" ] } } }

Claude 使用示例

请指定 src 上一级的根目录。当考虑.gitignore时,假定.gitignore直接存在于根目录下。 /Users/xxx/GitHub/xxx/ のソースツリーを確認してください,它将会起作用。

其回应如下:

はい、ソースツリーを確認させていただきます。 プロジェクトの構造を確認しました。以下のような構成になっています: src/ └── xxxx/ ├── __init__.py ├── converter.py ├── html_converter.py ├── image_processor.py ├── toc_analyzer.py └── utils.py

这使得 Claude 能够快速了解项目结构。

文件排除

以 开头的目录.将被自动排除。与.gitignore中的模式匹配的文件和目录将自动从树中排除。例如,以下.gitignore配置是有效的:

__pycache__/ node_modules/ *.log
Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

local-only server

The server can only run on the client's local machine because it depends on local resources.

从指定目录的“src”文件夹生成 JSON 文件树,遵守“.gitignore”规则,以便在 Claude 中快速审查项目结构。

  1. 功能
    1. 设置
      1. 先决条件
      2. 安装
    2. Claude 用于桌面设置
      1. Claude 使用示例
        1. 文件排除

          Related MCP Servers

          • A
            security
            A
            license
            A
            quality
            Provides tools for collecting and documenting code from directories.
            Last updated -
            4
            81
            12
            TypeScript
            MIT License
            • Apple
            • Linux
          • A
            security
            A
            license
            A
            quality
            Facilitates the analysis of Figma file structures by extracting node hierarchies, accessible via REST API or MCP protocol.
            Last updated -
            1
            2
            TypeScript
            MIT License
          • A
            security
            A
            license
            A
            quality
            A Node.js server that allows browsing Git repositories through MCP, providing tools to view directory structures and read important files from repositories.
            Last updated -
            2
            JavaScript
            MIT License
            • Linux
            • Apple
          • A
            security
            A
            license
            A
            quality
            Provides deep git file-level forensics tools to analyze detailed file histories, changes, and patterns within git repositories, focusing on individual file analysis rather than repository-wide operations.
            Last updated -
            4
            JavaScript
            Apache 2.0
            • Apple

          View all related MCP servers

          MCP directory API

          We provide all the information about MCP servers via our MCP API.

          curl -X GET 'https://glama.ai/api/mcp/v1/servers/owayo/mcp-src-tree'

          If you have feedback or need assistance with the MCP directory API, please join our Discord server