Skip to main content
Glama
maniranjan2023

MCP Open Library & File Search Server

README.md
# πŸ“š 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

B3.2/5.0

Scored across 2 tools

Disambiguation5/5

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.

Naming Consistency4/5

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.

Tool Count2/5

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.

Completeness2/5

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.

Maintenance

ActivityInactive
ResponsivenessNo issues