AI文档搜索工具

一个基于Model Context Protocol (MCP)的Node.js服务器,用于搜索和获取流行AI/ML库的文档片段。

  • by anasyakubu
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 anasyakubu/mcp-client-typescript

使用说明

# MCP Docs Server

This project implements a Model Context Protocol (MCP) server in Node.js that provides a tool to search and fetch documentation snippets for popular AI/ML libraries.

---

## 🚀 Features

✅ MCP-compliant server (using `@modelcontextprotocol/sdk`)  
✅ Tool: **get_docs**  
✅ Searches Google for latest docs using Serper API  
✅ Supports:
- LangChain
- LlamaIndex
- OpenAI

✅ Returns plain text from documentation pages  
✅ Handles timeouts and search failures gracefully  

---

## 📁 Project Structure

mcp文档服务器/ ├── server.js#MCP服务器实现 ├── .env#环境变量 └── README.md#此文件


---

## ⚙️ Setup

1. **Clone the repository**  
   ```bash
   git clone <repo-url>
   cd mcp-docs-server
  1. 安装依赖项

    npm install
    
  2. 创建一个 .env 文件

    SERPER_API_KEY=your_serper_api_key
    
  3. 运行MCP服务器

    node server.js
    

🛠️ 用法

服务器公开了一个工具:

get_docs

  • 描述: 在最新文档中搜索给定的查询和库。

  • 参数:

    • query (string):例如。 "Chroma DB"
    • library (string):其中之一 "langchain", "llama-index", "openai"
  • 退货: 从搜索结果中提取的纯文本内容。

兼容MCP客户端的示例用法:

node client.js path/to/server.js

📦 依赖项

  • @modelcontextprotocol/sdk
  • dotenv
  • httpx
  • jsdom

📝 备注

  • MCP服务器使用Serper API进行Google搜索。
  • 要获取Serper API密钥,请访问 瑟珀·德夫.

🤝 贡献

请随时打开问题或提交pull请求!


📄 许可证

MIT许可证。


🔗 链接