MCP-Server

anumair/MCP-Server

3.2

If you are the rightful owner of 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 MCP File Search Server is a tool designed to facilitate file searching through a Model Context Protocol server, offering efficient keyword search capabilities within files.

Tools
1
Resources
0
Prompts
0

MCP File Search Server

An MCP (Model Context Protocol) server that provides file search functionality.

Features

  • search_file: Search for a keyword within a specified file
    • Returns matching lines with line numbers
    • Supports case-sensitive and case-insensitive search
    • Provides detailed results including match count

Installation

npm install

Quick Test

We've included an interactive test client to help you quickly verify the server works correctly.

Run the Interactive Test

node test-client.js

This will:

  1. Start the MCP server
  2. Connect to it via the MCP SDK client
  3. List available tools
  4. Prompt you interactively for:
    • File path to search
    • Keyword to search for
    • Case-sensitive option (y/n)

Example Usage

=== MCP File Search Server - Interactive Test ===

✓ Connected to MCP server

Available tools:
  - search_file: Search for a keyword within a specified file and return matching lines with line numbers

Enter file path to search (or 'exit' to quit): test.txt
Enter keyword to search for: JavaScript
Case-sensitive search? (y/n, default: n): n

Searching...

File: test.txt
Keyword: "JavaScript"
Case-sensitive: false
Matches found: 2

Results:
  Line 4: JavaScript is a popular programming language.
  Line 5: Node.js makes server-side JavaScript possible.

==================================================

Enter file path to search (or 'exit' to quit): exit

✓ Goodbye!

Tips

  • Type exit when prompted for a file path to quit the program
  • The server will keep running until you exit, allowing multiple searches
  • Use the included test.txt file for testing, or any other text file

Usage with MCP Clients

Starting the Server

npm start

The server runs on stdio and can be integrated with MCP-compatible clients like Claude Desktop.

Configure in Claude Desktop

Add to your Claude Desktop configuration file:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "file-search": {
      "command": "node",
      "args": ["path/to/MCP-Server/index.js"]
    }
  }
}

Tool: search_file

Parameters

  • file_path (required): Path to the file to search in
  • keyword (required): Keyword to search for in the file
  • case_sensitive (optional): Whether the search should be case-sensitive (default: false)

Example Response

{
  "file": "/path/to/file.txt",
  "keyword": "example",
  "case_sensitive": false,
  "matches_found": 3,
  "results": [
    {
      "line_number": 5,
      "content": "This is an example line"
    },
    {
      "line_number": 12,
      "content": "Another example here"
    }
  ]
}

Testing with Your Own Files

Simply run the interactive test client and enter your own file paths and keywords when prompted:

node test-client.js

Then when asked:

  • File path: Enter the path to your file (e.g., myfile.txt or C:\path\to\file.txt)
  • Keyword: Enter the word or phrase you want to search for
  • Case-sensitive: Choose y for yes or n for no (default)

Files Included

  • index.js - Main MCP server implementation
  • test-client.js - Interactive test client to verify server functionality
  • test.txt - Sample file for testing (contains various text for search demonstrations)
  • package.json - Project dependencies and configuration
  • .gitignore - Git ignore rules

License

MIT