file-search-mcp

MCP.Pizza Chef: Kurogoma4D

File Search MCP is a Rust-built Model Context Protocol server providing efficient full-text search within filesystem directories. Leveraging the Tantivy search engine, it indexes text files in-memory for rapid keyword queries, smartly detects text versus binary files, and integrates seamlessly with MCP-compatible AI systems. It enables precise content retrieval and score-ranked search results, optimizing file exploration workflows.

Use This MCP server To

Perform full-text keyword searches across project directories Retrieve and display content of specific text files on demand Index large codebases or document collections for quick lookup Integrate with AI assistants to provide contextual file search Skip binary files automatically to focus on text content Generate search result summaries with relevance scoring Enable real-time search indexing for dynamic file systems

README

File Search MCP

A specialized Model Context Protocol (MCP) server for full-text search within a filesystem, built with Rust.

πŸ” Overview

File Search MCP is a tool that provides powerful full-text search capabilities for text files in a specified directory. It uses the Tantivy search engine to index and search through text content efficiently.

This project implements the Model Context Protocol (MCP), making it compatible with AI assistants and other systems that support the protocol.

✨ Features

  • Full-text search: Search for keywords in text files across a directory structure
  • File content reader: Read and display the content of specific text files
  • Smart file detection: Automatically identifies text files and skips binary files
  • MCP integration: Works with systems that support the Model Context Protocol
  • In-memory indexing: Creates fast, temporary indexes for search operations
  • Score-based results: Returns search hits with relevance scores

πŸ› οΈ Technology Stack

  • Rust: For performance, safety, and concurrency
  • Tantivy: A full-text search engine library in Rust
  • RMCP: Rust implementation of the Model Context Protocol
  • Tokio: Asynchronous runtime for Rust

πŸ“‹ Usage

First, install Rust sdk from here.

Clone this repository.

git clone git@github.com:Kurogoma4D/file-search-mcp.git

And add this to your MCP settings (in Cursor, Claude, ...).

  • command: <path-to-repo>/target/release/file-search-mcp

Replace <path-to-repo> to your cloned repository path.

πŸ”„ How It Works

  1. The server indexes text files in the specified directory, excluding binary files
  2. It processes the content of text files and adds them to an in-memory Tantivy index
  3. When a search is performed, it queries the index for matches and ranks them by relevance
  4. Results are returned with file paths and relevance scores
  5. The file content reader tool allows you to view the content of any text file by providing its path

πŸ› οΈ Available Tools

Search Tool

  • Description: Search for keywords in text files within a specified directory
  • Parameters:
    • directory: Path to the directory to search
    • keyword: Keyword to search for

File Content Reader Tool

  • Description: Read and display the content of a specific file
  • Parameters:
    • file_path: Path to the file to read

πŸ“„ License

MIT License

πŸ™ Acknowledgements

  • Tantivy for the full-text search engine
  • RMCP for the Model Context Protocol implementation

file-search-mcp FAQ

How does File Search MCP handle binary files?
It automatically detects and skips binary files, indexing only text files for search.
What search engine does File Search MCP use?
It uses the Tantivy search engine for fast, in-memory full-text indexing and querying.
Can File Search MCP integrate with different AI systems?
Yes, it supports the Model Context Protocol, making it compatible with AI assistants like OpenAI, Claude, and Gemini.
Is the search index persistent or temporary?
The index is created in-memory for fast, temporary search operations without persistent storage.
What programming language is File Search MCP built with?
It is implemented in Rust, ensuring performance and safety.
How does File Search MCP rank search results?
It provides score-based ranking to prioritize the most relevant file matches.
Can File Search MCP handle large directories efficiently?
Yes, it is optimized for indexing and searching large directory structures quickly.
Does File Search MCP support searching within file content only?
Yes, it focuses on full-text search within the content of text files.