AI News HubLIVE
In-site rewrite5 min read

Show HN: Standalone SearXNG CLI+MCP (no server needed)

SearXNG AI Kit is an AI-enhanced command-line interface, Python library, and MCP server for the SearXNG privacy-respecting metasearch engine, supporting over 180 search engines with standalone binaries available for Linux and macOS.

SourceHacker News AIAuthor: nikvdp

Notifications You must be signed in to change notification settings

Fork 0

Star 0

BranchesTags

Open more actions menu

Folders and files

NameName

Last commit message

Last commit date

Latest commit

History

161 Commits

161 Commits

.github/workflows

.github/workflows

examples

examples

searx

searx

searxng

searxng

tests

tests

.envrc

.envrc

.gitignore

.gitignore

AGENTS.md

AGENTS.md

BUILD.md

BUILD.md

Makefile

Makefile

README.md

README.md

build_searxng_wheel.py

build_searxng_wheel.py

clean.sh

clean.sh

dev-setup.py

dev-setup.py

entitlements.plist

entitlements.plist

generate_config.py

generate_config.py

pyproject.toml

pyproject.toml

pyproject.toml.template

pyproject.toml.template

requirements.txt

requirements.txt

requirements.txt.template

requirements.txt.template

searxng.spec

searxng.spec

searxng_cli.py

searxng_cli.py

setup.py

setup.py

test-macos-build.sh

test-macos-build.sh

uv.lock

uv.lock

Repository files navigation

AI-powered search for your terminal, code, and AI assistants

An AI-enhanced command-line interface, Python library, and MCP server for the SearXNG privacy-respecting metasearch engine. Research topics with AI assistance, search the web from your terminal, integrate into Python projects, or connect AI assistants with support for 180+ search engines.

Features

🔍 CLI tool - Search from your terminal with AI-enhanced research capabilities

🤖 AI chat - Ask questions and get comprehensive research using 180+ search engines

🐍 Python library - Programmatic search and AI-powered content retrieval

🔌 MCP server - AI assistant integration with advanced research tools

📦 Standalone binaries - Pre-built executables for Linux and macOS

Installation

Download a Standalone Binary (Recommended)

The recommended install path is to download the pre-built binary for your platform from the GitHub releases page.

The source install path has to build and vendor a pinned SearXNG wheel before the CLI can run, so it is slower and more involved than a normal uv tool install. Use the binary unless you are developing the project or intentionally updating the pinned upstream SearXNG version.

Release binaries are currently published for Linux and macOS. Windows binaries are disabled for now because the current pybin Windows package launcher is not native yet.

After downloading, make the binary executable and put it somewhere on your PATH:

chmod +x searxng-ai-kit-* ./searxng-ai-kit-* --help

Install from Source with uv (Advanced)

Use this path when you want to develop the project, inspect the vendored SearXNG build, or update the pinned SearXNG commit.

Prerequisites:

Python 3.11+

uv

On macOS and Linux

curl -LsSf https://astral.sh/uv/install.sh | sh

git clone https://github.com/nikvdp/searxng-ai-kit cd searxng-ai-kit

Build the pinned SearXNG wheel and set up the local environment

uv run python dev-setup.py

Install as a uv tool

uv tool install .

Verify

searxng --help

Development Setup

Clone and set up for development

git clone https://github.com/nikvdp/searxng-ai-kit cd searxng-ai-kit

Build SearXNG wheel, generate configs, sync dependencies

python dev-setup.py

Test

uv run searxng search "test" --engines duckduckgo

The build system automatically:

Installs Python 3.11+ via uv

Builds SearXNG wheel with proper dependency isolation

Handles modern type annotations (str | Exception)

Generates local configuration files

Usage Examples

Basic Search

Simple search with default engines

searxng search "python tutorial"

Search with specific engines

searxng search "machine learning" --engines duckduckgo,startpage

Search in specific category

searxng search "neural networks" --category science

Engine Management

List all available engines (compact overview)

searxng engines

List common engines only (clean 4-column layout)

searxng engines --common

List engines in specific category

searxng engines --category general

List only common engines in a category

searxng engines --category general --common

Search while disabling specific engines

searxng search "web development" --disable google,bing

Output Formats

Human-readable output (default)

searxng search "AI research"

JSON output for scripting

searxng search "data science" --format json

JSON output with specific engines

searxng search "rust programming" --engines duckduckgo --format json > results.json

Advanced Options

Search with language preference

searxng search "tutorial python" --lang fr

Search with safe search enabled

searxng search "programming" --safe 1

Search recent results only

searxng search "tech news" --time week --category news

Search specific page

searxng search "javascript" --page 2

URL Content Retrieval

Fetch content from a single URL

searxng fetch-urls "https://example.com"

Fetch content from multiple URLs in parallel

searxng fetch-urls "https://site1.com" "https://site2.com" "https://site3.com"

Human-readable output (default)

searxng fetch-urls "https://example.com"

JSON output for scripting

searxng fetch-urls "https://docs.python.org" --format json > content.json

Control concurrency for rate limiting

searxng fetch-urls url1 url2 url3 --concurrent 2

Browse Available Options

List all search categories

searxng categories

Get help for any command

searxng search --help searxng engines --help

Available Categories

general - General web search (51 engines)

images - Image search (34 engines)

videos - Video search (29 engines)

news - News search (18 engines)

science - Scientific publications (9 engines)

it - IT/Programming resources (44 engines)

music - Music search (10 engines)

files - File search (17 engines)

maps - Map search (3 engines)

And many more...

Common Engines

⭐ Most Popular:

duckduckgo - Privacy-focused search

startpage - Google results without tracking

brave - Independent search index

google - Google search

bing - Microsoft search

qwant - European search engine

Testing the CLI

Test Basic Functionality

Test categories listing

uv run searxng categories

Or: searxng categories

Test clean engine listing (shows popular engines in 4 columns)

uv run searxng engines --common

Or: searxng engines --common

Test engine overview (compact category summary)

uv run searxng engines

Or: searxng engines

Test simple search

uv run searxng search "test query" --engines duckduckgo

Or: searxng search "test query" --engines duckduckgo

Test Different Output Formats

Test human-readable output

uv run searxng search "python" --engines duckduckgo | head -20

Or: searxng search "python" --engines duckduckgo | head -20

Test JSON output

uv run searxng search "programming" --engines duckduckgo --format json | jq .

Or: searxng search "programming" --engines duckduckgo --format json | jq .

Test Multiple Engines

Test with multiple engines

uv run searxng search "web development" --engines duckduckgo,startpage

Or: searxng search "web development" --engines duckduckgo,startpage

Test engine filtering

uv run searxng search "javascript" --category general --disable google,bing

Or: searxng search "javascript" --category general --disable google,bing

Test Categories

Test different categories

uv run searxng search "machine learning" --category science --engines arxiv

Or: searxng search "machine learning" --category science --engines arxiv

uv run searxng search "react tutorial" --category it --engines github

Or: searxng search "react tutorial" --category it --engines github

uv run searxng search "funny cats" --category images --engines duckduckgo_images

Or: searxng search "funny cats" --category images --engines duckduckgo_images

Building Executable (Optional)

To create a standalone executable:

Sync development dependencies (includes PyInstaller)

uv sync

Build with PyInstaller (no code signing)

uv run pyinstaller searxng.spec

Test the executable

./dist/searxng --help ./dist/searxng search "test" --engines duckduckgo

Code Signing (macOS only)

For distribution on macOS, you can optionally enable code signing if you have a valid Developer ID certificate:

Set environment variables for code signing

export PYINSTALLER_CODESIGN_IDENTITY="Developer ID Application: Your Name" export PYINSTALLER_ENTITLEMENTS_FILE="entitlements.plist" # optional

Build with code signing

uv run pyinstaller searxng.spec

Note: The executable may have some engine loading issues. The Python version is recommended for full functionality.

AI Assistant Integration

SearXNG AI Kit includes an AI assistant feature that combines web search capabilities with powerful language models. The assistant can perform parallel searches and fetch content from multiple URLs to provide comprehensive research and answers.

Ask Command (One-Shot Q&A)

Ask a question using the default model

searxng ask "What are the latest developments in quantum computing?"

Use a model from the registry

searxng ask "Research renewable energy trends" --model "opencode/big-pickle"

Use a LiteLLM model string directly

searxng ask "Explain AI" --model "openai/gpt-4o-mini"

Get JSON output for programmatic use

searxng ask "Compare Python vs JavaScript" --format json

Read prompt from stdin for longer questions

echo "Analyze the current state of renewable energy adoption globally, including recent policy changes and technological breakthroughs" | searxng ask

Interactive stdin mode

searxng ask

(then type your question and press Ctrl+D)

Pipe from file

searxng ask /dev/null

Use JSON format for programmatic usage

Example Scripts

Search and save results

#!/bin/bash query="$1" searxng search "$query" --format json --engines duckduckgo,startpage > "results_$(date +%Y%m%d_%H%M%S).json"

Quick search function for .bashrc

search() { searxng search "$*" --engines duckduckgo 2>/dev/null }

Python Library Usage

SearXNG AI Kit can also be used as a Python library in your projects:

import searxng

Basic search

results = searxng.search("python tutorial", max_results=10) print(f"Found {results['total_results']} results")

Fetch URL content

content = searxng.fetch_url("https://example.com") if content["success"]: print(f"Title: {content['title']}")

Ask AI assistant with web search access

response = searxng.ask("What are the latest developments in quantum computing?") if response["success"]: print(response["response"])

Ask with custom model

response = searxng.ask( "Research renewable energy trends", model="openrouter/openai/gpt-4o-mini" )

Parallel URL fetching

urls = ["https://site1.com", "https://site2.com"] contents = searxng.fetch_urls(urls, max_concurrent=3)

Using client with defaults

client = searxng.SearXNGClient( default_engines=["duckduckgo", "startpage"], default_max_results=15 ) results = client.search("machine learning") ai_response = client.ask("Explain machine learning basics")

Library API

searxng.search(query, **kwargs) - Web search with customizable parameters

searxng.fetch_url(url) - Extract content from single URL

searxng.fetch_urls(urls, max_concurrent=5) - Parallel URL content extraction

searxng.ask(prompt, model="openai/o3", base_url=None) - AI assistant with web search tools

searxng.get_available_engines() - Get engine information

searxng.get_categories() - Get search categories

searxng.SearXNGClient(**defaults) - Client class with reusable settings

All functions have async variants (search_async, fetch_url_async, ask_async, etc.).

License

This CLI tool uses SearXNG, which is licensed under AGPL-3.0. See the main repository for full license details.

About

Standalone SearXNG CLI for coding agents

Topics

python

mcp

opencode

pyinstaller

ai-agents

searxng

model-context-protocol

model-context-protocol-servers

searxng-mcp

pi-coding-agent

Resources

Readme

Uh

[truncated for AI cost control]