Model Context Protocol Server

Integrations

  • Integrates with python-dotenv for managing environment variables, facilitating the secure storage and access of API keys and configuration settings.

  • Provides repository access and version control integration through GitHub, allowing users to clone and contribute to the project.

  • Integrates with LangChain to provide agent-based search capabilities and facilitate the creation of agentic AI systems that can search the web and retrieve information.

带有 RAG 和 MCP 的搜索引擎

一个强大的搜索引擎,它结合了 LangChain、模型上下文协议 (MCP)、检索增强生成 (RAG) 和 Ollama,创建了一个能够搜索网络、检索信息并提供相关答案的代理 AI 系统。

特征

  • 使用 Exa API 的 Web 搜索功能
  • 使用 FireCrawl 检索 Web 内容
  • RAG(检索增强生成)用于提取更多相关信息
  • 用于标准化工具调用的 MCP(模型上下文协议)服务器
  • 通过 Ollama 支持本地 LLM,并通过 OpenAI 支持基于云的 LLM
  • 灵活的架构支持直接搜索、基于代理的搜索或服务器模式
  • 全面的错误处理和优雅的回退
  • 带有类型提示的 Python 3.13+
  • 异步处理以实现高效的 Web 操作

建筑学

该项目集成了几个关键组件:

  1. 搜索模块:使用 Exa API 搜索网页并使用 FireCrawl 检索内容
  2. RAG 模块:嵌入文档、对文档进行分块,并将其存储在 FAISS 矢量存储中
  3. MCP 服务器:提供工具调用的标准化协议
  4. 代理:基于 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 密钥

安装

  1. 克隆存储库
git clone https://github.com/yourusername/search-engine-with-rag-and-mcp.git cd search-engine-with-rag-and-mcp
  1. 安装依赖项
# Using pip pip install -r requirements.txt # Or using poetry poetry install
  1. 创建一个.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 功能:

  1. 安装 Ollama: https://ollama.ai/
  2. 拉取模型:
ollama pull mistral:latest
  1. .env文件中设置适当的环境变量:
OLLAMA_BASE_URL=http://localhost:11434 OLLAMA_MODEL=mistral:latest

发展

该项目遵循以下最佳实践:

  • 代码格式:Black 和 isort 以实现一致的代码风格
  • 类型检查:mypy 用于静态类型检查
  • Linting :flake8 确保代码质量
  • 测试:pytest 用于单元和集成测试
  • 环境管理:python-dotenv 用于管理环境变量
  • 日志记录:结构化日志记录到控制台和文件

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。

致谢

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

提供工具调用的标准化协议,使AI系统能够通过与LangChain、RAG和Ollama的集成来搜索网络、检索信息并提供相关答案。

  1. Features
    1. Architecture
      1. Project Structure
        1. Getting Started
          1. Prerequisites
          2. Installation
          3. Usage
          4. Using Ollama (Optional)
        2. Development
          1. License
            1. Acknowledgements

              Related MCP Servers

              • A
                security
                A
                license
                A
                quality
                This server enables AI systems to integrate with Tavily's search and data extraction tools, providing real-time web information access and domain-specific searches.
                Last updated -
                2
                4,691
                164
                JavaScript
                MIT License
                • Apple
                • Linux
              • A
                security
                A
                license
                A
                quality
                A production-ready Model Context Protocol server that enables language models to leverage AI-powered web scraping capabilities, offering tools for transforming webpages to markdown, extracting structured data, and executing AI-powered web searches.
                Last updated -
                3
                16
                Python
                MIT License
                • Apple
              • -
                security
                F
                license
                -
                quality
                Enables AI assistants to interact with Metabase, providing access to dashboards, questions, databases, and tools for executing queries and viewing data through natural language.
                Last updated -
                JavaScript
                • Apple
              • -
                security
                A
                license
                -
                quality
                This server implementation allows AI assistants to interact with Asana's API, enabling users to manage tasks, projects, workspaces, and comments through natural language requests.
                Last updated -
                65
                TypeScript
                MIT License

              View all related MCP servers

              ID: iqudnbc9bd