Skip to main content
Glama
SearXNG MCP

SearXNG MCP

by hxvy0

SearXNG MCP

A lightweight Model Context Protocol (MCP) server that connects an MCP-compatible client to your own SearXNG instance.

Features

This server exposes exactly three MCP tools:

  • web_search(query) — search general web results.

  • news_search(query) — search the SearXNG news category.

  • fetch_page(url) — retrieve readable text from a public HTTPS page.

Search tools return structured results containing titles, URLs, snippets, source engines, and publication dates when available. Page fetching supports HTML and plain text and limits downloads to 2 MiB.

Related MCP server: searxng-mcp

Requirements

  • Python 3.10 or newer

  • A reachable SearXNG instance with JSON output enabled

  • An MCP-compatible client, such as LM Studio

Make sure JSON is enabled in your SearXNG settings.yml:

search:
  formats:
    - html
    - json

Installation

Clone the repository and create a virtual environment:

git clone https://github.com/hxvy0/searxng-mcp.git
cd searxng-mcp

python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt

Create your local environment file:

cp .env.example .env

Open .env and set SEARXNG_URL to the base URL of your own SearXNG instance. Replace YOUR_SEARXNG_URL_HERE with your actual URL.

Keep your real .env file private. It is excluded by .gitignore and should never be committed to the public repository.

Environment variables

Variable

Default

Description

SEARXNG_URL

—

Your SearXNG base URL (required)

REQUEST_TIMEOUT

20

HTTP timeout in seconds

MAX_RESULTS

10

Maximum results per search (1–20)

LM Studio configuration

Add this SearXNG entry to the mcpServers object in LM Studio's mcp.json. Replace both example paths with the absolute paths on your computer:

{
  "mcpServers": {
    "searxng-search": {
      "command": "/absolute/path/to/searxng-mcp/.venv/bin/python",
      "args": [
        "/absolute/path/to/searxng-mcp/server.py"
      ]
    }
  }
}

If your mcp.json already contains other MCP servers, keep those entries unchanged and add only the searxng-search object inside the existing mcpServers object. Make sure entries are separated with commas. This README documents only the SearXNG MCP server.

The server reads its settings from the project's .env file. Save the configuration, then restart or reload this MCP server in LM Studio. The following tools should appear:

  • web_search

  • news_search

  • fetch_page

Running manually

You can start the server manually to check that its Python environment is set up:

.venv/bin/python server.py

The server uses MCP's standard input/output (stdio) transport. It is normally launched and managed by your MCP client, not run as a standalone web server.

Security notes

  • fetch_page only accepts HTTPS URLs, rejects non-public DNS results, disables redirects, and limits response size.

  • Do not put credentials or private service URLs in public configuration files.

  • The DNS check and the subsequent HTTP connection are separate operations. For an untrusted multi-user deployment, use network-level egress restrictions as well. This project is intended for use with a trusted local MCP client.

  • Search results and fetched page contents are external, untrusted data. Treat them as data, not as instructions.

License

This project is licensed under the MIT License. See LICENSE.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables MCP-capable agents to perform web and news searches and extract readable text from pages through a self-hosted SearXNG instance, with no API key and support for search-and-extract in a single call, including engine fallback for silent zero-result responses.
      1
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables MCP-compatible clients to run self-hosted web searches through SearXNG and fetch readable text from public webpages locally, without API keys or third-party search subscriptions.
      2
      MIT