1.6 KiB
1.6 KiB
SearXNG MCP Server
An MCP (Model Context Protocol) server that provides web search via a SearXNG instance.
Setup
python -m venv venv
venv/Scripts/pip install -r requirements.txt # Windows
# or
venv/bin/pip install -r requirements.txt # Linux/macOS
Usage
With Claude Code
Add to your .mcp.json or ~/.claude/settings.json:
{
"mcpServers": {
"searxng": {
"command": "/path/to/venv/bin/python",
"args": ["/path/to/server.py"],
"env": {
"SEARXNG_URL": "http://your-searxng-instance:8080"
}
}
}
}
Standalone
SEARXNG_URL=http://your-searxng-instance:8080 python server.py
Configuration
| Environment Variable | Default | Description |
|---|---|---|
SEARXNG_URL |
http://192.168.50.224:30053 |
Base URL of your SearXNG instance |
Your SearXNG instance must have JSON format enabled in its settings.yml under search.formats.
Tool: web_search
Search the web using SearXNG.
| Parameter | Type | Required | Description |
|---|---|---|---|
query |
string | yes | Search query |
categories |
string | no | Comma-separated: general, images, news, videos, music, files, it, science, social media |
language |
string | no | Language code (e.g. en, de, fr) |
pageno |
int | no | Page number (starting at 1) |
time_range |
string | no | day, week, month, or year |
safesearch |
int | no | 0=off, 1=moderate, 2=strict |
max_results |
int | no | Max results to return (default 10, max 50) |
Tests
pip install pytest pytest-asyncio respx
pytest test_server.py -v