An [MCP](https://modelcontextprotocol.io/) server that exposes [SearxNG](https://searxng.github.io/searxng/) web search as tools for AI assistants and agents.
Built with [FastMCP](https://github.com/prefecthq/fastmcp).
## What it provides
| Name | Type | Description |
|------|------|-------------|
| `search` | Tool | Query the web via SearxNG. Supports categories, engines, language, time range, safe search, and pagination. |
| `fetch` | Tool | Fetch a URL and extract its main content (strips ads, navigation, boilerplate). Returns a preview with `total_chars` and `truncated` metadata. Supports `start`/`end` slicing, `max_chars`, multiple output formats, and in-memory caching. |
| `web://fetch{?url,...}` | Resource | Read an arbitrary character slice of a fetched page without going through the tool call. Useful for paging through large documents. |
## Requirements
- Python 3.14+
- [`uv`](https://docs.astral.sh/uv/) (recommended) or `pip`
- A running SearxNG instance (see below)
## Installation
```bash
git clone <repo-url>
cd searxng-mcp
uv sync
```
## Configuration
Copy `.env.example` to `.env` and set your SearxNG instance URL:
```bash
cp .env.example .env
```
`.env`:
```dotenv
SEARXNG_BASE_URL=http://localhost:8080
```
All settings can also be provided as environment variables with the `SEARXNG_` prefix:
```bash
export SEARXNG_BASE_URL=http://localhost:8080
```
## Starting the server
### stdio (default — for use with MCP clients like Claude Desktop)
```bash
uv run searxng-mcp
# or equivalently:
uv run python -m searxng_mcp
```
### HTTP transport (for use with remote MCP clients or mcp-forge)
```bash
uv run searxng-mcp --transport http --host 127.0.0.1 --port 8023
```
### SSE transport
```bash
uv run searxng-mcp --transport sse --host 127.0.0.1 --port 8023