by erhwenkuo
Provides an SSE‑based MCP server that leverages a self‑hosted SearXNG meta‑search engine and markdownify to retrieve web pages and return results in Markdown format for AI agents.
What is MCP Searxng about? MCP Searxng delivers a server that connects AI agents to a SearXNG meta‑search instance. It forwards search queries, fetches result pages, converts them to Markdown, and streams the data via Server‑Sent Events (SSE), enabling agents to obtain fresh, privacy‑controlled web information.
How to use MCP Searxng?
uv
(or use Docker) on an Ubuntu 24.04 host.
curl -LsSf https://astral.sh/uv/install.sh | sh
git clone https://github.com/erhwenkuo/mcp-searxng.git
cd mcp-searxng
uv sync
cd searxng-docker
docker compose up -d # maps http://localhost:8888 to SearXNG
uv
:
uv run server.py --searxng_url="http://localhost:8888"
docker build -t mcp-searxng .
docker run -d -e SEARXNG_URL="http://<host‑ip>:8888" -p 5488:5488 mcp-searxng
npx @modelcontextprotocol/inspector
Connect to http://localhost:5488/sse
, list the tools (web_search
, web_url_read
), and run them.Key Features
web_search
(meta‑search) and web_url_read
(page fetch‑and‑markdownify).Use Cases
FAQ
--port <number>
when launching the server.--searxng_url
(or the SEARXNG_URL
env var for Docker).uv
). The Docker variant contains all dependencies.web_search
or web_url_read
from the Tools tab.An example of an MCP Server for use by an AI Agent, designed to allow the AI Agent to search for new external information through SearXNG's open-source meta-search engine.
Currently, many search engines other than Google have emerged in the market, attempting to capture market share in areas where Google falls short. For instance, DuckDuckGo emphasizes not tracking users, Ecosia plants trees with every search, and Brave Search aims to harness collective efforts to build a free search engine.
However, the results returned by these engines are often unsatisfactory. Firstly, they don’t crawl as many web pages as Google does; secondly, their support for Chinese is poor. Although they can access some interesting pages that Google doesn’t display, search engines other than Google are still quite difficult to use.
So why not combine the results from multiple search engines!? That’s exactly what a meta-search engine does. SearXNG, an open-source meta-search engine software, can be self-hosted or used via sites provided by enthusiastic community members. For businesses, SearXNG offers a way to maintain privacy and security control while enabling AI Agents to effectively search for the external data they need.
References:
This MCP server demonstrates an SSE-based MCP server (integrated with SearXNG and Microsoft's markdownify to extract web pages into Markdown-formatted text) and its operational mode using the MCP Inspector (MCP client).
This project uses uv to manage dependencies and the Python runtime environment. If uv is not yet installed, you can follow the installation instructions on the official website.
The following commands are executed in an Ubuntu 24.04 environment. For operations on other operating systems, please adjust accordingly:
$ curl -LsSf https://astral.sh/uv/install.sh | sh
Download source code:
$ git clone https://github.com/erhwenkuo/mcp-searxng.git
$ cd mcp-searxng
$ uv sync
First, install Docker on the machine where it will run and perform the related configurations. For detailed information, please refer to: Install Docker Engine on Ubuntu
In the project directory, there is a pre-configured simple SearXNG setup to facilitate testing.
mcp-searxng/searxng-docker/
├── docker-compose.yaml
└── searxng
├── settings.yml
└── uwsgi.ini
Switch to the searxng-docker
directory and use Docker Compose to start a SearXNG service:
$ cd searxng-docker
$ docker compose up -d
$ docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
searxng docker.io/searxng/searxng:latest "/sbin/tini -- /usr/…" searxng 29 minutes ago Up 29 minutes (healthy) 0.0.0.0:8888->8080
The test SearXNG service is mapped to the local machine's port: 8888
.
Enter the following command to start:
$ uv run server.py --searxng_url="http://localhost:8888"
INFO: Started server process [219904]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:5488 (Press CTRL+C to quit)
First, build the Docker image:
$ docker build -t mcp-searxng .
Start mcp-searxng. Since the mcp-searxng service is being started using Docker, you cannot use localhost
to point to the SearXNG service address when configuring the connection to SearXNG. It is recommended to directly query the local machine's IP address and then use the SEARXNG_URL
environment variable for configuration.
The startup parameters below assume the local machine's IP is 192.168.54.88
:
$ docker run -d -e SEARXNG_URL="http://192.168.54.88:8888" -p 5488:5488 mcp-searxng
First, install Node.js:
# Download and install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash
# In lieu of restarting the shell
\. "$HOME/.nvm/nvm.sh"
# Download and install Node.js:
nvm install 22
# Verify the Node.js version:
node -v # Should print "v22.14.0".
nvm current # Should print "v22.14.0".
# Verify npm version:
npm -v # Should print "10.9.2".
Next, start the MCP Inspector:
$ npx @modelcontextprotocol/inspector
Starting MCP inspector...
Proxy server listening on port 3000
🔍 MCP Inspector is up and running at http://localhost:5173 🚀
Open http://localhost:5173
in your browser and perform the following actions:
SSE
in the Transport Type dropdown.http://localhost:5488/sse
.Connect
. If the status shows "Connected," it means you have successfully connected to the MCP server.web_search
web_url_read
web_search
. On the right, you’ll see the tool’s description and parameters. Enter the keyword you want to search for in the query
input field, then click the "Run Tool" button.The effect is shown in the image below:
Test web_url_read
:
web_url_read
. On the right, you’ll see the tool’s description and parameters. Enter the URL of the webpage you want to retrieve in the url
input field, then click the "Run Tool" button.This means the MCP server can be a process running remotely, and the AI Agent (client) can connect, use, and disconnect from it anytime, anywhere. In other words, an SSE-based server and client can be decoupled processes (potentially even on decoupled nodes).
Compared to the STDIO-based model, where the client spawns the server as a subprocess, this is different and more suitable for "cloud-native" use cases.
server.py
is an SSE-based MCP server. By default, the server runs on 0.0.0.0:5488
, but it can be configured using command-line arguments, for example:
uv run server.py --host <your host> --port <your port>
Startup Parameters:
Parameter | Required | Default | Type | Description |
---|---|---|---|---|
--host |
No | 0.0.0.0 |
str | Host to bind to |
--port |
No | 5488 |
int | Port to listen on |
--searxng_url |
No | http://localhost:8888 |
str | SearXNG URL to connect to |
Please log in to share your review and rating for this MCP.
{ "mcpServers": { "mcp-searxng": { "command": "uv", "args": [ "run", "server.py", "--searxng_url=http://localhost:8888" ], "env": {} } } }
Explore related MCPs that share similar capabilities and solve comparable challenges
by exa-labs
Provides real-time web search capabilities to AI assistants via a Model Context Protocol server, enabling safe and controlled access to the Exa AI Search API.
by elastic
Enables natural‑language interaction with Elasticsearch indices via the Model Context Protocol, exposing tools for listing indices, fetching mappings, performing searches, running ES|QL queries, and retrieving shard information.
by graphlit
Enables integration between MCP clients and the Graphlit platform, providing ingestion, extraction, retrieval, and RAG capabilities across a wide range of data sources and connectors.
by mamertofabian
Fast cross‑platform file searching leveraging the Everything SDK on Windows, Spotlight on macOS, and locate/plocate on Linux.
by cr7258
Provides Elasticsearch and OpenSearch interaction via Model Context Protocol, enabling document search, index management, cluster monitoring, and alias operations.
by liuyoshio
Provides natural‑language search and recommendation for Model Context Protocol servers, delivering rich metadata and real‑time updates.
by ihor-sokoliuk
Provides web search capabilities via the SearXNG API, exposing them through an MCP server for seamless integration with AI agents and tools.
by fatwang2
Provides web and news search, URL crawling, sitemap extraction, deep‑reasoning, and trending topic retrieval via Search1API, exposed as an MCP server for integration with AI clients.
by cnych
Provides SEO data retrieval via Ahrefs, exposing MCP tools for backlink analysis, keyword generation, traffic estimation, and keyword difficulty, with automated CAPTCHA solving and response caching.