Skip to main content
Glama

Directory Explorer MCP Server

by cdgaete

トークンスコープ

**注意:**このパッケージはtokenscopeとして公開されていますが、歴史的な理由によりリポジトリ名はdirectory-explorer-mcpのままです。

大規模言語モデル (LLM) 向けに設計された、トークン対応のディレクトリ探索および分析用のモデル コンテキスト プロトコル (MCP)サーバー。

概要

TokenScopeは、インテリジェントなディレクトリ構造分析とトークンを考慮したファイルコンテンツ探索機能を提供します。ClaudeのようなLLMがコードベースとディレクトリ構造を理解するのに役立ちます。

  1. トークン効率の高い要約によるディレクトリ構造のスキャン
  2. トークン認識によるファイル内容の抽出と分析
  3. コードベースを理解するための重要なファイルを見つける
  4. 関連情報を含むレポートの生成

特徴

  • トークン対応ディレクトリスキャン
    • 設定可能な深さでディレクトリを再帰的に探索します
    • 大規模なディレクトリにインテリジェントな概要を提供します
    • .gitignore ファイルとカスタム無視パターンを尊重
  • ファイルコンテンツ分析
    • トークン制限を尊重したファイル内容のスマートな抽出
    • JSONおよびその他の構造化ファイルの特別な処理
    • 重要度に基づくファイル選択の優先順位付け
  • トークン使用統計
    • ディレクトリの処理に必要なトークンを推定します
    • ファイル拡張子別にトークンの使用状況を分類します
    • トークンの多いファイルを識別します
  • 包括的なレポート
    • ディレクトリ構造を持つマークダウンレポートを生成する
    • トークンの使用統計情報が含まれています
    • 重要なファイルのサンプルを表示します

インストール

前提条件

  • Python 3.10以上
  • uv (依存関係の管理を容易にするために推奨)

1. メインインストール(PyPI)

これは、TokenScope のみを使用したいほとんどのユーザーに推奨される方法です。

# Install from PyPI using uv (recommended) uv pip install tokenscope
TokenScopeの実行

--base-path引数はセキュリティ上の理由から必須です。これにより、すべてのファイル操作が指定されたディレクトリに制限されます。

# Run using the installed package uv run --with tokenscope tokenscope --base-path /path/to/allowed/directory
Claude Desktopでの設定
  1. Claude Desktop の設定ファイルを見つけます (通常は~/.config/claude/config.jsonにあります)
  2. TokenScope をmcpServersセクションに追加します。
    "mcpServers": { "TokenScope": { "command": "uv", "args": [ "run", "--with", "tokenscope", "tokenscope", "--base-path", "/your/secure/base/path" ] } }
  3. /your/secure/base/path操作を制限したいディレクトリに置き換えます。
  4. 設定ファイルを保存し、Claude Desktopを再起動します。

2. 開発インストール(GitHubから)

コードを変更したい貢献者またはユーザーの場合:

# Clone the repository git clone https://github.com/cdgaete/directory-explorer-mcp.git cd directory-explorer-mcp # Install development dependencies with uv uv pip install -e ".[dev]"
開発モードで実行
# Run the server directly with uv uv run --with fastmcp --with tiktoken server.py --base-path /path/to/allowed/directory
Claude Desktopで開発バージョンを構成する
  1. Claude Desktopの設定ファイルを見つける
  2. 開発パスを使用して、 mcpServersセクションに TokenScope を追加します。
    "mcpServers": { "TokenScope (Dev)": { "command": "uv", "args": [ "run", "--with", "fastmcp", "--with", "tiktoken", "/path/to/your/directory-explorer-mcp/server.py", "--base-path", "/your/secure/base/path" ] } }
  3. /path/to/your/directory-explorer-mcp/server.pyを server.py ファイルへの実際のパスに置き換えます。
  4. /your/secure/base/pathセキュアディレクトリに置き換えます

セキュリティ機能

--base-path引数はセキュリティ上の理由から必須です。

  • すべてのファイル操作は、指定されたディレクトリ内にあることを確認するために検証されます。
  • ベースパス外のファイルにアクセスしたり変更したりする試みは拒否されます
  • ベースパスはサーバーの起動時に一度設定され、再起動しないと変更できません。

プロンプトの例

Claude で TokenScope を使用する方法の例をいくつか示します。

Please scan my project directory at /path/to/project and tell me about its structure, focusing on the most important files.
Analyze the token usage in my project directory at /path/to/project and tell me how many tokens would be needed to process the entire codebase with an LLM.
Generate a comprehensive directory report about my project at /path/to/project, including structure, token statistics, and samples of the most important files.

利用可能なツール

サーバーは次の MCP ツールを提供します。

scan_directory_structure

ディレクトリをスキャンし、トークン効率の高い方法でその構造を返します。

extract_file_content

トークンの制限と形式を尊重しながら、特定のファイルの内容を抽出します。

search_files_by_pattern

ディレクトリ構造内で指定されたパターンに一致するファイルを検索します。

analyze_token_usage

ディレクトリまたはファイルのトークンの使用状況を分析して、LLM 処理要件を推定します。

copy_file_to_destination

ソース パスから宛先パスにファイルをコピーします。

generate_directory_report

トークン統計を含むディレクトリに関する包括的なマークダウン レポートを生成します。

ライセンス

このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細については LICENSE ファイルを参照してください。

謝辞

  • FastMCPで構築
  • この同じコンセプトは元々はrepoaiで実装されました
  • LLMを使用してコードベースを効率的に分析する必要性に着想を得て
-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

大規模言語モデルのトークン対応ディレクトリ探索とファイル分析を提供し、ディレクトリスキャン、ファイルコンテンツの抽出、トークン使用統計などの機能を使用してインテリジェントなコードベースナビゲーションを可能にするモデルコンテキストプロトコルサーバー。

  1. 概要
    1. 特徴
      1. インストール
        1. 前提条件
        2. メインインストール(PyPI)
        3. 開発インストール(GitHubから)
      2. セキュリティ機能
        1. プロンプトの例
          1. 利用可能なツール
            1. scan_directory_structure
            2. extract_file_content
            3. search_files_by_pattern
            4. analyze_token_usage
            5. copy_file_to_destination
            6. generate_directory_report
          2. ライセンス
            1. 謝辞

              Related MCP Servers

              • A
                security
                F
                license
                A
                quality
                A Model Context Protocol server that reduces token consumption by efficiently caching data between language model interactions, automatically storing and retrieving information to minimize redundant token usage.
                Last updated -
                4
                3
                JavaScript
              • -
                security
                A
                license
                -
                quality
                A Model Context Protocol server that provides secure and intelligent interaction with files and filesystems, offering smart context management and token-efficient operations for working with large files and complex directory structures.
                Last updated -
                5
                Python
                MIT License
                • Apple
                • Linux
              • -
                security
                F
                license
                -
                quality
                A server component of the Model Context Protocol that provides intelligent analysis of codebases using vector search and machine learning to understand code patterns, architectural decisions, and documentation.
                Last updated -
                4
                Python
              • -
                security
                A
                license
                -
                quality
                A Model Context Protocol (MCP) server designed to easily dump your codebase context into Large Language Models (LLMs).
                Last updated -
                2
                1
                JavaScript
                Apache 2.0

              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/cdgaete/directory-explorer-mcp'

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