使用说明
标记语言
🚀 MCP关键字搜索工具
🧩 概述
此基于FastAPI的MCP服务器允许用户上传 .txt 或 .pdf 文件,并搜索其中的任何关键字。
作为 Ressel AI任务分配——任务2(MCP服务器开发).
⚙️ 特性
- 📁 上传
.txt或.pdf文件 - 🔍 搜索任何关键字
- 📊 获取JSON格式的关键字出现次数总数
- ⚡ 使用 快速API, python,以及 Uvicorn
🧰 技术栈
| 组件 | 描述 |
|---|---|
| 语言 | Python 3.10+ |
| 框架 | FastAPI |
| 服务器 | Uvicorn |
| IDE | VS代码 |
▶️ 如何在当地跑步
1.克隆存储库
git clone https://github.com/<your-username>/mcp-keyword-search.git
cd mcp-keyword-search
2. Install Dependencies
bash
pip install -r requirements.txt
3. Run the Server
bash
python src/mcp_keyword_search/server.py
📮 API Usage
🔹 Endpoint
http
POST /search
🔹 Form Data
Field Type Example
keyword string "AI"
file file sample.txt
🔹 Sample Response
json
{
"keyword": "AI",
"occurrences": 4
}
🖼️ Swagger UI Screenshot
✅ Successful run via FastAPI Swagger interface (Insert screenshot here)
💡 Learning Outcomes
✅ Built a modular FastAPI server
✅ Implemented keyword search logic for .txt and .pdf
✅ Learned file handling, routing, and JSON response formatting
✅ Practiced clean code and scalable backend design
🙌 Author
Sakshi Tiwari AI/ML Engineer | Ethical AI Enthusiast | Builder of Privacy-First Solutions
