SearXNG Search Skill
Search the web using a SearXNG instance via its API.
Network destinations
Two levels — both matter:
- Direct (this script): the script makes a single request to your
configured
base_url. HTTPS by default; plain HTTP is allowed only
for loopback hosts (127.0.0.1, ::1, localhost) or for non-loopback
hosts if the config contains allow_insecure_http = true (with a
warning). If auth.type is set, the Authorization header travels to
that single host and nowhere else. Redirects are never followed: a
30x response is an error, because following a redirect could forward
the Authorization header to a host you did not configure. Point
base_url directly at the final endpoint (or front the instance
with a same-origin reverse proxy).
- Downstream (your SearXNG instance): the instance then forwards
the query, language, and categories to the engines it
itself has been configured with (Google, Bing, DuckDuckGo, Brave,
Baidu, etc., as enabled by the instance operator). This skill does
not control that hop — it is a property of any SearXNG client. If
query contents reaching the upstream engines is a concern, configure
your instance to use engines you trust, or self-host engines locally.
Configuration issues
This skill depends on a local SearXNG config file. Keep setup details out of this
file and load references/configuration.md only when needed.
If scripts/search.py reports configuration, auth, or instance setup errors,
read references/configuration.md before retrying. Common examples include:
ERROR: Config file not found
ERROR: Invalid TOML ... / ERROR: Invalid JSON ...
ERROR: base_url is required
ERROR: Environment variable ... is not set
ERROR: auth.token required for bearer auth
ERROR: auth.user and auth.pass required for basic auth
ERROR: Unknown auth.type ...
ERROR: HTTP 401 / ERROR: HTTP 403
Usage
Run the search script:
python3 scripts/search.py [OPTIONS] <query>
Options
| Flag |
Description |
-c, --categories |
Comma-separated categories (general, news, images, videos, music, files, it, science, social media) |
-e, --engines |
Comma-separated engines (google, duckduckgo, bing, etc.) |
-l, --language |
Language code (en, zh-CN, ja, etc.) |
-p, --page |
Page number (default: 1) |
-t, --time-range |
Time range: day, month, year |
-n, --max-results |
Max results to show (overrides config default) |
-s, --safesearch |
Safe search: 0 (off), 1 (moderate), 2 (strict) |
Examples
# Basic search
python3 scripts/search.py "SearXNG documentation"
# Search news from the last day
python3 scripts/search.py -c news -t day "latest tech news"
# Search with specific engines, page 2
python3 scripts/search.py -e google,duckduckgo -p 2 "rust programming"
# Search in Chinese with more results
python3 scripts/search.py -l zh-CN -n 10 "开源搜索引擎"
Best Practices
- Technical topics (programming, software, science, IT, etc.): Always use English as both the query language and search language (
-l en), regardless of the user's input language. Translate the query to English if needed. English results are more comprehensive and up-to-date for technical content.
- Chinese lifestyle topics (food, travel, shopping, local services, social trends, etc.): In addition to the default search, run a second search with
-e baidu,sogou -l zh-CN using a Chinese query to capture China-specific results. Merge and deduplicate results before presenting to the user.
Workflow
- User asks to search for something
- Determine the topic type:
- Technical: translate query to English if needed, search with
-l en
- Chinese lifestyle: run the default search first, then an additional search with
-e baidu,sogou -l zh-CN
- Run
scripts/search.py with the query and any relevant filters
- Present results to the user in a readable format
- If user wants more results, use
-p for pagination or -n for more per page
1---2name: searxng-search3description: Search the web using a self-hosted SearXNG instance. Use when users ask to search with SearXNG, or when web search is needed and a SearXNG instance is configured. Supports categories, engines, time range, and language filters.4license: MIT5---67# SearXNG Search Skill89Search the web using a SearXNG instance via its API.1011## Network destinations1213Two levels — both matter:1415- **Direct (this script):** the script makes a single request to your16 configured `base_url`. HTTPS by default; plain HTTP is allowed only17 for loopback hosts (127.0.0.1, ::1, localhost) or for non-loopback18 hosts if the config contains `allow_insecure_http = true` (with a19 warning). If `auth.type` is set, the Authorization header travels to20 that single host and nowhere else. **Redirects are never followed**: a21 30x response is an error, because following a redirect could forward22 the Authorization header to a host you did not configure. Point23 `base_url` directly at the final endpoint (or front the instance24 with a same-origin reverse proxy).25- **Downstream (your SearXNG instance):** the instance then forwards26 the **query**, **language**, and **categories** to the engines it27 itself has been configured with (Google, Bing, DuckDuckGo, Brave,28 Baidu, etc., as enabled by the instance operator). This skill does29 not control that hop — it is a property of any SearXNG client. If30 query contents reaching the upstream engines is a concern, configure31 your instance to use engines you trust, or self-host engines locally.3233## Configuration issues3435This skill depends on a local SearXNG config file. Keep setup details out of this36file and load [references/configuration.md](references/configuration.md) only when needed.3738If `scripts/search.py` reports configuration, auth, or instance setup errors,39read [references/configuration.md](references/configuration.md) before retrying. Common examples include:4041- `ERROR: Config file not found`42- `ERROR: Invalid TOML ...` / `ERROR: Invalid JSON ...`43- `ERROR: base_url is required`44- `ERROR: Environment variable ... is not set`45- `ERROR: auth.token required for bearer auth`46- `ERROR: auth.user and auth.pass required for basic auth`47- `ERROR: Unknown auth.type ...`48- `ERROR: HTTP 401` / `ERROR: HTTP 403`4950## Usage5152Run the search script:5354```bash55python3 scripts/search.py [OPTIONS] <query>56```5758### Options5960| Flag | Description |61|---|---|62| `-c, --categories` | Comma-separated categories (`general`, `news`, `images`, `videos`, `music`, `files`, `it`, `science`, `social media`) |63| `-e, --engines` | Comma-separated engines (`google`, `duckduckgo`, `bing`, etc.) |64| `-l, --language` | Language code (`en`, `zh-CN`, `ja`, etc.) |65| `-p, --page` | Page number (default: 1) |66| `-t, --time-range` | Time range: `day`, `month`, `year` |67| `-n, --max-results` | Max results to show (overrides config default) |68| `-s, --safesearch` | Safe search: `0` (off), `1` (moderate), `2` (strict) |6970### Examples7172```bash73# Basic search74python3 scripts/search.py "SearXNG documentation"7576# Search news from the last day77python3 scripts/search.py -c news -t day "latest tech news"7879# Search with specific engines, page 280python3 scripts/search.py -e google,duckduckgo -p 2 "rust programming"8182# Search in Chinese with more results83python3 scripts/search.py -l zh-CN -n 10 "开源搜索引擎"84```8586## Best Practices8788- **Technical topics** (programming, software, science, IT, etc.): Always use **English** as both the query language and search language (`-l en`), regardless of the user's input language. Translate the query to English if needed. English results are more comprehensive and up-to-date for technical content.89- **Chinese lifestyle topics** (food, travel, shopping, local services, social trends, etc.): In addition to the default search, run a **second search** with `-e baidu,sogou -l zh-CN` using a Chinese query to capture China-specific results. Merge and deduplicate results before presenting to the user.9091## Workflow92931. User asks to search for something942. Determine the topic type:95 - **Technical**: translate query to English if needed, search with `-l en`96 - **Chinese lifestyle**: run the default search first, then an additional search with `-e baidu,sogou -l zh-CN`973. Run `scripts/search.py` with the query and any relevant filters984. Present results to the user in a readable format995. If user wants more results, use `-p` for pagination or `-n` for more per page