feat: add timeout configuration for outgoing HTTP requests and update documentation

This commit is contained in:
Hans Aschauer 2026-05-18 07:33:07 +02:00
parent 3ebd7c5e4a
commit 8288787b4e
4 changed files with 99 additions and 20 deletions

View file

@ -8,8 +8,8 @@ Built with [FastMCP](https://github.com/prefecthq/fastmcp).
| 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. |
| `search` | Tool | Query the web via SearxNG. Supports categories, engines, language, time range, safe search, pagination, and per-call timeout overrides. |
| `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, in-memory caching, and per-call timeout overrides. |
| `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
@ -37,14 +37,20 @@ cp .env.example .env
`.env`:
```dotenv
SEARXNG_BASE_URL=http://localhost:8080
SEARXNG_REQUEST_TIMEOUT_SECONDS=30
```
All settings can also be provided as environment variables with the `SEARXNG_` prefix:
```bash
export SEARXNG_BASE_URL=http://localhost:8080
export SEARXNG_REQUEST_TIMEOUT_SECONDS=30
```
Timeout behavior:
- `SEARXNG_REQUEST_TIMEOUT_SECONDS` sets the default timeout for outgoing HTTP calls.
- `search`, `fetch`, `fetch_raw`, and `web://fetch` accept optional `timeout_seconds` to override the default for a single call.
## Starting the server
### stdio (default — for use with MCP clients like Claude Desktop)