Integrations
TokenScope
Note: This package is published as
tokenscope
but the repository name remainsdirectory-explorer-mcp
for historical reasons.
A Model Context Protocol (MCP) server for token-aware directory exploration and analysis, designed for Large Language Models (LLMs).
Overview
TokenScope provides intelligent directory structure analysis and token-aware file content exploration. It helps LLMs like Claude understand codebases and directory structures by:
- Scanning directory structures with token-efficient summaries
- Extracting and analyzing file contents with token awareness
- Finding important files for codebase understanding
- Generating reports with relevant information
Features
- Token-Aware Directory Scanning
- Explores directories recursively with configurable depth
- Provides intelligent summaries for large directories
- Respects .gitignore files and custom ignore patterns
- File Content Analysis
- Smart extraction of file contents that respects token limits
- Special handling for JSON and other structured files
- File selection prioritization based on importance
- Token Usage Statistics
- Estimates tokens required to process directories
- Breaks down token usage by file extension
- Identifies token-heavy files
- Comprehensive Reporting
- Generates markdown reports with directory structure
- Includes token usage statistics
- Shows samples of important files
Installation
Prerequisites
- Python 3.10 or higher
- uv (recommended for easy dependency management)
1. Main Installation (PyPI)
This is the recommended method for most users who just want to use TokenScope:
Running TokenScope
The --base-path
argument is mandatory for security reasons. It restricts all file operations to the specified directory.
Configuring in Claude Desktop
- Locate Claude Desktop's configuration file (typically in
~/.config/claude/config.json
) - Add TokenScope to the
mcpServers
section:Copy - Replace
/your/secure/base/path
with the directory you want to restrict operations to - Save the configuration file and restart Claude Desktop
2. Development Installation (from GitHub)
For contributors or users who want to modify the code:
Running in Development Mode
Configuring Development Version in Claude Desktop
- Locate Claude Desktop's configuration file
- Add TokenScope to the
mcpServers
section with development paths:Copy - Replace
/path/to/your/directory-explorer-mcp/server.py
with the actual path to the server.py file - Replace
/your/secure/base/path
with your secure directory
Security Features
The --base-path
argument is mandatory for security reasons:
- All file operations are validated to ensure they're within the specified directory
- Attempts to access or modify files outside the base path will be rejected
- The base path is set once when starting the server and cannot be changed without restart
Example Prompts
Here are some examples of how to use TokenScope with Claude:
Available Tools
The server provides the following MCP tools:
scan_directory_structure
Scans a directory and returns its structure in a token-efficient way.
extract_file_content
Extracts the content of a specific file, respecting token limits and format.
search_files_by_pattern
Searches for files matching specified patterns within a directory structure.
analyze_token_usage
Analyzes token usage for a directory or file to estimate LLM processing requirements.
copy_file_to_destination
Copy a file from source path to destination path.
generate_directory_report
Generates a comprehensive markdown report about a directory with token statistics.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
A Model Context Protocol server that provides token-aware directory exploration and file analysis for Large Language Models, enabling intelligent codebase navigation with features like directory scanning, file content extraction, and token usage statistics.
Related MCP Servers
- AsecurityFlicenseAqualityA 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 -43JavaScript
- -securityAlicense-qualityA 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 -5PythonMIT License
- -securityFlicense-qualityA 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 -4Python
- -securityAlicense-qualityA Model Context Protocol (MCP) server designed to easily dump your codebase context into Large Language Models (LLMs).Last updated -0JavaScriptApache 2.0