MCP server for SearXNG aggregator β web search across multiple engines via Model Context Protocol
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
A Model Context Protocol (MCP) server that provides web search capabilities by integrating with a SearXNG instance.
Important: Enable JSON responses in your SearXNG
settings.yml, otherwise the MCP server cannot read search results:
.envNote: SSE transport uses the
/sseendpoint, not/mcp. HTTP transport uses/mcp.
.env file (optional).The server reads configuration from command-line arguments and environment variables. Command-line arguments override the corresponding defaults used at startup.
| Variable | Default | Description |
|---|---|---|
SEARXNG_URL | http://localhost:8080 | URL of the SearXNG instance. |
SEARXNG_PORT | 8080 | Public host port for the SearXNG container in the compose example. |
SEARXNG_VOL_CONFIG | searxng-config | Docker volume or host path mounted to /etc/searxng/ in the compose example. |
SEARXNG_VOL_DATA | searxng-data | Docker volume or host path mounted to /var/cache/searxng/ in the compose example. |
MCP_HOST | 127.0.0.1 | Host to bind for HTTP/SSE transports. Use 0.0.0.0 in Docker when publishing the port. |
MCP_PORT | 8000 | Port to bind for HTTP/SSE transports. |
MCP_TRANSPORT | stdio | Transport mode: stdio, http, or sse. |
MCP_ALLOWED_HOSTS | SDK defaults for localhost | Comma-separated allowed Host headers for DNS rebinding protection. |
MCP_ALLOWED_ORIGINS | SDK defaults for localhost | Comma-separated allowed Origin headers for DNS rebinding protection. |
MCP_DISABLE_DNS_REBINDING_PROTECTION | false | Set to true to disable the SDK DNS rebinding protection. |
Run the server using uv or standard python:
Build the image:
Run the container:
stdio: Standard input/output (default for some MCP clients).http: Stateless HTTP (streamable-http).sse: Server-Sent Events.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.
SearXNG aggregates results from various sources. This guide outlines the capabilities available through the web_search tool.
Categories help refine your search by content type. Use these in the categories parameter (comma-separated).
| Category | Description |
|---|---|
general | Default web search (Google, Brave, DuckDuckGo, etc.) |
images | Image search results |
videos | Video content from YouTube, Vimeo, etc. |
news | Recent news articles |
map | Geographical and map information |
it | IT-related searches (StackOverflow, GitHub, etc.) |
science | Scientific papers and articles (ArXiv, Google Scholar) |
files | Torrent and file searches |
social_media | Posts and profiles from social platforms |
SearXNG can query over 130 engines. Configured engines typically include:
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).Use the web_search_info tool to dynamically retrieve the list of enabled categories and engines from your instance.
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:
| Option | Command | Notes |
|---|---|---|
| Use IPv4 directly | http://127.0.0.1:<port>/ | Immediate, no restart needed |
| Restart WSL | wsl --shutdown | Kills all stale relays; WSL restarts on next use |
| Remap Docker port | Change host port in docker run -p or docker-compose.yml | Avoids the conflict entirely |
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:
127.0.0.1:<port>:<port> explicit binding in docker-compose.yml to force IPv4wslrelay port leakShowcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/searxng-mcp)<a href="https://allmcps.com/mcp/searxng-mcp"><img src="https://allmcps.com/api/badge/searxng-mcp?style=directory" alt="Searxng Mcp on AllMCPs" /></a>