A minimal CLI that wraps SearXNG's search API. Designed for LLM agents (Claude Code, etc.) but works fine for humans too.
- Markdown bullets by default, source, title, and summary without JSON noise
--jsonflag for structured output when needed- Single binary, zero dependencies (Go stdlib only)
- Go 1.21+ (build only)
- A running SearXNG instance (setup guide)
go install github.com/stardust/sx@latestOr build from source:
git clone https://github.com/stardust/sx
cd sx
go build -o sx .
cp sx ~/.local/bin/Point sx at your SearXNG instance:
# Option 1: Environment variable (recommended for agents)
export SX_URL=https://your-searxng-instance.com
# Option 2: Config file
sx config set url https://your-searxng-instance.comSX_URL takes priority over the config file.
Search is the default action, no subcommand needed.
sx "rust async patterns" # basic search
sx "query" -n 5 # limit results
sx "query" -e google # specific engines
sx "query" -c news # news category
sx "query" -t week # last week only
sx "query" -l en # English results
sx "query" -p 2 # page 2
sx "site:github.com searxng" -e google # site-scoped| Flag | Description | Default |
|---|---|---|
-n |
Max results | 10 |
-e |
Engines (comma-separated) | instance default |
-c |
Category | general |
-l |
Language code | instance default |
-p |
Page number | 1 |
-t |
Time range: day, week, month, year | none |
-s |
Safe search: 0/1/2 | 0 |
--json |
JSON output | off |
--human |
Alias for default Markdown output | off |
Markdown bullets to stdout by default.
$ sx "test" -n 2
- [Test Result Title](https://example.com)
example.com | published: 2026-03-30
Description of the result...
- [Another Result](https://example.org)
example.org
Another description...Use --json for compact structured output.
$ sx "test" -n 2 --json
{"query":"test","results":[{"url":"https://...","title":"...","content":"...","engines":["google","brave"],"score":4.0},{"url":"https://...","title":"...","content":"...","engines":["duckduckgo"],"score":2.5}],"suggestions":["related query"]}Each result contains only what matters:
| Field | Description |
|---|---|
url |
The link |
title |
Page title |
content |
Snippet / abstract |
engines |
Which engines found it |
score |
Composite relevance score |
published |
Publish date (omitted if unavailable) |
Top-level response also includes answers (direct answers), suggestions (related queries), and corrections (spelling fixes), all omitted when empty.
--human remains available as an alias for the default readable output:
$ sx "test" -n 2 --human
- [Test Result Title](https://example.com)
example.com
Description of the result...
- [Another Result](https://example.org)
example.org
Another description...
Suggestions: related query, another suggestionsx engines # list available search engines
sx categories # list available categories
sx config # show current config
sx config set url <url> # set SearXNG instance URL
sx help # full command referencesx is designed for agent consumption:
- Markdown by default - directly readable by humans and agents
- JSON on demand - use
--jsonwhen structured output is actually needed - Only useful fields - url, title, content, engines, score, published. No template names, parsed URLs, image placeholders, or other noise from the raw SearXNG response.
- Direct answers - factual queries return an
answersarray (e.g. "speed of light = 299,792,458 m/s") - Structured errors -
{"error":"message"}to stderr, exit code 1 - Suggestions - related queries for follow-up searches
Requires a running SearXNG instance:
export SX_URL=https://your-instance.com
bash test.shMIT