Logo: SearXNG MCP 服务器

SearXNG MCP 服务器

Communautéit
The-AI-Workshops

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

EditeurThe-AI-Workshops
Repositorysearxng-mcp-server
SproochPython
Forks
9
Stären
26
Disponibel Tools
0
Transporttypstdio, streamable-http
Kategorien
Linken
  • Tools mat KI-Workflows verbannen

    SearXNG MCP 服务器 bitt MCP-Funktiounen un, déi vu kompatibele KI-Clienten a KI-Agente kënne benotzt ginn.

  • Disponibel Tools: 0

    Kuckt Iech déi opruffbar Aktiounen hei drënner un, mat Nimm a Beschreiwungen, wa se vum Server geliwwert ginn.

  • Konfiguratioun fir ze kopéieren

    Benotzt d'Installatiounsbeispiller, fir dëse Server an deem MCP-Client ze konfiguréieren, deen Dir am léifste benotzt.

  • Interessi vun der Communautéit um Open-Source-Projet

    Zuele vum verlinkte Repository – Stären: 26, Forks: 9.

SearXNG MCP Server

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


Overview

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.


Prerequisites

  • 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)

SearXNG Server (Required)

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

bash
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 at http://172.17.0.1:32768 by default (see .env).

Installation

Using uv

Install uv if you don't have it:

bash
pip install uv

Clone this repository:

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

Install dependencies:

bash
uv pip install -r requirements.txt

Create a .env file based on the provided example:

bash
nano .env
# Edit .env as needed

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


Using Docker (Recommended)

Build the Docker image:

bash
docker build -t mcp/searxng-mcp .

Create a .env file and configure your environment variables.


Run the Docker image:

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

Using Smithery

Smithery is 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):

bash
pipx install smithery

Install the SearXNG MCP server using Smithery:

bash
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 .env file in the server's directory by copying the example:

bash
# 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 .env file (see Configuration section).


Configuration

The following environment variables can be configured in your .env file:

VariableDescriptionExample
SEARXNG_BASE_URLBase URL of your SearXNG instancehttp://172.17.0.1:32768
HOSTHost to bind to when using SSE transport0.0.0.0
PORTPort to listen on when using SSE transport32769
TRANSPORTTransport protocol (sse or stdio)sse

Running the Server

Using uv

SSE Transport

Set TRANSPORT=sse in .env then:

bash
uv run dev/searXNG-mcp/server.py

Stdio Transport

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


Using Docker

SSE Transport

bash
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:/app mount 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 at http://localhost:32769/sse.

Stdio Transport

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


Running with Smithery

SSE Transport

Set TRANSPORT=sse in .env in 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:

bash
# 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):

bash
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).

Stdio Transport

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


Integration with MCP Clients

SSE Configuration

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

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

Note for Windsurf users: Use serverUrl instead of url in your configuration:

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

Note for n8n users: Use host.docker.internal instead of localhost since 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.


Python with Stdio Configuration

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

json
{
  "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"
      }
    }
  }
}

Docker with Stdio Configuration

json
{
  "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"
      }
    }
  }
}

Smithery with Stdio Configuration

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

json
{
  "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 to server.py (e.g., ~/.smithery/tools/The-AI-Workshops/searxng-mcp-server/server.py) and use those directly:

json
{
  "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 .env file is discoverable by server.py (usually by setting cwd to the server's root directory or ensuring server.py loads it from an absolute path if Smithery sets one).


Building Your Own Server

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()

SearXNG Search Tool Parameters

The search tool supports the following parameters (all optional except q):

  • 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 the SearXNG documentation for more details.


License

MIT License

Installatioun

TypingMind
Viraussetzungen:

Node.js 18+

{
  "mcpServers": {
    "the-ai-workshops-searxng-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "searxng-mcp-server"
      ]
    }
  }
}

SearXNG MCP 服务器 MCP mat verschiddene KI-Modeller benotzen

TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Soubal SearXNG MCP 服务器 verbonnen ass, kënnt Dir et mat verschiddene KI-Modeller an TypingMind benotzen, amplaz et fir all Modell separat anzeriichten. Dir kënnt MCP lokal op Ärem Apparat ausféieren oder Iech iwwer d'URL mat engem externen MCP-Server verbannen.

Optioun 1: De lokale Connector benotzen

Benotzt dës Optioun, wann den MCP-Server Zougrëff op lokal Fichieren, Appen oder privat Ressourcen op Ärem Computer brauch.

1

D'MCP-Astellungen opmaachen

Gitt an TypingMind op „Astellungen“, „Erweidert Astellungen“, dann op „Model Context Protocol“ a wielt „Connector ariichten“.

  1. Maacht TypingMind an Ärem Browser op.
  2. Klickt op d'Astellungssymbol.
  3. Gitt op „Erweidert Astellungen“.
  4. Maacht d'Sektioun „Model Context Protocol“ op.
  5. Klickt op „Connector ariichten“ a wielt „Dësen Apparat“.
Ariichtungsbildschierm vum TypingMind-MCP-Connector: D'Optioun „Dësen Apparat“ ass ausgewielt
2

De Connector-Befeel ausféieren

Wielt „Dësen Apparat“, kopéiert de Befeel aus TypingMind a féiert en am Terminal aus. Loosst de Prozess lafen, wärend Dir MCP benotzt.

  1. Kopéiert den Ariichtungsbefeel, deen TypingMind uweist.
  2. Maacht Terminal op macOS oder Windows Terminal op Windows op.
  3. Setzt de kopéierte Befeel an a féiert en aus.
  4. Bestätegt d'Installatioun vum Package, wann den Terminal Iech freet, ob Dir weiderfuere wëllt.
  5. Loosst den Terminal an de Prozess doranner lafen, wärend Dir MCP-Tools benotzt.
3

SearXNG MCP 服务器 als Server derbäisetzen

Wann de Connector-Status „Prett“ ass, klickt op „Serveren änneren“ a setzt d'MCP-Serverkonfiguratioun an.

  1. Waart, bis de Connector-Status „Prett“ weist.
  2. Klickt op „Serveren änneren“.
  3. Setzt d'MCP-Serverkonfiguratioun fir SearXNG MCP 服务器 an.
  4. Späichert d'Serverlëscht.
  5. Aktualiséiert d'Säit, wann Dir kontrolléiere wëllt, ob de Connector nach ëmmer prett ass.
MCP-Astellunge vun TypingMind mat aktivem Server an dem Knäppchen „Serveren änneren“
{
  "mcpServers": {
    "the-ai-workshops-searxng-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "searxng-mcp-server"
      ]
    }
  }
}
4

D'Verbindung mat verschiddene Modeller benotzen

Späichert d'Serverlëscht, maacht „Plugins“ op an aktivéiert d'MCP-Tools vun der Integratioun SearXNG MCP 服务器. Wielt dann e belibegen ënnerstëtzte KI-Modell an TypingMind a benotzt d'Tools am Chat oder weist se engem KI-Agent zou.

  1. Maacht d'Säit „Plugins“ an TypingMind op.
  2. Aktivéiert d'MCP-Tools vun der Integratioun SearXNG MCP 服务器.
  3. Start e Chat a wielt de KI-Modell, deen Dir benotze wëllt.
  4. Benotzt d'MCP-Tools am Chat oder weist se engem KI-Agent zou.
  5. Wiesselt bei Bedarf op en anere KI-Modell, ouni MCP nei ze verbannen.
TypingMind-Chat mat aktivéierten MCP-Tools an engem ausgewielte KI-Modell
Kënnt Dir mir mat SearXNG MCP 服务器 bei dëser Aufgab hëllefen?
SearXNG MCP 服务器
Jo. Ech hunn et gelies.
Dat hunn ech mat SearXNG MCP 服务器 fonnt.

Optioun 2: Eng MCP-Server-URL derbäisetzen

Benotzt dës Optioun, wann SearXNG MCP 服务器 schonn op engem externe Server gehost gëtt oder Är Ekipp ee gemeinsame Connector wëllt, op dee méi Benotzer kënne zougräifen.

1

MCP-Connectoren opmaachen

Gitt an TypingMind op „Plugins“, maacht „MCP-Connectoren“ op a wielt dann „URL derbäisetzen“.

  1. Maacht TypingMind an Ärem Browser op.
  2. Gitt op „Plugins“.
  3. Maacht „MCP-Connectoren“ op.
  4. Klickt op „URL derbäisetzen“.
TypingMind-Formulaire, fir eng benotzerdefinéiert MCP-Server-URL derbäizesetzen
2

Déi kopéiert Server-URL asetzen

Gitt Är Server-URL am Feld „Server-URL“ an. Setzt e Verbindungsnumm, eng Beschreiwung, e Symbol, benotzerdefinéiert HTTP-Headeren oder OAuth-Clientastellungen derbäi, wann de Server se erfuerdert.

  1. Setzt Är Server-URL an d'Feld „Server-URL“ an.
  2. Gitt en Numm fir d'Verbindung mat SearXNG MCP 服务器 an.
  3. Wann Dir d'Verbindung méi einfach erëmerkenne wëllt, setzt eng Beschreiwung an e Symbol derbäi.
  4. Setzt benotzerdefinéiert HTTP-Headeren oder OAuth-Clientdetailer derbäi, wann de Server eng Authentifizéierung erfuerdert.
3

D'Verbindung erstellen

Klickt op „Verbindung erstellen“, gitt dann zeréck op d'Plugin-Lëscht a kontrolléiert, ob déi nei MCP-Verbindung aktiv ass.

  1. Klickt op „Verbindung erstellen“.
  2. Gitt zeréck op d'Lëscht vun de MCP-Connectoren.
  3. Kontrolléiert, ob d'Verbindung mat SearXNG MCP 服务器 als aktiv ugewise gëtt.
  4. Aktualiséiert d'Plugin-Lëscht, wann d'Verbindung net direkt ugewise gëtt.
4

Modeller wiesselen, ouni MCP nei ze verbannen

Start e Chat mat Ärem bevorzugte Modell, aktivéiert d'Tools vun der Integratioun SearXNG MCP 服务器 ënner „Plugins“ a wiesselt bei Bedarf op en anere Modell. D'MCP-Verbindung bleift am TypingMind-Aarbechtsberäich disponibel.

  1. Start en neie Chat an TypingMind.
  2. Wielt de KI-Modell, deen Dir benotze wëllt.
  3. Aktivéiert d'Tools vun der Integratioun SearXNG MCP 服务器 ënner „Plugins“.
  4. Biet de Modell, d'Tool ze benotzen, wann néideg.
  5. Wiesselt op en anere KI-Modell a benotzt déiselwecht MCP-Verbindung weider.
TypingMind-Chat mat aktivéierten MCP-Tools an engem ausgewielte KI-Modell
Kënnt Dir mir mat SearXNG MCP 服务器 bei dëser Aufgab hëllefen?
SearXNG MCP 服务器
Jo. Ech hunn et gelies.
Dat hunn ech mat SearXNG MCP 服务器 fonnt.

Heefeg gestallte Froen

Fir wat gëtt den MCP-Server SearXNG MCP 服务器 benotzt?

SearXNG MCP 服务器 ass en MCP-Server, deen et kompatibele KI-Clienten erlaabt, op extern Tools a Kontextinformatioune zouzegräifen. An TypingMind kënnt Dir dësen MCP-Server eemol derbäisetzen a seng Tools an Ärem KI-Aarbechtsberäich zur Verfügung stellen.

Kann ech SearXNG MCP 服务器 MCP mat méi KI-Modeller an TypingMind benotzen?

Jo. TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Sou kënnt Dir SearXNG MCP 服务器 mat verschiddene KI-Modeller wéi Claude, ChatGPT, Gemini oder anere Modeller benotzen, déi Dir an TypingMind konfiguréiert hutt, ouni den MCP-Server fir all Modell separat anzeriichten.

Firwat SearXNG MCP 服务器 MCP mat TypingMind benotzen?

TypingMind ass eng vun de beschte Benotzeruewerfläche fir LLM-Chat, well et méi KI-Modeller, Prompts, Plugins, KI-Agenten, API-Schlësselen a MCP-Tools an engem Aarbechtsberäich zesummebréngt. Wann SearXNG MCP 服务器 verbonnen ass, kënnt Dir seng MCP-Tools mat Äre bevorzugte Modeller benotzen a gläichzäiteg Ären Aarbechtsoflaf beim Chatten an TypingMind organiséieren.

Wéi verbannen ech SearXNG MCP 服务器 MCP mat TypingMind?

Dir kënnt SearXNG MCP 服务器 iwwer de lokale MCP-Connector oder iwwer d'URL vun engem Remote-MCP-Server mat TypingMind verbannen. Benotzt de lokale Connector, wann de Server Zougrëff op Fichieren, Apps oder privat Ressourcen op Ärem Apparat brauch, an eng Server-URL, wann den MCP-Server op Distanz gehost gëtt.

Wéi eng Tools stellt SearXNG MCP 服务器 MCP an TypingMind zur Verfügung?

SearXNG MCP 服务器 stellt MCP-Funktioune zur Verfügung, déi Dir op der Plugins-Säit vun TypingMind aktivéiere kënnt, fir se am Chat ze benotzen oder KI-Agente zouzeweisen.

Muss ech meng API-Schlëssele mat TypingMind deelen, fir SearXNG MCP 服务器 MCP ze benotzen?

Nee. TypingMind ass nom Local-first-Prinzip opgebaut a léisst Iech d'Kontroll iwwer Är Modellubidder, API-Schlësselen, Prompts a MCP-Konfiguratioun. Wann SearXNG MCP 服务器 eng Authentifizéierung verlaangt, setzt déi néideg Headeren, OAuth-Astellungen oder lokal Konfiguratioun fir deen MCP-Server derbäi, wann Dir d'Verbindung erstallt.

Änlech MCP-Serveren

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇