搜索服务协议服务器

SearxNG MCP服务器是一个通过隐私保护的元搜索引擎SearxNG提供搜索功能的模型上下文协议服务器。

  • by IceWreck
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 IceWreck/SearxNG-MCP-Server

使用说明

SearxNG MCP服务器

一种模型上下文协议(MCP)服务器,通过以下方式提供搜索功能 SearxNG,尊重隐私的元搜索引擎。

PyPi:https://pypi.org/project/searxng-mcp-server/#description

用法

使用uvx

您也可以直接pip安装,但我们建议使用 uv.

# With command line argument (stdio transport)
uvx searxng-mcp-server --searxng-url https://searx.be

# With environment variable (stdio transport)
SEARXNG_URL=https://searx.be uvx searxng-mcp-server

# With HTTP transport on port 8080
uvx searxng-mcp-server --searxng-url https://searx.be --port 8080

# With HTTP transport using environment variable
SEARXNG_URL=https://searx.be MCP_PORT=8080 uvx searxng-mcp-server

套餐链接: https://pypi.org/project/searxng-mcp-server/

使用Docker/Podman

# With command line argument (stdio transport)
podman run --rm -i docker.io/icewreck/searxng-mcp-server:latest --searxng-url https://searx.be

# With environment variable (stdio transport)
podman run --rm -i -e SEARXNG_URL=https://searx.be docker.io/icewreck/searxng-mcp-server:latest

# With HTTP transport on port 8080
podman run --rm -i -e SEARXNG_URL=https://searx.be -p 8080:8080 docker.io/icewreck/searxng-mcp-server:latest --port 8080

作为图书馆使用

您还可以在Python项目中直接使用SearxNG客户端。客户端完全异步,需要 async/await 语法。

有关详细示例,请参阅 examples/client_example.py 存储库中的文件。

SearxNGClient可以很容易地集成到自定义AI代理中作为搜索工具。所有搜索方法都是异步的,并返回结构化响应对象。

可用工具

  • search_web:使用语言和时间过滤的一般网络搜索
  • search_images:跨多个搜索引擎的图像搜索
  • search_videos:从各种平台搜索视频
  • search_news:带时间范围过滤的新闻搜索
  • fetch_url:从URL获取内容并将其转换为markdown

配置

服务器需要SearxNG实例URL。您可以通过以下方式提供:

  • 环境变量: SEARXNG_URL=https://your-searxng-instance.com
  • 命令行参数: --searxng-url https://your-searxng-instance.com

默认情况下,服务器使用stdio传输。要启用HTTP传输,请设置端口:

  • 环境变量: MCP_PORT=8080
  • 命令行参数: --port 8080

当提供端口时,服务器会监听 http://0.0.0.0:<port> 使用可流式传输的http。

可选: SEARXNG_TIMEOUT (默认值:30), SEARXNG_USER_AGENT, LOG_LEVEL