SearXNG MCP Server

by the-ai-workshops

Not rated
GitHub

About

A privacy-respecting web search server for AI agents, powered by the SearXNG metasearch engine.

Details

Author
the-ai-workshops
Categories
Search, Other

Setup

Install SearXNG MCP Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/the-ai-workshops/searxng-mcp-server

Follow the installation instructions in the repository README, then restart your MCP client.

An MCP sse implementation of the Model Context Protocol (MCP) server integrated withSearXNGfor providing AI agents with powerful, privacy-respecting search capabilities.

This project demonstrates how to build an MCP server that enables AI agents to perform web searches using a SearXNG instance. It serves as a practical template for creating your own MCP servers, using SearXNG as a backend.

The implementation follows the best practices laid out by Anthropic for building MCP servers, allowing seamless integration with any MCP-compatible client.

- Python 3.9+
- Access to a running SearXNG instance (local or remote)
- Docker (optional, for containerized deployment)
-
uv(optional, for fast Python dependency management)
-
Smithery(optional, for MCP server management)

You must have a SearXNG server running and accessible. The recommended way is via Docker:

docker run -d --name=searxng -p 32768:8080 -v "/root/searxng:/etc/searxng" \ -e "BASE_URL=http://0.0.0.0:32768/" \ -e "INSTANCE_NAME=home" \ --restart always searxng/searxng

- This will run SearXNG on port 32768 and persist configuration in/root/searxng.
- The MCP server expects SearXNG to be available athttp://172.17.0.1:32768by default (see.env).

git clone https://github.com/The-AI-Workshops/searxng-mcp-server.git cd searxng-mcp-server/dev/searXNG-mcp

Create a.envfile based on the provided example:

Configure your environment variables in the.envfile (see Configuration section).

Create a.envfile and configure your environment variables.

docker run -d --env-file ./.env -p 32769:32769 mcp/searxng-mcp

Smitheryis a command-line tool for managing AI agent tools and MCP servers.

Install Smithery if you don't have it (see Smithery documentation for various installation methods, e.g., using pipx):

Install the SearXNG MCP server using Smithery:

smithery install @The-AI-Workshops/searxng-mcp-server

This will install the server and its dependencies into a dedicated environment managed by Smithery.

After installation, Smithery will provide you with the path to the installed server. You will need to navigate to this directory to configure it. For example, if Smithery installs tools into~/.smithery/tools/, the path might be~/.smithery/tools/The-AI-Workshops/searxng-mcp-server.

Create a.envfile in the server's directory by copying the example:

# Example: # cd ~/.smithery/tools/The-AI-Workshops/searxng-mcp-server cp .env.example .env nano .env # Edit .env as needed

Configure your environment variables in the.envfile (see Configuration section).

The following environment variables can be configured in your.envfile:

With stdio, the MCP client itself can spin up the MCP server, so nothing to run at this point.

docker build -t mcp/searxng-mcp . docker run --rm -it -p 32769:32769 --env-file dev/searXNG-mcp/.env -v $(pwd)/dev/searXNG-mcp:/app mcp/searxng-mcp

- The-v $(pwd)/dev/searXNG-mcp:/appmount allows you to live-edit the code and .env file on your host and have changes reflected in the running container.
- The server will be available athttp://localhost:32769/sse.

With stdio, the MCP client itself can spin up the MCP server container, so nothing to run at this point.

SetTRANSPORT=ssein.envin the Smithery-installed server directory. Then, you can typically run the server using the Python interpreter from the virtual environment Smithery created for the tool:

# Navigate to the server directory, e.g., # cd ~/.smithery/tools/The-AI-Workshops/searxng-mcp-server ~/.smithery/venvs/The-AI-Workshops_searxng-mcp-server/bin/python server.py

Alternatively, if Smithery provides a direct run command for installed tools (check Smithery documentation):

smithery run @The-AI-Workshops/searxng-mcp-server

The server will be available based on your HOST and PORT settings in.env(e.g.,http://localhost:32769/sse).

With stdio, the MCP client itself will spin up the server. The client configuration will need to point to theserver.pyscript within the Smithery-managed directory, potentially usingsmithery execor the direct path to the Python interpreter in the tool's virtual environment. See the "Integration with MCP Clients" section for examples.

Once you have the server running with SSE transport, you can connect to it using this configuration:

{ "mcpServers": { "searxng": { "transport": "sse", "url": "http://localhost:32769/sse" } } }

Note for Windsurf users:UseserverUrlinstead ofurlin your configuration:

{ "mcpServers": { "searxng": { "transport": "sse", "serverUrl": "http://localhost:32769/sse" } } }

Note for n8n users:Usehost.docker.internalinstead oflocalhostsince n8n has to reach outside of its own container to the host machine:

So the full URL in the MCP node would be:http://host.docker.internal:32769/sse

Make sure to update the port if you are using a value other than the default 32769.

Add this server to your MCP configuration for Claude Desktop, Windsurf, or any other MCP client:

{ "mcpServers": { "searxng": { "command": "python", "args": ["dev/searXNG-mcp/server.py"], "env": { "TRANSPORT": "stdio", "SEARXNG_BASE_URL": "http://localhost:32768", "HOST": "0.0.0.0", "PORT": "32769" } } } }
{ "mcpServers": { "searxng": { "command": "docker", "args": ["run", "--rm", "-i", "-e", "TRANSPORT", "-e", "SEARXNG_BASE_URL", "-e", "HOST", "-e", "PORT", "mcp/searxng-mcp"], "env": { "TRANSPORT": "stdio", "SEARXNG_BASE_URL": "http://localhost:32768", "HOST": "0.0.0.0", "PORT": "32769" } } } }

If you installed the server using Smithery, you can configure your MCP client to run it via stdio. Smithery provides anexeccommand to run executables from within the tool's environment.

{ "mcpServers": { "searxng": { "command": "smithery", "args": ["exec", "@The-AI-Workshops/searxng-mcp-server", "--", "python", "server.py"], // "cwd" (current working directory) might be automatically handled by Smithery. // If server.py is in a subdirectory, adjust the python script path e.g., "python", "path/to/server.py" "env": { "TRANSPORT": "stdio", "SEARXNG_BASE_URL": "http://localhost:32768", // Adjust as needed "HOST": "0.0.0.0", // Typically not used by stdio server itself but good to set "PORT": "32769" // Typically not used by stdio server itself } } } }

Alternatively, you can find the path to the Python interpreter in the virtual environment created by Smithery (e.g.,~/.smithery/venvs/The-AI-Workshops_searxng-mcp-server/bin/python) and the path toserver.py(e.g.,~/.smithery/tools/The-AI-Workshops/searxng-mcp-server/server.py) and use those directly:

{ "mcpServers": { "searxng": { "command": "~/.smithery/venvs/The-AI-Workshops_searxng-mcp-server/bin/python", "args": ["~/.smithery/tools/The-AI-Workshops/searxng-mcp-server/server.py"], // "cwd" should be the directory containing server.py if not using absolute paths for args, // or if server.py relies on relative paths for other files (like .env). // Example: "cwd": "~/.smithery/tools/The-AI-Workshops/searxng-mcp-server", "env": { "TRANSPORT": "stdio", "SEARXNG_BASE_URL": "http://localhost:32768" // Other necessary env vars from .env can be duplicated here } } } }

Ensure the paths are correct for your Smithery installation and that the.envfile is discoverable byserver.py(usually by settingcwdto the server's root directory or ensuringserver.pyloads it from an absolute path if Smithery sets one).

This template provides a foundation for building more complex MCP servers. To build your own:

- Add your own tools by creating methods with the@mcp.tool()decorator
- Create your own lifespan function to add your own dependencies (clients, database connections, etc.)
- Add prompts and resources as well with@mcp.resource()and@mcp.prompt()

Thesearchtool supports the following parameters (all optional exceptq):

- q(required): The search query string.
- categories: Comma-separated list of active search categories.
- engines: Comma-separated list of active search engines.
- language: Code of the language.
- page: Search page number (default: 1).
- time_range: [day, month, year]
- format: [json, csv, rss] (default: json)
- results_on_new_tab: [0, 1]
- image_proxy: [true, false]
- autocomplete: [google, dbpedia, duckduckgo, mwmbl, startpage, wikipedia, stract, swisscows, qwant]
- safesearch: [0, 1, 2]
- theme: [simple]
- enabled_plugins: List of enabled plugins.
- disabled_plugins: List of disabled plugins.
- enabled_engines: List of enabled engines.
- disabled_engines: List of disabled engines.

See theSearXNG documentationfor more details.

Search global news using natural language. Webz.io News Search API returns the most relevant articles and content, with filters for source, country, language, date, sentiment, and category.

A privacy-respecting metasearch engine powered by a self-hosted SearXNG instance.

Fetch, convert, and search AWS documentation pages, with recommendations for related content.

Search campgrounds around the world on campertunity, check availability, and provide booking links.

The Ferryhopper MCP Server exposes ferry routes, schedules and booking redirects so an AI assistant can discover connections across Europe and the Mediterranean and send users to Ferryhopper to complete bookings.

All-in-One SEO & Web Intelligence Toolkit API from FetchSERP.

MCP server that provides read-only access to HyperKitty, the web-based email archive component of Mailman 3.

At Sunrise Apps, we believe AI agents should be limitless, especially when it comes to visual data. We created ImageSorcery to bridge the critical gap in AI's ability to interact with and manipulate images directly, all while upholding the highest standards of privacy and security.

Just Domain is the domain registrar for businesses built with AI. Its remote MCP server checks availability and returns first-year and renewal pricing, plus a link to register on justdomain.ai, with DNS and WHOIS privacy in the same place. No account, no API key, read only. Endpoint: https://mcp.justdomain.ai/

Search the web using Kagi's search API

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.