Keyword Search MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Keyword Search MCP Serversearch for 'TODO' in my project's README.md file"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ā MCP Server ā Keyword Search Tool (Case-Insensitive)
This project is a simple MCP (Model Context Protocol) Server built using FastAPI. It includes a tool that allows users to search for a keyword inside a file (case-insensitive).
š Documentation
You can view the detailed documentation here:
Assignment Documentation
Related MCP server: MCP Keyword Search
š Project Structure
mcp-server/
āāā server.py
āāā tools/
ā āāā __init__.py
ā āāā search_tool.py
āāā requirements.txt
āāā README.mdāļø 1. Setup Instructions
ā Step 1: Clone or Create Project Folder
cd mcp-serverā Step 2: Create and Activate Virtual Environment (Optional but Recommended)
python -m venv venv
# Activate it:
# On Windows:
venv\Scripts\activate
# On Linux/Mac:
source venv/bin/activateā Step 3: Install Dependencies
pip install -r requirements.txtš 2. Run the MCP Server
uvicorn server:app --reload --port 8000If successful, you will see:
Uvicorn running on http://127.0.0.1:8000Visit in browser:
http://127.0.0.1:8000Or API docs (auto-generated):
http://127.0.0.1:8000/docsš 3. Search Keyword in a File (API Usage)
ā
Request Format (POST /search)
{
"file_path": "path/to/file.txt",
"keyword": "example"
}ā
Example using curl:
curl -X POST "http://127.0.0.1:8000/search" \
-H "Content-Type: application/json" \
-d '{"file_path": "sample.txt", "keyword": "hello"}'ā Example Response:
{
"results": [
"Line 2: Hello World",
"Line 5: hElLo again"
]
}š 4. Code Summary
server.py
Defines API endpoint /search.
ā 5. Features
ā FastAPI-powered MCP server ā Case-insensitive keyword search ā Shows line number + text where keyword exists ā Error handling for missing files
š 6. Future Improvements (Optional)
š¹ Search across directories
š¹ Regex support
š¹ Return JSON with
{line_number, content}formatš¹ File type filtering (.txt, .py, .md, etc.)
This server cannot be deployed
Maintenance
Related MCP Connectors
Securely search and manage workspace context files for AI agents and teams.
Ingest and search LogsLoom logs from coding agents.
The Needle MCP server enables semantic search on documents stored in files like PDFs, DOCX, and XLSX by connecting AI applications to external data sources. It provides capabilities to create and manage document collections, perform natural language searches on stored content, and retrieve relevant information without requiring exact keyword matches.
Related MCP Servers
- AlicenseBqualityFmaintenanceProvides programmatic search functionality for Obsidian vaults through a REST API interface, allowing external applications to search through notes and retrieve absolute paths to matching documents.230MIT
- FlicenseNot gradedqualityDmaintenanceEnables keyword searching within text files with configurable case sensitivity, returning matching lines with line numbers and occurrence counts.-
- FlicenseNot gradedqualityDmaintenanceEnables searching for keywords within files with case-sensitive/insensitive options, returning matching lines with line numbers for easy reference.-
- FlicenseNot gradedqualityDmaintenanceEnables searching for keywords in files with support for case-sensitive/insensitive matching, returning line numbers, full line content, and match counts for all occurrences.-