Click on "Install 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
π 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.)