- Home
- MCP servers
- Keyword Search
Keyword Search
- python
0
GitHub Stars
python
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
This MCP Server provides a simple, fast API to search for a keyword inside a text file, returning the lines that contain matches in a case-insensitive manner. It runs as a FastAPI application and exposes a search endpoint you can call from any MCP client to quickly locate relevant content within files.
How to use
You interact with the server through an MCP client by sending a search request that includes the path to the target file and the keyword you want to find. The server processes the file and returns the lines that contain the keyword, regardless of case, along with their line content. This makes it easy to scan large files for occurrences of a term without manually opening the file.
Typical use cases include locating definitions, references, or examples of a particular term across code, docs, or data files. You can run the MCP client against the server running on your machine, and you will receive a structured list of matching lines to review or further process.
How to install
Prerequisites you need before starting: Python 3.8+ and a shell or terminal. You should have access to a Python environment where you can install dependencies.
python -m venv venv
# Activate it:
# On Windows:
venv\Scripts\activate
# On Linux/Mac:
source venv/bin/activate
pip install -r requirements.txt
uvicorn server:app --reload --port 8000
"""When successful, you will see a message indicating Uvicorn is running on http://127.0.0.1:8000. Open the base URL to access API docs at http://127.0.0.1:8000/docs or the root at http://127.0.0.1:8000/"""
Additional notes
The server exposes an HTTP API endpoint for keyword searches. You can also access a browsable API docs page to explore available endpoints and test requests during development.
If you need to stop the server, interrupt the process in your terminal (Ctrl+C) and, if desired, restart it later with the same uvicorn command.
Available tools
search_keyword
Receives a file path and a keyword, performs a case-insensitive search in the file, and returns the matching lines with their content.
expose_api
Provides an HTTP endpoint for POST /search to accept search requests and return results.