MCP Open Library & File Search Server
# π MCP Open Library & File Search Server
This project is an **MCP (Model Context Protocol)** server built with TypeScript and Node.js.
It provides two core tools:
1. `search_author` β search for books by author using the Open Library API.
2. `search_in_file` β search for a keyword inside any local text file.
---
## π Features
### π `search_author`
Fetches book data by a given author name from the Open Library API.
**Input**
```json
{
"author": "tolkien"
}
```
**Output**
A JSON response containing book search results.
---
### π `search_in_file`
Scans a file for a keyword and returns the matching lines and their numbers.
**Input**
```json
{
"filePath": "./sample.txt",
"keyword": "example"
}
```
**Output**
```text
Found 2 match(es) for "example" in "./sample.txt":
Line 3: This is an example line
Line 8: Another example text
```
---
## ποΈ Project Structure
```
MCP/
βββ build/ # Compiled JS files
βββ src/ # Source TypeScript files
β βββ index.ts
βββ sample.txt # Example file for keyword search
βββ package.json
βββ tsconfig.json
βββ .gitignore
βββ README.md
```
---
## βοΈ Setup & Run
1. **Install dependencies**
```bash
npm install
```
2. **Build**
```bash
npm run build
```
3. **Run**
```bash
npm start
```
Or directly (without compiling):
```bash
npm run dev
```
---
## π§© Example: Using in MCP Inspector
For `search_in_file`:
```json
{
"filePath": "./sample.txt",
"keyword": "OpenAI"
}
```
For `search_author`:
```json
{
"author": "tolkien"
}
```
---
## π§ Technologies
* TypeScript
* Node.js
* [@modelcontextprotocol/sdk](https://www.npmjs.com/package/@modelcontextprotocol/sdk)
* [Zod](https://zod.dev/)
---
## π§Ύ License
MIT License Β© 2025
---
## π¨βπ» Author
**Your Name**
π§ [maniranjan1512@gmail.com](mailto:maniranjan1512@gmail.com)
π [github.com/maniranjan2023](https://github.com/maniranjan2023)
TDQS
Scored across 2 tools
The two tools have entirely different purposesβone searches Open Library by author name, the other searches within a local file. No overlap or ambiguity is possible.
Both tools use the 'search_' prefix followed by a specifier (author vs. in_file), showing a consistent verb-first pattern. Minor variation in specifier type (noun vs. prepositional phrase) is acceptable.
With only two tools covering two distinct domains (Open Library and file search), the server feels thin and unfocused. Each domain would benefit from additional tools to be useful, making the count too low for the stated scope.
The server provides only one operation per domain: author search and in-file keyword search. Missing are common complementary tools like book search by title/ISBN, file listing, or multiple search modalities. The tool surface is severely incomplete for both purposes.