Smart-Search-MCP-Server

ddcrpf/Smart-Search-MCP-Server

3.2

If you are the rightful owner of Smart-Search-MCP-Server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The Smart Search MCP Server is a powerful tool designed to enhance file-search functionality by providing both exact keyword matching and semantic similarity suggestions.

Tools
1
Resources
0
Prompts
0

Smart Search MCP Server

A Model Context Protocol (MCP) server that provides intelligent file-search functionality with both exact keyword matching and semantic similarity suggestions when no exact match is found.

Features

  • Exact Keyword Matching: Searches for exact keyword matches in files
  • Position Tracking: Returns line numbers and character positions for all matches
  • Match Counting: Provides total count of keyword occurrences
  • Semantic Search: When no exact matches are found, uses Embedding Model to suggest top 5 semantically similar words
  • Case-Insensitive Search: Flexible matching regardless of case

Installation

  1. Clone this repository
  2. Install dependencies:
pip install -r requirements.txt

Usage

Starting the Server

python server.py

Tool: smart_search

Parameters:

  • file_path (string, required): Path to the file to search
  • keyword (string, required): Keyword to search for

Behavior:

  1. Exact Match Found: Returns all matches with:

    • Line numbers
    • Character positions
    • Line content
    • Total count
  2. No Exact Match: Returns top 5 semantically similar words with:

    • Similar words found in the file
    • Similarity scores (0-1)
    • Line numbers and content

Example:

Start MCP Inspector

run the below cmd to start the MCP inspector. This will open in a browser.

npx @modelcontextprotocol/inspector python3 server.py

Demo Screenshots

Selecting the smart_search MCP tool in Inspector

Exact match found example

Semantic fallback: no match - similar words returned

*Searching for ironman in beauty and beast returns nothing. *


👤 Author

Pranjal Chaubey