
这是与SearXNG集成的MCP SSE模型上下文协议(MCP)服务器实现,为AI代理提供强大且尊重隐私的搜索能力。
概览
这是与SearXNG集成的MCP SSE模型上下文协议(MCP)服务器实现,为AI代理提供强大且尊重隐私的搜索能力。 该项目演示了如何构建一个MCP服务器,使AI代理能够利用SearXNG实例进行网页搜索。它作为一个实用模板,用于创建自己的MCP服务器,并以SearXNG为后端。 该实现遵循了Anthropic制定的最佳MCP服务器构建实践,允许与任何兼容MCP的客户端无缝集成。 - Python 3.9+ - 访问正在运行的 SearXNG 实例(本地或远程)- Docker(可选,用于容器化部署)- uv(可选,用于快速的 Python 依赖管理)- Smithery(可选,用于 MCP 服务器管理) 你必须运行并可访问 SearXNG 服务器。推荐的方法是通过 Docker: - 该程序将在端口32768运行SearXNG,并在/root/searxng中保持配置。
概述(AI 翻译)
这是与SearXNG集成的MCP SSE模型上下文协议(MCP)服务器实现,为AI代理提供强大且尊重隐私的搜索能力。
概述
该项目演示了如何构建一个MCP服务器,使AI代理能够利用SearXNG实例进行网页搜索。它作为一个实用模板,用于创建自己的MCP服务器,并以SearXNG为后端。
该实现遵循了Anthropic制定的最佳MCP服务器构建实践,允许与任何兼容MCP的客户端无缝集成。
先修条件
- Python 3.9+
- 访问正在运行的 SearXNG 实例(本地或远程)
- Docker(可选,用于容器化部署)
- uv(可选,用于快速的Python依赖管理)
- Smithery(可选,用于MCP服务器管理)
SearXNG 服务器(必备)
你必须运行并可访问 SearXNG 服务器。推荐的方法是通过 Docker:
- 这将在端口 32768 上运行 SearXNG,并在
/root/searxng中保持配置。 - MCP服务器默认期望SearXNG在
http://172.17.0.1:32768可用(参见.env)。
安装
使用紫外线
如果没有 UV,就安装它:
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
SearXNG MCP Server
An MCP sse implementation of the Model Context Protocol (MCP) server integrated with SearXNG for providing AI agents with powerful, privacy-respecting search capabilities.
Overview
This project demonstrates how to build an MCP server that enables AI agents to perform web searches using a SearXNG instance. It serves as a practical template for creating your own MCP servers, using SearXNG as a backend.
The implementation follows the best practices laid out by Anthropic for building MCP servers, allowing seamless integration with any MCP-compatible client.
Prerequisites
- Python 3.9+
- Access to a running SearXNG instance (local or remote)
- Docker (optional, for containerized deployment)
- uv (optional, for fast Python dependency management)
- Smithery (optional, for MCP server management)
SearXNG Server (Required)
You must have a SearXNG server running and accessible. The recommended way is via Docker:
docker run -d --name=searxng -p 32768:8080 -v "/root/searxng:/etc/searxng" \
-e "BASE_URL=http://0.0.0.0:32768/" \
-e "INSTANCE_NAME=home" \
--restart always searxng/searxng
- This will run SearXNG on port 32768 and persist configuration in
/root/searxng. - The MCP server expects SearXNG to be available at
http://172.17.0.1:32768by default (see.env).
Installation
Using uv
Install uv if you don’t have it:
pip install uv
Clone this repository:
git clone https://github.com/The-AI-Workshops/searxng-mcp-server.git
cd searxng-mcp-server/dev/searXNG-mcp
Install dependencies:
uv pip install -r requirements.txt
Create a .env file based on the provided example:
nano .env
# Edit .env as needed
Configure your environment variables in the .env file (see Configuration section).
Using Docker (Recommended)
Build the Docker image:
docker build -t mcp/searxng-mcp .
Create a .env file and configure your environment variables.
Run the Docker image:
docker run -d --env-file ./.env -p 32769:32769 mcp/searxng-mcp
Using Smithery
Smithery is a command-line tool for managing AI agent tools and MCP servers.
Install Smithery if you don’t have it (see Smithery documentation for various installation methods, e.g., using pipx):
pipx install smithery
Install the SearXNG MCP server using Smithery:
smithery install @The-AI-Workshops/searxng-mcp-server
This will install the server and its dependencies into a dedicated environment managed by Smithery.
安装
docker run --rm -i -e TRANSPORT -e SEARXNG_BASE_URL -e HOST -e PORT mcp/searxng-mcp配置
{
"mcpServers": {
"searxng": {
"transport": "sse",
"url": "http://localhost:32769/sse"
}
}
}