Search Engine with RAG and MCP
A powerful search engine that combines LangChain, Model Context Protocol (MCP), Retrieval-Augmented Generation (RAG), and Ollama to create an agentic AI system capable of searching the web, retrieving information, and providing relevant answers.
Features
- Web search capabilities using the Exa API
- Web content retrieval using FireCrawl
- RAG (Retrieval-Augmented Generation) for more relevant information extraction
- MCP (Model Context Protocol) server for standardized tool invocation
- Support for both local LLMs via Ollama and cloud-based LLMs via OpenAI
- Flexible architecture supporting direct search, agent-based search, or server mode
- Comprehensive error handling and graceful fallbacks
- Python 3.13+ with type hints
- Asynchronous processing for efficient web operations
Architecture
This project integrates several key components:
- Search Module: Uses Exa API to search the web and FireCrawl to retrieve content
- RAG Module: Embeds documents, chunks them, and stores them in a FAISS vector store
- MCP Server: Provides a standardized protocol for tool invocation
- Agent: LangChain-based agent that uses the search and RAG capabilities
Project Structure
Getting Started
Prerequisites
- Python 3.13+
- Poetry (optional, for development)
- API keys for Exa and FireCrawl
- (Optional) Ollama installed locally
- (Optional) OpenAI API key
Installation
- Clone the repository
- Install dependencies
- Create a
.envfile (use docs/env_template.md as a reference)
Usage
The application has three main modes of operation:
1. Direct Search Mode (Default)
2. Agent Mode
3. MCP Server Mode
You can also specify custom host and port:
Using Ollama (Optional)
To use Ollama for local embeddings and LLM capabilities:
- Install Ollama: https://ollama.ai/
- Pull a model:
- Set the appropriate environment variables in your
.envfile:
Development
This project follows these best practices:
- Code formatting: Black and isort for consistent code style
- Type checking: mypy for static type checking
- Linting: flake8 for code quality
- Testing: pytest for unit and integration tests
- Environment Management: python-dotenv for managing environment variables
- Logging: Structured logging to both console and file
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgements
- LangChain for the agent framework
- Model Context Protocol for the standardized tool invocation
- Ollama for local LLM capabilities
- Exa for web search capabilities
- FireCrawl for web content retrieval
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
提供工具调用的标准化协议,使AI系统能够通过与LangChain、RAG和Ollama的集成来搜索网络、检索信息并提供相关答案。
Related MCP Servers
- -securityFlicense-qualityEnables seamless AI integration via Ollama's Deepseek model, providing protocol compliance and automatic configuration for clean AI-driven interactions.Last updated -1Python
- AsecurityFlicenseAqualityA Model Context Protocol server that enables AI assistants to perform real-time web searches, retrieving up-to-date information from the internet via a Crawler API.Last updated -175215JavaScript
- -securityFlicense-qualityA simple Model Context Protocol server that enables searching and retrieving relevant documentation snippets from Langchain, Llama Index, and OpenAI official documentation.Last updated -Python
- -securityFlicense-qualityAn integration that enables AI assistants to interact with network data through a standardized protocol, providing AI-ready tools and interfaces for network automation and management.Last updated -15Python