Model Context Protocol Server
带有 RAG 和 MCP 的搜索引擎
一个强大的搜索引擎,它结合了 LangChain、模型上下文协议 (MCP)、检索增强生成 (RAG) 和 Ollama,创建了一个能够搜索网络、检索信息并提供相关答案的代理 AI 系统。
特征
使用 Exa API 的 Web 搜索功能
使用 FireCrawl 检索 Web 内容
RAG(检索增强生成)用于提取更多相关信息
用于标准化工具调用的 MCP(模型上下文协议)服务器
通过 Ollama 支持本地 LLM,并通过 OpenAI 支持基于云的 LLM
灵活的架构支持直接搜索、基于代理的搜索或服务器模式
全面的错误处理和优雅的回退
带有类型提示的 Python 3.13+
异步处理以实现高效的 Web 操作
Related MCP server: Xiaozhi MCP Aggregate
建筑学
该项目集成了几个关键组件:
搜索模块:使用 Exa API 搜索网页并使用 FireCrawl 检索内容
RAG 模块:嵌入文档、对文档进行分块,并将其存储在 FAISS 矢量存储中
MCP 服务器:提供工具调用的标准化协议
代理:基于 LangChain 的代理,使用搜索和 RAG 功能
项目结构
search-engine-with-rag-and-mcp/
├── LICENSE # MIT License
├── README.md # Project documentation
├── data/ # Data directories
├── docs/ # Documentation
│ └── env_template.md # Environment variables documentation
├── logs/ # Log files directory (auto-created)
├── src/ # Main package (source code)
│ ├── __init__.py
│ ├── core/ # Core functionality
│ │ ├── __init__.py
│ │ ├── main.py # Main entry point
│ │ ├── search.py # Web search module
│ │ ├── rag.py # RAG implementation
│ │ ├── agent.py # LangChain agent
│ │ └── mcp_server.py # MCP server implementation
│ └── utils/ # Utility modules
│ ├── __init__.py
│ ├── env.py # Environment variable loading
│ └── logger.py # Logging configuration
├── pyproject.toml # Poetry configuration
├── requirements.txt # Project dependencies
└── tests/ # Test directory入门
先决条件
Python 3.13+
诗歌(可选,用于发展)
Exa 和 FireCrawl 的 API 密钥
(可选)本地安装 Ollama
(可选)OpenAI API 密钥
安装
克隆存储库
git clone https://github.com/yourusername/search-engine-with-rag-and-mcp.git
cd search-engine-with-rag-and-mcp安装依赖项
# Using pip
pip install -r requirements.txt
# Or using poetry
poetry install创建一个
.env文件(使用 docs/env_template.md 作为参考)
用法
该应用程序有三种主要操作模式:
1. 直接搜索模式(默认)
# Using pip
python -m src.core.main "your search query"
# Or using poetry
poetry run python -m src.core.main "your search query"2.代理模式
python -m src.core.main --agent "your search query"3. MCP 服务器模式
python -m src.core.main --server您还可以指定自定义主机和端口:
python -m src.core.main --server --host 0.0.0.0 --port 8080使用 Ollama(可选)
要使用 Ollama 进行本地嵌入和 LLM 功能:
安装 Ollama: https://ollama.ai/
拉取模型:
ollama pull mistral:latest在
.env文件中设置适当的环境变量:
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=mistral:latest发展
该项目遵循以下最佳实践:
代码格式:Black 和 isort 以实现一致的代码风格
类型检查:mypy 用于静态类型检查
Linting :flake8 确保代码质量
测试:pytest 用于单元和集成测试
环境管理:python-dotenv 用于管理环境变量
日志记录:结构化日志记录到控制台和文件
执照
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。
致谢
This server cannot be deployed
Maintenance
Related MCP Connectors
AI Agent Utility Layer for agent safety, web monitoring, crypto research and tool discovery.
Pay-per-call tools for AI agents, paid in USDC on Base or Solana. Web search, page and PDF reading, crypto news, Hyperliquid perps, market pulse, Chainlink price history, token checks, SEC filings, weather and more. Free calls every day, and a failed call costs nothing. Works with Tollkit Wallet.
Web scraping, Google SERP, Markdown and ChatGPT/Gemini answers as typed tools for AI agents.
70+ pay-per-call tools for AI agents: web search, email verify, KYC, stocks, crypto, news, data
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA protocol interface that extends AI capabilities by enabling models to interact with external systems for calculations, email operations, knowledge search, and more.462-
- FlicenseNot gradedqualityDmaintenanceA protocol implementation that extends AI capabilities by enabling language models to interact with external systems through remote control, notes, email operations, and knowledge search.-
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to perform web searches, extract webpage content, and conduct end-to-end search-and-extract operations using multiple search providers and content extraction methods.-
- AlicenseAqualityCmaintenanceEnables AI agents to fetch, crawl, extract, and search web content through a unified set of tools, with automatic routing to specialized backends.4MIT