The MCP Source Tree Server generates a hierarchical JSON representation of a directory's file tree while applying intelligent filtering:
Generate File Tree: Creates a JSON-formatted structure of a specified directory
Filter with : Excludes files and directories based on
.gitignore
rulesExclude Hidden Items: Automatically ignores directories and files starting with
.
(e.g.,.git/
)Preserve Hierarchy: Maintains the original directory structure in the output
Respects .gitignore patterns to exclude files and directories according to Git's ignore rules when generating the file tree.
MCP Source Tree Server
指定されたディレクトリ配下のファイルツリーを生成するMCPサーバーです。
.
で始まるディレクトリや.gitignore
に記載された条件に従って、特定のファイルやディレクトリを除外します。
Claudeに組み込むことで、Claudeがプロジェクトの構造を素早く確認でき、Claudeが編集すべきファイルを特定するのに役立ちます。
機能
- 指定されたディレクトリ配下のファイルツリーをJSON形式で取得
.gitignore
の条件に従ってファイル/ディレクトリを除外- ディレクトリ構造を階層的なJSONで表現
セットアップ
必要条件
- Python 3.10以上
- uv
インストール
Claude for Desktopでの設定
claude_desktop_config.json
に以下の設定を追加してください:
Claudeでの使用例
指示するのはsrcの一つ上のルートディレクトリを指定してください。
.gitignore
を考慮する場合、ルートディレクトリ直下に .gitignore
が存在することが前提です。
/Users/xxx/GitHub/xxx/ のソースツリーを確認してください
のように指示すると動作します
以下のように応答します
これにより、Claudeが素早くプロジェクトの構造を確認できます。
ファイル除外
.
で始まるディレクトリは自動的に除外されます。
.gitignore
に記載されているパターンに合致するファイルやディレクトリは、ツリーから自動的に除外されます。
例えば、以下のような .gitignore
の設定が有効です:
local-only server
The server can only run on the client's local machine because it depends on local resources.
Tools
Generates a JSON file tree from a specified directory's 'src' folder, adhering to '.gitignore' rules, allowing for quick project structure review in Claude.
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityProvides tools for collecting and documenting code from directories.Last updated -434214MIT License
- AsecurityAlicenseAqualityAnalyzes source code dependencies across multiple programming languages in the specified directory to identify file relationships, assisting in dependency management and project structure understanding.Last updated -1MIT License
- AsecurityFlicenseAqualityA TypeScript-based server that visualizes project directory structures in Markdown format, automatically documenting file contents with syntax highlighting and supporting customizable exclusion patterns.Last updated -12992
- -securityAlicense-qualityA tool that helps rank codebase files by importance (1-10 scale), track file dependencies, and provide summaries, all accessible through a simple JSON-based interface.Last updated -2GPL 3.0