Skip to main content
Glama

searxng-mcp

中文文档

License: BSD-3-Clause Python >= 3.10 CI

An MCP (Model Context Protocol) server for web search backed by SearXNG — a self-hosted, privacy-focused metasearch engine.

No API keys, no vendor lock-in, no commercial quotas. Point it at any SearXNG instance and give your MCP client (Qwen Code, Claude, etc.) real web access.

Features

Tool

Description

web_search

General & vertical search (categories: news, science, it, files, images, videos, music, map, social media). Supports pagination, language, freshness filter (day/week/month/year) and safesearch. Returns ranked results (title / URL / snippet / source engines) plus direct answers, corrections and suggestions when SearXNG provides them.

web_search_news

News-vertical search with time filtering. Same result shape as web_search.

web_extract

Fetch a page and return its main content as clean plain text (scripts, navigation and boilerplate removed). Truncates to max_chars. Use it to read a search result in full.

Related MCP server: searxng-mcp-server

How it works

MCP client ──stdio──> searxng-mcp ──HTTP JSON API──> your SearXNG instance ──> upstream engines

The server queries the SearXNG JSON API (GET /search?format=json) and normalizes the response into a compact, LLM-friendly shape. Errors are actionable: if the instance hasn't enabled the JSON format, the tool tells you exactly what to add to settings.yml.

Quick start

1. Run a SearXNG instance (skip if you already have one)

cd examples
docker compose up -d     # or: podman run -d --name searxng -p 8080:8080 \
                         #   -v $PWD/searxng-settings.yml:/etc/searxng/settings.yml:ro \
                         #   searxng/searxng:latest

The instance runs at http://localhost:8080. The example settings enable the JSON API — required for this server:

search:
  formats:
    - html
    - json

2. Install

git clone https://github.com/BG-Titan/searxng-mcp.git
cd searxng-mcp
uv sync        # or: python -m venv .venv && .venv/bin/pip install -e .

3. Run

SEARXNG_URL=http://localhost:8080 uv run searxng-mcp
# stdio transport by default; set SEARXNG_MCP_TRANSPORT=streamable-http to switch

4. Register with your MCP client

See examples/mcp-client.example.json (Claude Desktop / Qwen Code / Claude Code compatible .mcp.json format). Replace the path placeholder with your checkout:

{
  "mcpServers": {
    "searxng": {
      "command": "uv",
      "args": ["run", "--directory", "/abs/path/to/searxng-mcp", "searxng-mcp"],
      "env": { "SEARXNG_URL": "http://localhost:8080" }
    }
  }
}

Without uv, point command at the installed entry point (e.g. /path/to/.venv/bin/searxng-mcp).

5. Verify

uv run pytest   # unit tests, schema checks and a stdio end-to-end test

Configuration

Environment variables read at startup:

Variable

Default

Description

SEARXNG_URL

http://localhost:8080

Base URL of your SearXNG instance.

SEARXNG_TIMEOUT

15

Per-request timeout in seconds.

SEARXNG_MCP_TRANSPORT

stdio

MCP transport: stdio or streamable-http.

Project layout

searxng-mcp/
├── .github/workflows/ci.yml        # GitHub Actions: uv sync + pytest
├── examples/
│   ├── docker-compose.yml          # one-shot local SearXNG
│   ├── mcp-client.example.json     # MCP client config example
│   └── searxng-settings.yml        # SearXNG settings with JSON API enabled
├── src/searxng_mcp/
│   ├── client.py                   # SearXNG JSON API client (httpx)
│   ├── extract.py                  # page fetch + readable-text extraction
│   ├── server.py                   # MCPServer (mcp SDK 2.x) & tool registration
│   └── __main__.py
├── tests/
│   ├── test_client.py              # parsing, params, error paths (MockTransport)
│   ├── test_extract.py             # HTML -> text
│   ├── test_server.py              # tool schemas & invocation
│   └── test_smoke.py               # stdio handshake + real-HTTP e2e test
└── pyproject.toml

Development

uv sync            # create .venv, install deps + dev group
uv run pytest -q   # run the test suite

Troubleshooting

  • SearXNG returned HTML instead of JSON — the instance has the JSON format disabled. Add search.formats: [html, json] to its settings.yml and restart.

  • HTTP 429 — the instance limiter is active; set server.limiter.on: false in settings.yml for local use.

  • Cannot connect to SearXNG — check the instance is up and SEARXNG_URL points to it.

  • Few/empty results — SearXNG results depend on its enabled upstream engines and languages; try a different language or the general category.

Contributing

Issues and pull requests are welcome. Run uv run pytest before submitting.

License

BSD-3-Clause © BG-Titan

Available Tools

3 tools
web_extractA

Fetch a web page and return its main content as clean plain text (scripts, navigation and boilerplate removed). Use after web_search / web_search_news to read a result in full. The text is truncated to max_chars.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYes
max_charsNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses key behavioral traits: it removes scripts/navigation/boilerplate, returns plain text, and truncates to max_chars. Since no annotations are provided, the description carries the full burden, and it does a good job of setting expectations about output format and limits. It doesn't mention potential failures (e.g., paywalls, JS-heavy pages) but covers the main behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with no fluff. The core action and output format are front-loaded, and the usage context and truncation behavior are stated efficiently. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (2 params, no nested objects) and the presence of an output schema, the description covers the essential context: what it does, what it returns, and when to use it. It could mention error cases or content-type limitations, but for a straightforward fetch-and-extract tool, it is largely complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It explains the purpose of max_chars (truncation) and implies url is the target page, but it doesn't add detail about URL format, required scheme, or how max_chars interacts with the output beyond truncation. The description adds some meaning but not enough to fully compensate for the lack of schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: fetching a web page and returning main content as clean plain text. It explicitly mentions what is removed (scripts, navigation, boilerplate), which distinguishes it from the sibling search tools. The verb 'Fetch' and resource 'web page' are specific and unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly says to use this tool after web_search / web_search_news to read a result in full, which provides clear context for when to use it. It doesn't explicitly state when not to use it or name alternatives, but the sibling context and the 'after search' guidance make the intended workflow clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

web_search_newsA

Search news articles via SearXNG's news vertical. Supports a freshness filter (day/week/month/year) and an optional language code. Returns the same result shape as web_search.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes
pagenoNo
languageNoall
safesearchNo
time_rangeNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the burden. It discloses the freshness filter and language code, and notes the result shape matches web_search. However, it doesn't disclose pagination behavior, safesearch semantics, or any rate limits/errors. The description adds some behavioral context but not rich detail.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences with no waste. The core purpose is front-loaded, the key filters are mentioned, and the result-shape reference to web_search is a useful pointer. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has an output schema, so return values are covered elsewhere. The description covers the news vertical, freshness filter, language, and result shape. It doesn't mention pagination or safesearch, but those are in the schema with defaults. For a search tool with an output schema, this is nearly complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It mentions time_range and language, but not pageno or safesearch. The description adds meaning for two of five parameters, but the schema already provides titles and defaults for all. Baseline 3 is appropriate because the description adds some value but doesn't fully compensate for the 0% coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb ('Search'), resource ('news articles'), and engine vertical ('SearXNG's news vertical'), and distinguishes itself from the sibling web_search by naming the news vertical and the freshness filter. An agent can tell this apart from web_search without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use this tool: when news articles are needed, and it references the sibling web_search for the result shape. It doesn't explicitly state when not to use it or name alternatives beyond the shape reference, but the news-vertical framing gives clear context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 3 tool updatesv0.1.0
    • First observedweb_extract
    • First observedweb_search
    • First observedweb_search_news

TDQS

A4.2/5.0

Scored across 3 tools

Disambiguation4/5

web_search and web_search_news overlap somewhat, but web_search_news is clearly scoped to time-filtered news while web_search covers general/vertical search. web_extract is completely distinct, so an agent should be able to choose correctly with the descriptions.

Naming Consistency4/5

web_search and web_search_news follow a clear web_search[_modifier] pattern, and web_extract is also snake_case and readable. The slight inconsistency is that web_extract uses a different verb style than the web_search* tools, but the overall naming is predictable.

Tool Count5/5

Three tools is a well-scoped set for a search-focused MCP server: general search, news search, and page extraction. Each tool serves a distinct need without unnecessary bloat.

Completeness5/5

The server covers the core search workflow: searching the web, searching news with time filters, and extracting page content for deeper reading. SearXNG categories are exposed via web_search, so verticals like images or videos are also reachable, leaving no obvious dead ends.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Integrates with SearXNG metasearch engine to provide powerful web search capabilities across multiple search engines with filtering options for categories, languages, time ranges, and safe search levels. Enables comprehensive web searches, autocomplete suggestions, and search engine configuration access through MCP-compatible applications.
    4
    1
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables privacy-focused web search via SearXNG for MCP clients, allowing users to perform searches with customizable parameters through natural language.
    1,791 npm
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides a free web search tool to MCP clients by connecting to a self-hosted SearXNG metasearch instance, enabling users to search the web with customizable parameters like categories and time range.
    -