FileSearchMCP

sanketshinde3001/FileSearchMCP

3.2

If you are the rightful owner of FileSearchMCP 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 File Search MCP Server is a Model Context Protocol server designed to provide advanced file search capabilities.

Tools
1
Resources
0
Prompts
0

File Search MCP Server

A Model Context Protocol server that provides advanced file search capabilities.

Features

  • Search for keywords in files with line numbers
  • Case-sensitive and case-insensitive search
  • Whole word matching
  • Context lines display (lines before and after matches)
  • Line range filtering
  • Match count tracking

Installation

npm install
npm run build

Usage

Testing with MCP Inspector

npm run inspector

This will start the MCP Inspector in your browser where you can test the search tool.

Tool: search_in_file

Search for a keyword in a file with advanced filtering options.

Parameters:

  • filepath (required): Path to the file to search in
  • keyword (required): Keyword to search for
  • caseSensitive (optional): Whether search should be case-sensitive (default: false)
  • wholeWord (optional): Match whole words only (default: false)
  • contextLines (optional): Number of context lines to show before and after each match (default: 0)
  • startLine (optional): Start searching from this line number (default: 1)
  • endLine (optional): Stop searching at this line number

Example Input:

{
  "filepath": "./testFiles/sample1.txt",
  "keyword": "error",
  "caseSensitive": true,
  "wholeWord": false,
  "contextLines": 0,
  "startLine": 1
}

Example Output:

{
  "file": "./testFiles/sample1.txt",
  "keyword": "error",
  "options": {
    "caseSensitive": true,
    "wholeWord": false,
    "contextLines": 0
  },
  "totalMatches": 2,
  "linesWithMatches": 2,
  "matches": [
    {
      "lineNumber": 2,
      "content": "It contains some error messages.",
      "matchCount": 1
    },
    {
      "lineNumber": 5,
      "content": "Another error occurred here",
      "matchCount": 1
    }
  ]
}