# 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** git clone cd mcp-docs-server
2. **安装依赖项**
npm install
1. **创建一个 `.env` 文件**
SERPER_API_KEY=your_serper_api_key
1. **运行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密钥,请访问 [瑟珀·德夫](https://serper.dev/).
______________________________________________________________________
## 🤝 贡献
请随时打开问题或提交pull请求!
______________________________________________________________________
## 📄 许可证
MIT许可证。
______________________________________________________________________
## 🔗 链接
- [模型上下文协议(MCP)](https://modelcontext.org/)
- [Serper API公司](https://serper.dev/)

