search-engine-with-rag-and-mcp
If you are the rightful owner of search-engine-with-rag-and-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcpreview.com.
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.
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
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
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
git clone https://github.com/yourusername/search-engine-with-rag-and-mcp.git
cd search-engine-with-rag-and-mcp
- Install dependencies
# Using pip
pip install -r requirements.txt
# Or using poetry
poetry install
- Create a
.env
file (use docs/env_template.md as a reference)
Usage
The application has three main modes of operation:
1. Direct Search Mode (Default)
# Using pip
python -m src.core.main "your search query"
# Or using poetry
poetry run python -m src.core.main "your search query"
2. Agent Mode
python -m src.core.main --agent "your search query"
3. MCP Server Mode
python -m src.core.main --server
You can also specify custom host and port:
python -m src.core.main --server --host 0.0.0.0 --port 8080
Using Ollama (Optional)
To use Ollama for local embeddings and LLM capabilities:
- Install Ollama: https://ollama.ai/
- Pull a model:
ollama pull mistral:latest
- Set the appropriate environment variables in your
.env
file:
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=mistral:latest
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 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
Related MCP Servers
View all ai_chatbot servers āSequential Thinking
by modelcontextprotocol
An MCP server implementation that provides a tool for dynamic and reflective problem-solving through a structured thinking process.
github-mcp-server
by github
The GitHub MCP Server is a Model Context Protocol server that integrates with GitHub APIs for automation and interaction.
claude-task-master
by eyaltoledano
Task Master is a task management system for AI-driven development with Claude, designed to work seamlessly with Cursor AI.
Model Context Protocol
by pollinations
A Model Context Protocol (MCP) server for the Pollinations APIs that enables AI assistants like Claude to generate images, text, and audio directly.
gateway
by centralmind
CentralMind Gateway is a tool designed to expose databases to AI agents via MCP or OpenAPI protocols, providing secure, LLM-optimized APIs.
HowToCook-mcp
by worryzyy
HowToCook-MCP Server is a Model Context Protocol server that transforms AI assistants into personal chefs, helping users plan meals and recommend recipes.
osp_marketing_tools
by open-strategy-partners
A comprehensive suite of tools for technical marketing content creation, optimization, and product positioning based on Open Strategy Partners' proven methodologies.