Skip to content

MausRundung/mcp-explorer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Project Explorer MCP Server

A powerful Model Context Protocol server for exploring, analyzing, and managing project files with advanced search capabilities

πŸ“¦ Available on npm: @team-jd/mcp-project-explorer

⚑ Quick Start

{
  "mcpServers": {
    "project-explorer": {
      "command": "npx",
      "args": ["-y", "@team-jd/mcp-project-explorer", "/your/project/path"]
    }
  }
}

npm version npm downloads Node.js TypeScript GitHub


πŸš€ Overview

The Project Explorer MCP Server provides comprehensive tools for analyzing project structures, searching through codebases, managing dependencies, and performing file operations. Perfect for developers who need intelligent project navigation and analysis capabilities.

πŸ“¦ Installation & Setup

πŸš€ For MCP Users (Recommended)

Add this server to your MCP settings configuration:

{
  "mcpServers": {
    "project-explorer": {
      "command": "npx",
      "args": [
        "-y",
        "@team-jd/mcp-project-explorer",
        "/path/to/your/project"
      ]
    }
  }
}

πŸ“ Multiple Directory Access:

{
  "mcpServers": {
    "project-explorer": {
      "command": "npx",
      "args": [
        "-y",
        "@team-jd/mcp-project-explorer",
        "/path/to/project1",
        "/path/to/project2",
        "/path/to/project3"
      ]
    }
  }
}

πŸ› οΈ For Developers

# Clone and setup for development
git clone https://github.com/MausRundung362/mcp-explorer.git
cd mcp-explorer

# Install dependencies
npm install

# Build the project
npm run build

# Run the MCP inspector for testing
npm run inspector

πŸ› οΈ Available Commands

πŸ“‚ explore_project

Analyzes project structure with detailed file information and import/export analysis

// Basic usage
explore_project({
  directory: "/path/to/project"
})

// Advanced usage
explore_project({
  directory: "/path/to/project",
  subDirectory: "src",           // Optional: focus on specific subdirectory
  includeHidden: false          // Optional: include hidden files (default: false)
})

✨ Features:

  • πŸ“Š File size analysis with human-readable formatting
  • πŸ” Import/export statement detection for JS/TS files
  • 🚫 Automatically excludes build directories (node_modules, .git, dist, .vscode, .gradle, .idea, etc.)
  • πŸ“ Recursive directory traversal
  • 🎯 Support for subdirectory analysis

πŸ”Ž search_files

Advanced file and code search with comprehensive filtering capabilities

// Simple text search
search_files({
  pattern: "your search term",
  searchPath: "/path/to/search"
})

// Advanced search with filters
search_files({
  pattern: "function.*async",     // Regex pattern
  searchPath: "/path/to/search",
  regexMode: true,               // Enable regex
  caseSensitive: false,          // Case sensitivity
  extensions: [".js", ".ts"],    // File types to include
  excludeExtensions: [".min.js"], // File types to exclude
  excludeComments: true,         // Skip comments
  excludeStrings: true,          // Skip string literals
  maxResults: 50,                // Limit results
  sortBy: "relevance"            // Sort method
})

πŸŽ›οΈ Search Options:

Parameter Type Default Description
pattern string ".*" Search pattern (text or regex)
searchPath string first allowed dir Directory to search in
extensions string[] all Include only these file types
excludeExtensions string[] [] Exclude these file types
excludePatterns string[] [] Exclude filename patterns
regexMode boolean false Treat pattern as regex
caseSensitive boolean false Case-sensitive search
wordBoundary boolean false Match whole words only
multiline boolean false Multiline regex matching
maxDepth number unlimited Directory recursion depth
followSymlinks boolean false Follow symbolic links
includeBinary boolean false Search in binary files
minSize number none Minimum file size (bytes)
maxSize number none Maximum file size (bytes)
modifiedAfter string none Files modified after date (ISO 8601)
modifiedBefore string none Files modified before date (ISO 8601)
snippetLength number 50 Text snippet length around matches
maxResults number 100 Maximum number of results
sortBy string "relevance" Sort by: relevance, file, lineNumber, modified, size
groupByFile boolean true Group results by file
excludeComments boolean false Skip comments (language-aware)
excludeStrings boolean false Skip string literals
outputFormat string "text" Output format: text, json, structured

🎯 Use Cases:

  • πŸ” Find all TODO comments: pattern: "TODO.*", excludeStrings: true
  • πŸ› Search for potential bugs: pattern: "console\\.log", regexMode: true
  • πŸ“¦ Find import statements: pattern: "import.*from", regexMode: true
  • πŸ”§ Recent changes: modifiedAfter: "2024-01-01", extensions: [".js", ".ts"]

πŸ“Š check_outdated

Checks for outdated npm packages with detailed analysis

// Basic check
check_outdated({
  projectPath: "/path/to/project"
})

// Detailed analysis
check_outdated({
  projectPath: "/path/to/project",
  includeDevDependencies: true,  // Include dev dependencies
  outputFormat: "detailed"       // detailed, summary, or raw
})

πŸ“‹ Output Formats:

  • detailed - Full package info with versions and update commands
  • summary - Count of outdated packages by type
  • raw - Raw npm outdated JSON output

πŸ”§ Requirements:

  • Node.js and npm must be installed
  • Valid package.json in the specified directory

πŸ—‘οΈ delete_file

Safely delete files or directories with protection mechanisms

// Delete a file
delete_file({
  path: "/path/to/file.txt"
})

// Delete a directory (requires recursive flag)
delete_file({
  path: "/path/to/directory",
  recursive: true,              // Required for directories
  force: false                  // Force deletion of read-only files
})

⚠️ Safety Features:

  • πŸ”’ Only works within allowed directories
  • πŸ“ Requires recursive: true for non-empty directories
  • πŸ›‘οΈ Protection against accidental deletions
  • ⚑ Optional force deletion for read-only files

✏️ rename_file

Rename or move files and directories

// Simple rename
rename_file({
  oldPath: "/path/to/old-name.txt",
  newPath: "/path/to/new-name.txt"
})

// Move to different directory
rename_file({
  oldPath: "/path/to/file.txt",
  newPath: "/different/path/file.txt"
})

✨ Features:

  • πŸ“ Works with both files and directories
  • πŸ”„ Can move between directories
  • 🚫 Fails if destination already exists
  • πŸ”’ Both paths must be within allowed directories

πŸ“‹ list_allowed_directories

Shows which directories the server can access

list_allowed_directories()

πŸ”§ Use Cases:

  • πŸ” Check access permissions before operations
  • πŸ›‘οΈ Security validation
  • πŸ“‚ Directory discovery

🎨 Usage Examples

πŸ“Š Project Analysis Workflow

// 1. Check what directories you can access
list_allowed_directories()

// 2. Explore the project structure
explore_project({
  directory: "/your/project/path",
  includeHidden: false
})

// 3. Search for specific patterns
search_files({
  pattern: "useState",
  searchPath: "/your/project/path",
  extensions: [".jsx", ".tsx"],
  excludeComments: true
})

// 4. Check for outdated dependencies
check_outdated({
  projectPath: "/your/project/path",
  outputFormat: "detailed"
})

πŸ” Advanced Search Scenarios

// Find all async functions
search_files({
  pattern: "async\\s+function",
  regexMode: true,
  extensions: [".js", ".ts"]
})

// Find large files modified recently
search_files({
  pattern: ".*",
  minSize: 1000000,  // 1MB+
  modifiedAfter: "2024-01-01",
  sortBy: "size"
})

// Find TODO comments excluding test files
search_files({
  pattern: "TODO|FIXME|BUG",
  regexMode: true,
  excludePatterns: ["*test*", "*spec*"],
  excludeStrings: true
})

πŸ›‘οΈ Security & Permissions

The server operates within allowed directories only, providing:

  • πŸ”’ Sandboxed access - Cannot access files outside allowed paths
  • πŸ›‘οΈ Safe operations - Built-in protections against dangerous operations
  • πŸ“‚ Path validation - All paths are normalized and validated
  • ⚠️ Error handling - Clear error messages for permission issues

πŸ”§ Development

πŸ“ Project Structure

src/
β”œβ”€β”€ index.ts              # Main server entry point
β”œβ”€β”€ explore-project.ts    # Project analysis tool
β”œβ”€β”€ search.ts            # Advanced search functionality
β”œβ”€β”€ check-outdated.ts   # NPM dependency checker
β”œβ”€β”€ delete-file.ts       # File deletion tool
β”œβ”€β”€ rename-file.ts       # File rename/move tool
└── list-allowed.ts      # Directory permission checker

πŸ—οΈ Build Commands

npm run build     # Compile TypeScript
npm run watch     # Watch mode for development
npm run inspector # Test with MCP inspector

🀝 Contributing

  1. 🍴 Fork the repository
  2. 🌟 Create a feature branch
  3. πŸ’» Make your changes
  4. βœ… Test thoroughly
  5. πŸš€ Submit a pull request

πŸ“„ License

See LICENSE file for details.


Happy coding! πŸŽ‰

Built with ❀️ using TypeScript and the Model Context Protocol

About

Model Context Protocol server providing advanced file system operations, regex search, import/export analysis, and npm dependency management.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Contributors