SuperAPIAI Directory

searxng-mcp-server

github.com · AI images

Self-hosted SearXNG metasearch: web, image, news, video and music search plus SSRF-guarded page fetch with prompt-injection wrapping.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

Purpose

searxng-mcp-server is an MCP (Model Context Protocol) server used to connect a self-hosted SearXNG metasearch engine to MCP clients (such as Claude Desktop, Cursor, and most mcpServers-style clients). Compared with solutions that rely on third-party search APIs, it does not require registering an account or an API key, has no rate limits, does not submit every query to third-party tracking, and has zero operating cost.

Main capabilities

The service provides nine tools:

  • search: web search. Parameters query (string, required unless queries is given, up to 500 characters); queries (array of strings, 2–5) for batch mode, returning a set of results for each query in input order. Optional parameters include categories (array of strings), engines (array of strings), language, time_range (day | week | month | year), pageno, safesearch (0/1/2), max_results (1–50, default 10, counted per query in batch mode), min_score (number ≥ 0, discarding results below that score), detail (full default | compact markdown rendering).
  • image_search / news_search / video_search / music_search / paper_search: image, news, video, music, and paper search. The parameters are query (required) plus the shared optional parameters engines, language, pageno, safesearch, max_results, detail, and all five support time_range freshness filtering.
  • fetch_content: web page scraping. Parameters url (string, required, absolute http/https URL, up to 2048 characters); max_chars (1000–200000, defaults to MAX_CHARS, i.e. 25000); offset (integer ≥ 0) is used to start from a window starting point in the extracted content, and can continue from the returned nextOffset ; when outline is true, add headings ({text, offset, level}, corresponding to # lines in markdown and [Page N] markers in PDFs) and their offsets in the scanned content; section returns only one heading region, using case-insensitive exact heading matching, extending to the next heading of the same or higher level, with offset / max_chars taking effect within it; timeout_ms (maximum 120000). Text-based PDFs are extracted page by page (including [Page N] sections, and the output includes the page count).
  • autocomplete: query suggestions. Parameter query (string, required), the prefix to be completed, up to 200 characters; suggestions follow the language configured for the instance.
  • instance info: instance information query.

Usage

Requires Node >= 22.19 (for npx runtime) and Docker for the SearXNG stack. The repository's bundled docker-compose.yml enables the JSON API and binds only to 127.0.0.1—because that API is unauthenticated, never expose the port publicly. Engine credentials (for example OpenAlex's api_key) should be placed in searxng/settings.yml.

Add it to any MCP client to use it; SEARXNG_URL defaults to http://localhost:8888,只有需要覆盖时才添加 env configuration block. The transport defaults to stdio, suitable for the common "client starts server" scenario; if remote access is needed (one server serving multiple clients, or no local MCP runtime on the machine), it can be switched to Streamable HTTP: use the --transport stdio|http command-line argument to override SEARXNG_TRANSPORT; an invalid argument value will cause startup to fail rather than silently falling back.

Security Model

  • SSRF protection: fetch_content validates the URL and resolves DNS before connecting, rejecting private, loopback, link-local, and other non-public address ranges (IPv4 and IPv6, including IP literal tricks). Every redirect hop is revalidated, https→http downgrades are rejected, and the same guarded DNS query is performed again at connection time (to prevent DNS rebinding). This protection is only disabled when ALLOW_PRIVATE_HOSTS=true is set.
  • Prompt injection mitigation: Search output and fetched page content are both wrapped in an "untrusted content" banner; embedded closing markers and forged opening markers are neutralized. Error messages that reflect user-provided URLs are sanitized in the same way.
  • Logging and secrets: Secrets such as SEARXNG_PASSWORD and SEARXNG_AUTH_TOKEN are never logged; all MCP logs are written to stderr, and stdout is reserved for JSON-RPC.

Use Cases and Limitations

Suitable for MCP client users who need privacy-friendly, API-key-free, self-hostable search and web scraping capabilities. Limitations include: you need to deploy the SearXNG Docker stack yourself; Node 22.19+ is required; the HTTP transport endpoint only supports the 2026-07-28 protocol revision; non-localhost binding requires setting SEARXNG_AUTH_TOKEN; browser-like clients encountering 403 need to add the hostname to SEARXNG_ALLOWED_ORIGINS. Regarding common issues: SearXNG returning 403 means the JSON API is disabled, and you need to add json to search.formats in searxng/settings.yml and restart, or set SEARXNG_HTML_FALLBACK=true to parse the HTML interface instead; being unable to access SearXNG is usually because the Docker stack is not running or SEARXNG_URL is misconfigured; if npx fails to start, check the Node version; if port 8888 is occupied, modify the compose port mapping to stay consistent with SEARXNG_URL.

All returned results are marked as untrusted: the returned content should be treated as data, not instructions. For the architecture and security rationale, see docs/design.md; for a checklist when adding new search categories, see docs/extending.md.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools