TokenScope: Token-Aware Directory Explorer

by cdgaete

331 downloads
Not rated
GitHub

About

A tool to analyze directory structures while being mindful of token limitations for LLMs. Customize ignore files like gitignore patterns, such as .venv or node_modules

Details

Author
cdgaete
Downloads
331
Categories
Other, AI

- Recursive directory scanning with token-efficient summaries
- Smart file content extraction respecting token limits
- Pattern-based file search within the allowed directory
- Token usage estimation for entire directories
- Comprehensive directory reports with structure and token statistics
- Secure file copying between locations inside the base path

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name TokenScope: Token-Aware Directory Explorer
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Configure TokenScope with a mandatory base path for security, then invoke its six tools (e.g., scan_directory_structure, extract_file_content, search_files_by_pattern, analyze_token_usage, generate_directory_report, copy_file_to_destination) from any MCP-compatible client. All operations are confined to the allowed directory and automatically respect .gitignore rules.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "tokenscope: token-aware directory explorer": {
            "TokenScope": {
                "command": "uv",
                "args": [
                    "run",
                    "--with",
                    "tokenscope",
                    "tokenscope",
                    "--base-path",
                    "/your/secure/base/path"
                ]
            }
        }
    }
}

McpServers

{
    "TokenScope": {
        "command": "uv",
        "args": [
            "run",
            "--with",
            "tokenscope",
            "tokenscope",
            "--base-path",
            "/your/secure/base/path"
        ]
    }
}

TokenScope is a token-aware directory explorer for Large Language Models (LLMs) implemented as a Model Context Protocol (MCP) server. It provides intelligent directory structure analysis and token-aware file content extraction to help LLMs understand codebases efficiently.

The server offers five main tools:
1. scan_directory_structure: Scans directories recursively with token-efficient summaries
2. extract_file_content: Smartly extracts file contents respecting token limits
3. search_files_by_pattern: Finds files matching specific patterns
4. analyze_token_usage: Estimates tokens required to process directories
5. generate_directory_report: Creates comprehensive reports with structure and token statistics
6. copy_file_to_destination: Copies files between locations within the allowed directory

All operations respect a mandatory base path for security, filtering via .gitignore patterns, and optimize token usage for LLM communication.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.