This project is an MCP (Model Context Protocol) server that provides a simple REST API tool to search for a keyword inside a text file.
- Search for any keyword in a specified file.
- Returns matching lines as JSON.
- Built using Node.js and Express.
mcp-server/
βββ index.js # Main MCP server file
βββ package.json # Node dependencies
βββ sample.txt # Example file for testing
βββ README.md # Project documentation
- Clone this repository:
git clone https://github.com/Navateja-gupta/MCP.git cd mcp-server
2. Install dependencies:
```bash
npm install
- Start the MCP server:
node index.js ``
POST /search_in_file
Invoke-WebRequest -Uri "http://localhost:3000/search_in_file" `
-Method POST `
-ContentType "application/json" `
-Body '{"file_path": "C:/path/to/sample.txt", "keyword": "error"}'{"message":"β
Found 2 matches",
"matches":["An error occurred in the system.",
"Critical error found in logs."
]
}