Deploy SearXNG MCP

Web search for AI agents over MCP, with a private SearXNG and no API key

Deploy SearXNG MCP

Just deployed

Deploy and Host SearXNG MCP on Railway

mcp-searxng is an MCP server that gives AI assistants and agents web search and page reading through SearXNG, a self-hosted metasearch engine. There is no search API key and no per-query bill.

This template runs both: mcp-searxng 2.4.0 on a public HTTPS address behind a bearer token, and SearXNG on Railway's private network only.

About Hosting SearXNG MCP

SearXNG has no public domain here. Only the MCP service can reach it, so your instance can't be found and used as a free search proxy by strangers. A small settings file turns on SearXNG's JSON API, which MCP servers need, and turns off the public-instance features.

The MCP server runs upstream's hardened HTTP mode. Every request needs the token in MCP_HTTP_AUTH_TOKEN (generated at deploy), and the host and origin allowlists are set to your Railway domain. The page reader (web_url_read) refuses private addresses. Without that, anyone with the token could use it to look at other services in your Railway project.

Search engines treat Railway's datacenter IPs differently, so I tested them from a deployment. Google, Bing and Yahoo returned results. DuckDuckGo answered with a CAPTCHA, and Brave, Startpage, Qwant, Mojeek, Presearch and Ecosia returned nothing. SearXNG here keeps only the engines that answered, plus Wikipedia, their news engines and a few developer sources (GitHub, Stack Overflow, PyPI, npm, MDN, arXiv). Otherwise every search would wait for engines that time out.

Before publishing I tested the final version on a fresh deploy as an MCP client. A request without the token got 401. With the token, the server listed its four tools, searches returned results, web_url_read read a public page, and reading the SearXNG service's private address was refused by the security policy. After restarting both services everything still worked.

Common Use Cases

  • Web search for agents such as Hermes, OpenClaw, n8n AI agents, LibreChat or Open WebUI, without a search API subscription
  • Search and page reading in Claude Code, Cursor or other coding tools that accept an MCP URL with a header
  • One shared search endpoint for several agents, with results cached for a day

Dependencies for SearXNG MCP Hosting

Nothing beyond the template. Your MCP client needs to support Streamable HTTP with a custom Authorization header. Claude Code, Cursor, n8n and most agent frameworks do. The Claude.ai and ChatGPT web connectors only offer OAuth or no authentication, so they can't use this token setup.

Deployment Dependencies

Implementation Details

Add the server to Claude Code:

claude mcp add --transport http searxng  --header "Authorization: Bearer "
MCP_URL                  # https:///mcp
MCP_HTTP_AUTH_TOKEN      # generated; send as Authorization: Bearer 
MCP_HTTP_ALLOWED_HOSTS   # your Railway domain; add a custom domain here, comma-separated
SEARXNG_MAX_RESULTS=10   # results per search

Tools: searxng_web_search, searxng_search_suggestions, searxng_instance_info and web_url_read.

Idle, the MCP server used 0.09 GB of RAM and SearXNG 0.11 GB, which is about $2 a month on Railway's usage pricing.

Why Deploy SearXNG MCP on Railway?

Agents need search, and paid search APIs charge per query. Here search runs on your own instance for the cost of about 0.2 GB of RAM. The tradeoff is that results depend on engines that accept datacenter traffic, which can change; if one stops answering, SearXNG suspends it and uses the others.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
116
View Template
stella
Self-host stella with web, API, Postgres, Redis, and object storage.

Jan Kubica
7
View Template
Hermes Agent | OpenClaw Alternative with Dashboard
Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

codestorm
81