
Searxng Mcp
io.github.aicrafted由 GitHub 账号 aicrafted 发布v1.0.0更新于 Oct 24, 2026
MCP server for SearXNG aggregator — web search across multiple engines via Model Context Protocol
概览
一个本地 MCP 服务器,将助手连接到 SearXNG 实例,从而跨多个引擎执行聚合网页搜索。
- 可以做什么
- 跨多个引擎执行聚合网页搜索,可按类别、引擎、语言、页码和时间范围筛选,并可控制安全搜索,类别包括通用、图片、视频、新闻、地图、IT、科学、文件和社交媒体。获取所连接 SearXNG 实例已启用的类别和引擎列表。通过 stdio、无状态 HTTP 或 SSE 提供结果,主机、端口和 DNS 重绑定白名单均可配置。
- 适用场景
- 当你已经运行或能够运行 SearXNG 实例,并希望助手通过自己的聚合器而非托管搜索 API 私密地搜索网页时使用,包括新闻、IT、科学或图片查询。
- 运行要求
- 一个可从服务器访问且已启用 JSON 输出的 SearXNG 实例。需要环境变量 SEARXNG_URL(默认 Python 3.10+ 和 pip 依赖;也提供容器镜像。可选设置包括 MCP_HOST、MCP_PORT、MCP_TRANSPORT、MCP_ALLOWED_HOSTS、MCP_ALLOWED_ORIGINS 和 MCP_DISABLE_DNS_REBINDING_PROTECTION。
安装
在 SourceWeft 中
- 打开 控制台中的 Searxng Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
SearXNG MCP Server
A Model Context Protocol (MCP) server that provides web search capabilities by integrating with a SearXNG instance.
Features
- Web Search: Perform powerful aggregated searches across multiple engines.
- Discovery: Programmatically retrieve available categories and engines.
- Stateless HTTP: Compatible with any standard JSON-RPC client.
- Flexible Configuration: Supports environment variables and command-line arguments.
Example of compose.yml to run SearXNG with MCP server
Important: Enable JSON responses in your SearXNG
settings.yml, otherwise the MCP server cannot read search results:
Example .env
MCP client config
HTTP transport (recommended)
SSE transport
Note: SSE transport uses the
/sseendpoint, not/mcp. HTTP transport uses/mcp.
Prerequisites for run from sources
- Python 3.10+
- A running SearXNG instance.
Installation
- Clone the repository and navigate to the directory.
- Install dependencies:
- Set up your
.envfile (optional).
Configuration
The server reads configuration from command-line arguments and environment variables. Command-line arguments override the corresponding defaults used at startup.
Usage
Run the server using uv or standard python:
Run with Docker
-
Build the image:
-
Run the container:
Transport Options
stdio: Standard input/output (default for some MCP clients).http: Stateless HTTP (streamable-http).sse: Server-Sent Events.
DNS Rebinding Protection
Recent versions of the MCP Python SDK validate Host and Origin headers for HTTP/SSE transports to protect local servers from DNS rebinding attacks. If you expose the server through Docker, a reverse proxy, or a custom domain and receive 421 Invalid Host Header, configure the allowlist explicitly:
For trusted local development or when this validation is handled by another infrastructure layer, you can disable the SDK protection:
Use disabling sparingly; setting MCP_ALLOWED_HOSTS and MCP_ALLOWED_ORIGINS is the recommended option.
Search Abilities Guide
SearXNG aggregates results from various sources. This guide outlines the capabilities available through the web_search tool.
Search Categories
Categories help refine your search by content type. Use these in the categories parameter (comma-separated).
Supported Engines
SearXNG can query over 130 engines. Configured engines typically include:
- Web: Google, Brave, DuckDuckGo, Qwant, Startpage
- Knowledge: Wikipedia, Wikidata
- Development: GitHub, StackOverflow, PyPI
- Social: Reddit, Twitter/X
Advanced Search Parameters
categories: Filter by specific types (e.g.,news,it).engines: Force specific engines (e.g.,google,wikipedia).language: Specify search language (e.g.,en,es,fr).pageno: Navigate through multiple pages of results.time_range: Filter by date (day,month,year).safesearch: Control content filtering (0=None, 1=Moderate, 2=Strict).
Programmatic Discovery
Use the web_search_info tool to dynamically retrieve the list of enabled categories and engines from your instance.
Windows Troubleshooting
localhost not reachable while Docker container is running
Symptom: http://localhost:<port>/ returns connection refused or hits the wrong service,
but curl from inside the container works fine.
Root cause: WSL2 port relay ghost
WSL2 automatically forwards ports from the Linux VM to the Windows host using wslrelay.exe.
When a process inside WSL listens on a port, WSL creates a relay bound to [::1]:<port>
(IPv6 loopback) on the Windows side.
When that WSL process stops, wslrelay.exe often does not release the port. The relay
entry stays alive as a zombie listener on [::1]:<port>.
Later, when Docker maps a container to the same host port, it binds correctly to
0.0.0.0:<port> — but [::1]:<port> is already taken by the stale relay.
On Windows, localhost resolves to ::1 (IPv6) first. So browser and curl requests to
localhost:<port> hit the dead wslrelay.exe entry instead of the Docker container,
resulting in a connection error or unexpected response.
Connecting via the explicit IPv4 address 127.0.0.1:<port> bypasses the relay and reaches
Docker correctly.
How to diagnose:
If you see two entries for the same port — one owned by com.docker.backend and another
by wslrelay — this is the problem.
Workarounds:
Permanent fix:
After wsl --shutdown, restart the Docker container. The relay will no longer exist and
localhost:<port> will work normally until the same port is reused inside WSL again.
Prevention:
If you regularly run services on the same port both in WSL and in Docker, prefer one of:
- Always use Docker for that service, never WSL directly
- Use different ports for WSL dev and Docker prod instances
- Add
127.0.0.1:<port>:<port>explicit binding indocker-compose.ymlto force IPv4
Related
- WSL2 networking documentation
- WSL GitHub issue tracker: search
wslrelay port leak
来源:README.md,提交 8ecbbd3
工具
0版本历史
1- v1.0.0最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分