全视线搜索MCP
基于FastAPI的搜索代理服务器,与Whoogle搜索引擎集成,用于AI聊天应用程序,专为Open WebUI集成而设计。
概述
该项目围绕Whoogle搜索引擎提供了一个REST API包装器,旨在用作Open WebUI和其他需要搜索功能的人工智能聊天应用程序的代理服务。它将搜索结果规范化为一致的格式,并提供一个干净的API界面,与Open WebUI的搜索功能无缝集成。
打开WebUI集成
此服务充当 搜索代理 对于Open WebUI,使用户能够:
- 通过Whoogle(注重隐私的谷歌搜索替代方案)进行网络搜索
- 在他们的人工智能对话中获取实时搜索结果
- 在访问网络信息时保持隐私
- 使用搜索功能,而不会将个人数据暴露给谷歌
特性
- 🔍 打开WebUI集成:作为搜索工具与Open WebUI无缝集成
- 🚀 FastAPI后端:高性能异步web框架
- 📊 标准化结果:与AI聊天界面兼容的一致JSON响应格式
- 🔒 注重隐私:使用Whoogle(以隐私为重点的谷歌搜索替代品)
- 🐳 Docker支持:使用Docker和Docker Compose轻松部署
- ⚙️ 可配置的:基于环境的配置,实现灵活部署
- 🌐 实时搜索:在AI对话中提供实时网络搜索结果
API终点
获取/搜索
通过Whoogle执行搜索查询并返回标准化结果。
参数:
q或query:搜索查询字符串(必填)
响应格式:```json
{
"query": "search term",
"number_of_results": 10,
"results": [
{
"url": "https://example.com",
"title": "Example Title",
"content": "Example description",
"img_src": "https://example.com/image.jpg",
"engine": "whoogle",
"category": "general"
}
],
"answers": [],
"infoboxes": []
}
## 安装
### 使用预构建的Docker镜像(推荐)
每次发布时,最新的Docker镜像都会自动构建并推送到Docker Hub:```bash
docker run -p 8080:8080 -e WHOOGLE_BASE_URL=http://your-whoogle-instance:5000 your-username/whoogle-search-mcp:latest
从源头构建
- 克隆存储库:```bash
git clone https://github.com/your-username/whoogle-search-mcp.git
cd whoogle-search-mcp
2. 使用Docker构建和运行:```bash
docker build -t whoogle-search-mcp .
docker run -p 8080:8080 -e WHOOGLE_BASE_URL=http://your-whoogle-instance:5000 whoogle-search-mcp
地方发展
- 安装依赖项:```bash
pip install -r requirements.txt
2. 设置环境变量:```bash
export WHOOGLE_BASE_URL=http://localhost:5000
- 运行应用程序:```bash
uvicorn app:app --host 0.0.0.0 --port 8080
## 打开WebUI配置
### 在Open WebUI中设置搜索代理
1. **部署此服务** 使用Docker或本地
1. **配置打开WebUI** 要将此服务用作搜索代理:
- 转到打开WebUI设置
- 导航到“工具”或“搜索”部分
- 添加具有以下配置的新搜索工具:
- **名字**:Whoogle搜索
- **统一资源定位符**: `http://your-server:8080/search`
- **方法**:获取
- **参数**: `q` (查询参数)
### 环境变量
- `WHOOGLE_BASE_URL`:Whoogle实例的URL(默认值: `http://whoogle:5000`)
### 配置文件
复制 `env.sample` 到 `.env` 并根据需要修改值:```bash
cp env.sample .env
这 env.sample 文件包含:```bash
Whoogle Search MCP Server Configuration
Whoogle server url
Default: http://whoogle:5000
WHOOGLE_BASE_URL=http://whoogle:5000
Examples:
WHOOGLE_BASE_URL=http://localhost:5000
WHOOGLE_BASE_URL=https://your-whoogle-instance.com
### 配置示例```bash
# For local development
WHOOGLE_BASE_URL=http://localhost:5000
# For production
WHOOGLE_BASE_URL=https://your-whoogle-instance.com
Docker编写示例(使用Open WebUI)```yaml
version: '3.8'
services:
whoogle-search-mcp:
image: hdh0926/whoogle-search-mcp:latest
ports:
- "8080:8080"
environment:
- WHOOGLE_BASE_URL=http://whoogle:5000
depends_on:
- whoogle
whoogle:
image: benbusby/whoogle-search:latest
ports:
- "5000:5000"
open-webui:
image: ghcr.io/open-webui/open-webui:main
ports:
- "3000:8080"
environment:
- OPENAI_API_BASE_URL=http://your-llm-server:8000/v1
## 用法示例
### 基本搜索```bash
curl "http://localhost:8080/search?q=python programming"
带查询参数```bash
curl "http://localhost:8080/search?query=machine learning"
## 发展
### 项目结构```
whoogle-search-mcp/
├── app.py # Main FastAPI application
├── requirements.txt # Python dependencies
├── Dockerfile # Docker configuration
├── env.sample # Environment variables template
├── README.md # English documentation
├── README.ko.md # Korean documentation
├── README.ja.md # Japanese documentation
├── README.zh.md # Chinese documentation
├── LICENSE # MIT License
└── .github/
└── workflows/
└── docker-build.yml # GitHub Actions for Docker Hub
依赖项
- 快速API:用于构建API的Web框架
- httpx:异步HTTP客户端,用于向Whoogle发出请求
- 优维康:用于运行应用程序的ASGI服务器
CI/CD管道
- GitHub操作:自动构建Docker镜像并推送到Docker Hub
- 多平台支持:为linux/amd64和linux/arm64架构构建
- 自动标记:为分支、版本和最新版本创建标记
此项目支持多种语言:
- 🇺🇸 英语 -原始文件
- 🇰🇷 韩语 -韩国文件
- 🇯🇵 日本语 -日本文件
- 🇨🇳 中文 -中文文档
许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。
贡献
- 分叉存储库
- 创建要素分支
- 进行更改
- 提交拉取请求
需求
- Python 3.11+
- 访问正在运行的Whoogle实例
- Docker(可选,用于容器化部署)
