Everything Search MCP Server

repository·main·Indexed 43 days ago

https://github.com/mamertofabian/mcp-everything-search

A Model Context Protocol (MCP) server providing fast file searching across Windows, macOS, and Linux. It leverages the Everything SDK on Windows, Spotlight (mdfind) on macOS, and locate/plocate on Linux. Version 0.2.1 includes a search tool with support for regex, case sensitivity, and various sort options by filename, size, and date.

Tokens
5.9K
Snippets
16
Records
30
Agent score
57%

What's inside Everything Search

  1. Windows Search Syntax (Everything SDK)

    main

    When using the Everything SDK on Windows, you can use advanced operators, wildcards, and specialized functions to refine your searches.

    Basic Operators

    • space: AND operator
    • |: OR operator
    • !: NOT operator
    • < >: Grouping
    • " ": Exact phrase

    Wildcards

    • *: Zero or more characters
    • ?: Exactly one character Note: Wildcards match the whole filename by default unless 'Match whole filename' is disabled.

    Function Syntax

    Use these comparison operators with functions:

    • function:value (Equal to)
    • function:<=value (Less than or equal)
    • function:<value (Less than)
    • function:=value (Equal to)
    • function:>value (Greater than)
    • function:>=value (Greater than or equal)
    • function:start..end (Range)
    • function:start-end (Range)
    # Example 1: Find Python files modified today
    ext:py datemodified:today
    
    # Example 2: Find large video files
    ext:mp4|mkv|avi size:>1gb
    
    # Example 3: Find files in specific folder
    path:C:\Projects *.js
  2. macOS Search Syntax (mdfind)

    main

    macOS uses Spotlight's mdfind command. Searches can target metadata attributes, content types, and dates.

    Command Options

    • -live: Live updates to results
    • -count: Show only the number of matches
    • -onlyin <directory>: Limit search to a specific directory
    • -literal: Treat query as literal text
    • -interpret: Interpret query as if typed in Spotlight menu

    Basic Search & Operators

    • Simple text searches match any metadata attribute.
    • Multiple words are treated as AND conditions.
    • | (OR): Match either word (e.g., "image|photo")
    • - (NOT): Exclude matches (e.g., -screenshot)
    • =, == (equal)
    • != (not equal)
    • <, > (less/greater than)
    • <=, >= (less/greater than or equal)
    • Use parentheses () to group expressions.

    Value Comparison Modifiers

    Use brackets with modifiers:

    • [c]: Case-insensitive comparison
    • [d]: Diacritical marks insensitive
    • [cd]: Both case and diacritical insensitive
    # Example 1: Find images modified yesterday
    kind:image date:yesterday
    
    # Example 2: Find documents by author (case-insensitive)
    kMDItemAuthors ==[c] "John Doe"
    
    # Example 3: Find files in specific directory
    mdfind -onlyin ~/Documents "query"
    
    # Example 4: Complex metadata search
    kMDItemContentTypeTree = "public.image" && kMDItemUserTags = "vacation" && kMDItemFSContentChangeDate >= $time.this_month()
  3. Linux Search Syntax (locate/plocate)

    main

    Linux uses locate or plocate for fast filename searching.

    • Simple text searches match against filenames.
    • Multiple words are treated as AND conditions.
    • Wildcards (* and ?) are supported.
    • Case-insensitive by default.

    Search Options

    • -i: Case-insensitive search (default)
    • -c: Count matches instead of showing them
    • -r or --regex: Use regular expressions
    • -b: Match only the basename
    • -w: Match whole words only

    Note: The locate database must be up to date. Run sudo updatedb to update it manually.

    Examples

    # Find all Python files
    *.py
    
    # Find files in home directory
    /home/username/*
    
    # Case-sensitive search for specific file using regex
    --regex "^/etc/[A-Z].*\.conf$"
  4. Configure Prerequisites for Windows, Linux, and macOS

    main

    Before running the server, ensure the following system requirements are met:

    Windows

    1. Install Everything and ensure the Everything service is running.
    2. Download and extract the Everything SDK.
    3. Set the EVERYTHING_SDK_PATH environment variable to the path of Everything64.dll.

    Linux

    1. Install plocate or mlocate:
      • Ubuntu/Debian: sudo apt-get install plocate or sudo apt-get install mlocate
      • Fedora: sudo dnf install mlocate
    2. Update the database:
      • For plocate: sudo updatedb
      • For mlocate: sudo /etc/cron.daily/mlocate

    macOS

    • No additional setup required (uses built-in mdfind).
  5. Install Everything Search MCP Server

    main

    You can install the server using several methods depending on your preferred package manager.

    Option 1: Smithery (Automatic Claude Desktop installation)

    npx -y @smithery/cli install mcp-server-everything-search --client claude

    Option 2: uv (Recommended) No specific installation is needed; use uvx to run the server directly.

    Option 3: PIP

    pip install mcp-server-everything-search

    To run after PIP installation:

    python -m mcp_server_everything_search
  6. How to get the appropriate SearchProvider for your platform

    main

    The SearchProvider.get_provider() factory method automatically detects the current operating system and returns the corresponding implementation:

    • macOS: Returns MacSearchProvider (uses mdfind).
    • Linux: Returns LinuxSearchProvider (uses plocate or mlocate).
    • Windows: Returns WindowsSearchProvider (uses Everything SDK).

    If the platform is not supported, it raises a NotImplementedError.

    provider = SearchProvider.get_provider()
    results = provider.search_files(query="my_file")
  7. Configure Claude Desktop for Everything Search

    main

    Add the server configuration to your claude_desktop_config.json file based on your OS and installation method.

    Windows (using uvx)

    "mcpServers": {
      "everything-search": {
        "command": "uvx",
        "args": ["mcp-server-everything-search"],
        "env": {
          "EVERYTHING_SDK_PATH": "path/to/Everything-SDK/dll/Everything64.dll"
        }
      }
    }

    Windows (using pip)

    "mcpServers": {
      "everything-search": {
        "command": "python",
        "args": ["-m", "mcp_server_everything_search"],
        "env": {
          "EVERYTHING_SDK_PATH": "path/to/Everything-SDK/dll/Everything64.dll"
        }
      }
    }

    Linux and macOS (using uvx)

    "mcpServers": {
      "everything-search": {
        "command": "uvx",
        "args": ["mcp-server-everything-search"]
      }
    }

    Linux and macOS (using pip)

    "mcpServers": {
      "everything-search": {
        "command": "python",
        "args": ["-m", "mcp_server_everything_search"]
      }
    }
  8. Everything SDK (Windows) Search Syntax Guide

    main

    When searching on Windows, you can use advanced syntax within your query string:

    1. Basic Operators

    • space: AND operator
    • |: OR operator
    • !: NOT operator
    • < >: Grouping
    • " ": Exact phrase

    2. Wildcards

    • *: Zero or more characters
    • ?: Exactly one character

    3. Functions

    • Size: size:<size>[kb|mb|gb] (e.g., size:>1gb)
    • Dates: datemodified:<date>, dateaccessed:<date>, datecreated:<date> (Formats: YYYY-MM-DD or today, yesterday, etc.)
    • Attributes: attrib:<attributes> (e.g., A:Archive, H:Hidden)
    • Type: ext:<list> (e.g., ext:py;js)
    • Path: path:<path>, infolder:<path>, nosubfolders:<path>

    4. Modifiers

    • case: / nocase:
    • file: / folder:
    • path: / nopath:
    • regex: / noregex:
  9. Debug the Everything Search MCP Server

    main

    If you encounter issues, you can use the MCP inspector or check the logs.

    Using MCP Inspector For uvx installations:

    npx @modelcontextprotocol/inspector uvx mcp-server-everything-search

    For local development/cloned repositories:

    git clone https://github.com/mamertofabian/mcp-everything-search.git
    cd mcp-everything-search/src/mcp_server_everything_search
    npx @modelcontextprotocol/inspector uv run mcp-server-everything-search

    Viewing Logs

    • Linux/macOS: tail -f ~/.config/Claude/logs/mcp*.log
    • Windows (PowerShell): Get-Content -Path "$env:APPDATA\Claude\logs\mcp*.log" -Tail 20 -Wait
  10. Use the `search` tool to find files and folders

    main

    The search tool allows for fast file searching across different operating systems.

    Platform-specific capabilities:

    • Windows: Full support for Everything SDK features.
    • macOS: Basic filename and content search via Spotlight (mdfind).
    • Linux: Basic filename search via locate/plocate database.

    Parameters:

    • query (required): The search string.
    • max_results (optional): Max results to return (default: 100, max: 1000).
    • match_path (optional): Match against full path instead of filename (default: false).
    • match_case (optional): Enable case-sensitive search (default: false).
    • match_whole_word (optional): Match whole words only (default: false).
    • match_regex (optional): Enable regex search (default: false).
    • sort_by (optional): Sort order (default: 1).

    Sort Options (sort_by):

    • 1: Filename (A to Z)
    • 2: Filename (Z to A)
    • 3: Path (A to Z)
    • 4: Path (Z to A)
    • 5: Size (smallest first)
    • 6: Size (largest first)
    • 7: Extension (A to Z)
    • 8: Extension (Z to A)
    • 11: Creation date (oldest first)
    • 12: Creation date (newest first)
    • 13: Modification date (oldest first)
    • 14: Modification date (newest first)

    Response Format: Each result includes the file/folder path, file size in bytes, and the last modified date.

    {
      "query": "*.py",
      "max_results": 50,
      "sort_by": 6
    }