SearXNG Private Web Search for you and your agents

SearXNG is a self-hosted metasearch engine that lets you run private web search on your own machine. For local AI workflows, it pairs especially well with coding agents and local model hosts because it exposes a simple JSON search API.

plebdevs.com

March 20, 2026 · 7 min read

Index#

Overview#

What it is. SearXNG is a metasearch engine that aggregates results from other search engines without storing user information or building profiles. It is a strong fit for privacy-conscious AI workflows because you can run it yourself and expose JSON search results to local tools. (SearXNG, SearXNG)

How this fits the stack

That means there is no special "SearXNG-to-Ollama" integration by itself. The common pattern is: agent uses Ollama for inference and SearXNG for web search. (SearXNG, Goose Custom Extensions, OpenCode MCP)

Why this setup works


Setup#

1) Create config directory and settings.yml#

Create the config directory and a minimal settings.yml before starting the container. This keeps defaults, enables JSON output for MCP integrations, and binds to all container interfaces so Docker port-forwarding works. The settings docs show use_default_settings plus server secret_key, and the search settings list default formats (HTML only by default). (SearXNG, SearXNG, SearXNG)

mkdir -p ./searxng/config/ ./searxng/data/
cat > ./searxng/config/settings.yml << 'EOF'
use_default_settings: true

search:
  # Enable JSON output for /search?format=json
  formats:
    - html
    - json

server:
  # Bind to all interfaces so Docker port-forwarding works
  # (host-side restriction is handled by -p 127.0.0.1:8080:8080)
  bind_address: "0.0.0.0"
  # Change this before exposing beyond localhost
  secret_key: "change-me-please"
EOF

2) Run a local container#

The official container guide documents Docker-based setup; here is a minimal local example that binds to localhost:8080 and persists config/cache to local volumes. (SearXNG)

cd ./searxng/

docker run --name searxng -d \
  -p 127.0.0.1:8080:8080 \
  -v "./config/:/etc/searxng/" \
  -v "./data/:/var/cache/searxng/" \
  docker.io/searxng/searxng:latest

3) Verify the search API#

The Search API supports format=json when json is present in search.formats. (SearXNG, SearXNG)

curl "http://localhost:8080/search?q=searxng&format=json"

4) Optional: start Ollama locally#

If you want a full local stack, start Ollama so Goose or OpenCode can use local models while SearXNG handles search.

ollama serve
ollama pull qwen3.5:3b

Quick checks:

curl http://localhost:11434/api/version
ollama ls

5) Connect Goose to SearXNG#

Goose supports custom MCP extensions, which makes SearXNG straightforward to add as a local search tool. (Goose Custom Extensions)

Start the MCP server:

npx mcp-searxng

Add a Custom Extension in Goose with:

# Extension command
npx mcp-searxng

# Extension env
SEARXNG_URL=http://localhost:8080

If you also want Goose to use Ollama for inference:

export GOOSE_PROVIDER=ollama
export OLLAMA_HOST=http://localhost:11434
export GOOSE_MODEL=qwen3.5:3b
goose session --name private-search

6) Connect OpenCode to SearXNG#

OpenCode supports MCP servers for tools and OpenAI-compatible providers for local inference. That makes SearXNG + Ollama + OpenCode a clean single-machine workflow. (OpenCode MCP, OpenCode Config, OpenCode Providers)

Add the SearXNG MCP server and optional Ollama provider to ~/.config/opencode/opencode.json or a project-local ./opencode.json:

{ "$schema": "https://opencode.ai/config.json", "provider": { "ollama": { "npm": "@ai-sdk/openai-compatible", "name": "Ollama (local)", "options": { "baseURL": "http://localhost:11434/v1" }, "models": { "qwen3.5:3b": { "name": "Qwen 3.5 3B (local)" } } } }, "model": "ollama/qwen3.5:3b", "small_model": "ollama/qwen3.5:3b", "mcp": { "searxng": { "type": "local", "command": ["uvx", "mcp-searxng"], "enabled": true, "environment": { "SEARXNG_URL": "http://localhost:8080" } } }, "tools": { "websearch": false } }

This tells OpenCode to use Ollama for model calls, SearXNG for web search, and the built-in hosted websearch tool stays off.


Beginner usage#


Pro usage#


Cost savings guide#


Privacy guide#


Security guide#


Appendix#

Minimal settings.yml

use_default_settings: true

search:
  formats:
    - html
    - json

server:
  bind_address: "0.0.0.0"
  secret_key: "change-me-please"

Quick checklist

Two common local stacks

# Goose + Ollama + SearXNG
ollama serve
npx mcp-searxng
goose session --name private-search
# OpenCode + Ollama + SearXNG
ollama serve
opencode

#ai#document#privacy
0

Written by

FREE Adversarial AI Course out now on plebdevs.com 🤝👩‍💻🤝🧑‍💻🤝👨‍💻🤝

plebdevs@plebdevs.com

Comments0

No comments yet. Start the conversation.