mcp-searxng 0.9.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +78 -11
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/proxy.d.ts +27 -4
- package/dist/proxy.js +99 -5
- package/dist/search.js +2 -2
- package/dist/url-reader.js +10 -2
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -49,12 +49,29 @@ An [MCP server](https://modelcontextprotocol.io/introduction) implementation tha
|
|
|
49
49
|
- Example: `https://search.example.com`
|
|
50
50
|
|
|
51
51
|
#### Optional
|
|
52
|
-
- **`AUTH_USERNAME`** / **`AUTH_PASSWORD`**: HTTP Basic Auth credentials for password-protected instances
|
|
53
|
-
- **`USER_AGENT`**:
|
|
54
|
-
- **`
|
|
52
|
+
- **`AUTH_USERNAME`** / **`AUTH_PASSWORD`**: HTTP Basic Auth credentials for `searxng_web_search` (password-protected SearXNG instances)
|
|
53
|
+
- **`USER_AGENT`**: Global default User-Agent header used by both `searxng_web_search` and `web_url_read` (e.g., `MyBot/1.0`)
|
|
54
|
+
- **`URL_READER_USER_AGENT`**: Custom User-Agent specifically for the `web_url_read` tool (overrides `USER_AGENT` for URL reading requests)
|
|
55
|
+
- **`HTTP_PROXY`** / **`HTTPS_PROXY`**: Global proxy URLs for routing traffic (fallback for both interfaces)
|
|
55
56
|
- Format: `http://[username:password@]proxy.host:port`
|
|
56
57
|
- **`NO_PROXY`**: Comma-separated bypass list (e.g., `localhost,.internal,example.com`)
|
|
57
58
|
|
|
59
|
+
##### Interface-Specific Proxies (Optional)
|
|
60
|
+
- **`SEARCH_HTTP_PROXY`** / **`SEARCH_HTTPS_PROXY`**: Proxy for `searxng_web_search` tool only
|
|
61
|
+
- **`URL_READER_HTTP_PROXY`** / **`URL_READER_HTTPS_PROXY`**: Proxy for `web_url_read` tool only
|
|
62
|
+
- These take priority over `HTTP_PROXY`/`HTTPS_PROXY` for their respective interfaces
|
|
63
|
+
|
|
64
|
+
#### Advanced Configuration
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Separate proxies for search and URL reading
|
|
68
|
+
SEARCH_HTTP_PROXY=http://search-proxy:8080
|
|
69
|
+
URL_READER_HTTP_PROXY=http://reader-proxy:8080
|
|
70
|
+
|
|
71
|
+
# Custom user_agent for URL reader
|
|
72
|
+
URL_READER_USER_AGENT="Mozilla/5.0 (compatible; Bot/1.0)"
|
|
73
|
+
```
|
|
74
|
+
|
|
58
75
|
## Installation & Configuration
|
|
59
76
|
|
|
60
77
|
### [NPX](https://www.npmjs.com/package/mcp-searxng)
|
|
@@ -87,8 +104,11 @@ An [MCP server](https://modelcontextprotocol.io/introduction) implementation tha
|
|
|
87
104
|
"AUTH_USERNAME": "your_username",
|
|
88
105
|
"AUTH_PASSWORD": "your_password",
|
|
89
106
|
"USER_AGENT": "MyBot/1.0",
|
|
90
|
-
"
|
|
91
|
-
"
|
|
107
|
+
"URL_READER_USER_AGENT": "Mozilla/5.0 (compatible; MyBot/1.0)",
|
|
108
|
+
"SEARCH_HTTP_PROXY": "http://search-proxy.company.com:8080",
|
|
109
|
+
"URL_READER_HTTP_PROXY": "http://reader-proxy.company.com:8080",
|
|
110
|
+
"HTTP_PROXY": "http://global-proxy.company.com:8080",
|
|
111
|
+
"HTTPS_PROXY": "http://global-proxy.company.com:8080",
|
|
92
112
|
"NO_PROXY": "localhost,127.0.0.1,.local,.internal"
|
|
93
113
|
}
|
|
94
114
|
}
|
|
@@ -132,15 +152,17 @@ npm install -g mcp-searxng
|
|
|
132
152
|
"AUTH_USERNAME": "your_username",
|
|
133
153
|
"AUTH_PASSWORD": "your_password",
|
|
134
154
|
"USER_AGENT": "MyBot/1.0",
|
|
135
|
-
"
|
|
136
|
-
"
|
|
155
|
+
"URL_READER_USER_AGENT": "Mozilla/5.0 (compatible; MyBot/1.0)",
|
|
156
|
+
"SEARCH_HTTP_PROXY": "http://search-proxy.company.com:8080",
|
|
157
|
+
"URL_READER_HTTP_PROXY": "http://reader-proxy.company.com:8080",
|
|
158
|
+
"HTTP_PROXY": "http://global-proxy.company.com:8080",
|
|
159
|
+
"HTTPS_PROXY": "http://global-proxy.company.com:8080",
|
|
137
160
|
"NO_PROXY": "localhost,127.0.0.1,.local,.internal"
|
|
138
161
|
}
|
|
139
162
|
}
|
|
140
163
|
}
|
|
141
164
|
}
|
|
142
165
|
```
|
|
143
|
-
|
|
144
166
|
</details>
|
|
145
167
|
|
|
146
168
|
### Docker
|
|
@@ -183,6 +205,11 @@ docker pull isokoliuk/mcp-searxng:latest
|
|
|
183
205
|
"-e", "AUTH_USERNAME",
|
|
184
206
|
"-e", "AUTH_PASSWORD",
|
|
185
207
|
"-e", "USER_AGENT",
|
|
208
|
+
"-e", "URL_READER_USER_AGENT",
|
|
209
|
+
"-e", "SEARCH_HTTP_PROXY",
|
|
210
|
+
"-e", "SEARCH_HTTPS_PROXY",
|
|
211
|
+
"-e", "URL_READER_HTTP_PROXY",
|
|
212
|
+
"-e", "URL_READER_HTTPS_PROXY",
|
|
186
213
|
"-e", "HTTP_PROXY",
|
|
187
214
|
"-e", "HTTPS_PROXY",
|
|
188
215
|
"-e", "NO_PROXY",
|
|
@@ -193,8 +220,11 @@ docker pull isokoliuk/mcp-searxng:latest
|
|
|
193
220
|
"AUTH_USERNAME": "your_username",
|
|
194
221
|
"AUTH_PASSWORD": "your_password",
|
|
195
222
|
"USER_AGENT": "MyBot/1.0",
|
|
196
|
-
"
|
|
197
|
-
"
|
|
223
|
+
"URL_READER_USER_AGENT": "Mozilla/5.0 (compatible; MyBot/1.0)",
|
|
224
|
+
"SEARCH_HTTP_PROXY": "http://search-proxy.company.com:8080",
|
|
225
|
+
"URL_READER_HTTP_PROXY": "http://reader-proxy.company.com:8080",
|
|
226
|
+
"HTTP_PROXY": "http://global-proxy.company.com:8080",
|
|
227
|
+
"HTTPS_PROXY": "http://global-proxy.company.com:8080",
|
|
198
228
|
"NO_PROXY": "localhost,127.0.0.1,.local,.internal"
|
|
199
229
|
}
|
|
200
230
|
}
|
|
@@ -229,7 +259,10 @@ services:
|
|
|
229
259
|
# - AUTH_USERNAME=your_username
|
|
230
260
|
# - AUTH_PASSWORD=your_password
|
|
231
261
|
# - USER_AGENT=MyBot/1.0
|
|
232
|
-
# -
|
|
262
|
+
# - URL_READER_USER_AGENT=Mozilla/5.0 (compatible; MyBot/1.0)
|
|
263
|
+
# - SEARCH_HTTP_PROXY=http://search-proxy.company.com:8080
|
|
264
|
+
# - URL_READER_HTTP_PROXY=http://reader-proxy.company.com:8080
|
|
265
|
+
# - HTTP_PROXY=http://global-proxy.company.com:8080
|
|
233
266
|
# - HTTPS_PROXY=http://proxy.company.com:8080
|
|
234
267
|
# - NO_PROXY=localhost,127.0.0.1,.local,.internal
|
|
235
268
|
```
|
|
@@ -275,6 +308,40 @@ MCP_HTTP_PORT=3000 SEARXNG_URL=http://localhost:8080 mcp-searxng
|
|
|
275
308
|
curl http://localhost:3000/health
|
|
276
309
|
```
|
|
277
310
|
|
|
311
|
+
## Troubleshooting
|
|
312
|
+
|
|
313
|
+
### 403 Forbidden Error from SearXNG
|
|
314
|
+
|
|
315
|
+
If you receive a `403 Forbidden` error when using `mcp-searxng`, it is likely because your SearXNG instance does not have JSON format enabled. This server requests results in JSON format (`format=json`), which must be explicitly allowed in SearXNG's configuration.
|
|
316
|
+
|
|
317
|
+
**To fix this**, edit your SearXNG `settings.yml` (commonly located at `/etc/searxng/settings.yml`) and add `json` to the list of allowed formats:
|
|
318
|
+
|
|
319
|
+
```yaml
|
|
320
|
+
search:
|
|
321
|
+
formats:
|
|
322
|
+
- html
|
|
323
|
+
- json
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
After saving the file, restart your SearXNG instance. For example, if running with Docker:
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
docker restart searxng
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
You can verify JSON format is working by running:
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
curl 'http://localhost:8080/search?q=test&format=json'
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
You should receive a JSON response. If you still get a 403 error, double-check that:
|
|
339
|
+
- The `settings.yml` file is correctly mounted into your Docker container
|
|
340
|
+
- The YAML indentation is correct
|
|
341
|
+
- The SearXNG instance was fully restarted after the configuration change
|
|
342
|
+
|
|
343
|
+
For more details, see the [SearXNG settings documentation](https://docs.searxng.org/admin/settings/settings.html) and [this discussion](https://github.com/searxng/searxng/discussions/1789).
|
|
344
|
+
|
|
278
345
|
## Running evals
|
|
279
346
|
|
|
280
347
|
```bash
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { createConfigResource, createHelpResource } from "./resources.js";
|
|
|
11
11
|
import { createHttpServer } from "./http-server.js";
|
|
12
12
|
import { validateEnvironment as validateEnv } from "./error-handler.js";
|
|
13
13
|
// Use a static version string that will be updated by the version script
|
|
14
|
-
const packageVersion = "0.
|
|
14
|
+
const packageVersion = "0.10.0";
|
|
15
15
|
// Export the version for use in other modules
|
|
16
16
|
export { packageVersion };
|
|
17
17
|
// Global state for logging level
|
package/dist/proxy.d.ts
CHANGED
|
@@ -1,16 +1,39 @@
|
|
|
1
1
|
import { ProxyAgent } from "undici";
|
|
2
|
+
/**
|
|
3
|
+
* Proxy configuration type for separating search and URL reader proxies.
|
|
4
|
+
*/
|
|
5
|
+
export declare const ProxyType: {
|
|
6
|
+
readonly SEARCH: "search";
|
|
7
|
+
readonly URL_READER: "url_reader";
|
|
8
|
+
};
|
|
9
|
+
export type ProxyType = typeof ProxyType[keyof typeof ProxyType];
|
|
2
10
|
/**
|
|
3
11
|
* Creates a proxy agent dispatcher for Node.js fetch API.
|
|
4
12
|
*
|
|
5
13
|
* Node.js fetch uses Undici under the hood, which requires a 'dispatcher' option
|
|
6
14
|
* instead of 'agent'. This function creates a ProxyAgent compatible with fetch.
|
|
7
15
|
*
|
|
8
|
-
* Environment variables checked (in order):
|
|
9
|
-
* -
|
|
10
|
-
*
|
|
16
|
+
* Environment variables checked (in order, depending on URL protocol):
|
|
17
|
+
* - For type 'search' and HTTPS URLs:
|
|
18
|
+
* SEARCH_HTTPS_PROXY, SEARCH_HTTP_PROXY, search_https_proxy, search_http_proxy,
|
|
19
|
+
* then HTTPS_PROXY, HTTP_PROXY, https_proxy, http_proxy
|
|
20
|
+
* - For type 'search' and HTTP/unknown URLs:
|
|
21
|
+
* SEARCH_HTTP_PROXY, SEARCH_HTTPS_PROXY, search_http_proxy, search_https_proxy,
|
|
22
|
+
* then HTTP_PROXY, HTTPS_PROXY, http_proxy, https_proxy
|
|
23
|
+
* - For type 'url_reader' and HTTPS URLs:
|
|
24
|
+
* URL_READER_HTTPS_PROXY, URL_READER_HTTP_PROXY, url_reader_https_proxy, url_reader_http_proxy,
|
|
25
|
+
* then HTTPS_PROXY, HTTP_PROXY, https_proxy, http_proxy
|
|
26
|
+
* - For type 'url_reader' and HTTP/unknown URLs:
|
|
27
|
+
* URL_READER_HTTP_PROXY, URL_READER_HTTPS_PROXY, url_reader_http_proxy, url_reader_https_proxy,
|
|
28
|
+
* then HTTP_PROXY, HTTPS_PROXY, http_proxy, https_proxy
|
|
29
|
+
* - For no specific type and HTTPS URLs:
|
|
30
|
+
* HTTPS_PROXY, HTTP_PROXY, https_proxy, http_proxy
|
|
31
|
+
* - For no specific type and HTTP/unknown URLs:
|
|
32
|
+
* HTTP_PROXY, HTTPS_PROXY, http_proxy, https_proxy
|
|
11
33
|
* - NO_PROXY / no_proxy: Comma-separated list of hosts to bypass proxy
|
|
12
34
|
*
|
|
13
35
|
* @param targetUrl - Optional target URL to check against NO_PROXY rules
|
|
36
|
+
* @param type - Optional proxy type ('search' or 'url_reader') for separate proxy configs
|
|
14
37
|
* @returns ProxyAgent dispatcher for fetch, or undefined if no proxy configured or bypassed
|
|
15
38
|
*/
|
|
16
|
-
export declare function createProxyAgent(targetUrl?: string): ProxyAgent | undefined;
|
|
39
|
+
export declare function createProxyAgent(targetUrl?: string, type?: ProxyType): ProxyAgent | undefined;
|
package/dist/proxy.js
CHANGED
|
@@ -50,22 +50,116 @@ function shouldBypassProxy(targetUrl) {
|
|
|
50
50
|
}
|
|
51
51
|
return false;
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Proxy configuration type for separating search and URL reader proxies.
|
|
55
|
+
*/
|
|
56
|
+
export const ProxyType = {
|
|
57
|
+
SEARCH: 'search',
|
|
58
|
+
URL_READER: 'url_reader',
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Gets proxy URL for the specified proxy type.
|
|
62
|
+
* Checks type-specific proxy first, then falls back to global proxy.
|
|
63
|
+
*
|
|
64
|
+
* @param type - The type of proxy to get ('search' or 'url_reader')
|
|
65
|
+
* @param targetUrl - Optional target URL whose protocol is used to select between HTTP and HTTPS proxies
|
|
66
|
+
* @returns The proxy URL or undefined if not configured
|
|
67
|
+
*/
|
|
68
|
+
function getProxyUrl(type, targetUrl) {
|
|
69
|
+
let isHttps = false;
|
|
70
|
+
if (targetUrl) {
|
|
71
|
+
try {
|
|
72
|
+
const url = new URL(targetUrl);
|
|
73
|
+
isHttps = url.protocol === 'https:';
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
isHttps = false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (type === ProxyType.SEARCH) {
|
|
80
|
+
if (isHttps) {
|
|
81
|
+
return process.env.SEARCH_HTTPS_PROXY ||
|
|
82
|
+
process.env.SEARCH_HTTP_PROXY ||
|
|
83
|
+
process.env.search_https_proxy ||
|
|
84
|
+
process.env.search_http_proxy ||
|
|
85
|
+
process.env.HTTPS_PROXY ||
|
|
86
|
+
process.env.HTTP_PROXY ||
|
|
87
|
+
process.env.https_proxy ||
|
|
88
|
+
process.env.http_proxy;
|
|
89
|
+
}
|
|
90
|
+
return process.env.SEARCH_HTTP_PROXY ||
|
|
91
|
+
process.env.SEARCH_HTTPS_PROXY ||
|
|
92
|
+
process.env.search_http_proxy ||
|
|
93
|
+
process.env.search_https_proxy ||
|
|
94
|
+
// Fallback to global proxies
|
|
95
|
+
process.env.HTTP_PROXY ||
|
|
96
|
+
process.env.HTTPS_PROXY ||
|
|
97
|
+
process.env.http_proxy ||
|
|
98
|
+
process.env.https_proxy;
|
|
99
|
+
}
|
|
100
|
+
if (type === ProxyType.URL_READER) {
|
|
101
|
+
if (isHttps) {
|
|
102
|
+
return process.env.URL_READER_HTTPS_PROXY ||
|
|
103
|
+
process.env.URL_READER_HTTP_PROXY ||
|
|
104
|
+
process.env.url_reader_https_proxy ||
|
|
105
|
+
process.env.url_reader_http_proxy ||
|
|
106
|
+
process.env.HTTPS_PROXY ||
|
|
107
|
+
process.env.HTTP_PROXY ||
|
|
108
|
+
process.env.https_proxy ||
|
|
109
|
+
process.env.http_proxy;
|
|
110
|
+
}
|
|
111
|
+
return process.env.URL_READER_HTTP_PROXY ||
|
|
112
|
+
process.env.URL_READER_HTTPS_PROXY ||
|
|
113
|
+
process.env.url_reader_http_proxy ||
|
|
114
|
+
process.env.url_reader_https_proxy ||
|
|
115
|
+
// Fallback to global proxies
|
|
116
|
+
process.env.HTTP_PROXY ||
|
|
117
|
+
process.env.HTTPS_PROXY ||
|
|
118
|
+
process.env.http_proxy ||
|
|
119
|
+
process.env.https_proxy;
|
|
120
|
+
}
|
|
121
|
+
if (isHttps) {
|
|
122
|
+
return process.env.HTTPS_PROXY ||
|
|
123
|
+
process.env.HTTP_PROXY ||
|
|
124
|
+
process.env.https_proxy ||
|
|
125
|
+
process.env.http_proxy;
|
|
126
|
+
}
|
|
127
|
+
return process.env.HTTP_PROXY ||
|
|
128
|
+
process.env.HTTPS_PROXY ||
|
|
129
|
+
process.env.http_proxy ||
|
|
130
|
+
process.env.https_proxy;
|
|
131
|
+
}
|
|
53
132
|
/**
|
|
54
133
|
* Creates a proxy agent dispatcher for Node.js fetch API.
|
|
55
134
|
*
|
|
56
135
|
* Node.js fetch uses Undici under the hood, which requires a 'dispatcher' option
|
|
57
136
|
* instead of 'agent'. This function creates a ProxyAgent compatible with fetch.
|
|
58
137
|
*
|
|
59
|
-
* Environment variables checked (in order):
|
|
60
|
-
* -
|
|
61
|
-
*
|
|
138
|
+
* Environment variables checked (in order, depending on URL protocol):
|
|
139
|
+
* - For type 'search' and HTTPS URLs:
|
|
140
|
+
* SEARCH_HTTPS_PROXY, SEARCH_HTTP_PROXY, search_https_proxy, search_http_proxy,
|
|
141
|
+
* then HTTPS_PROXY, HTTP_PROXY, https_proxy, http_proxy
|
|
142
|
+
* - For type 'search' and HTTP/unknown URLs:
|
|
143
|
+
* SEARCH_HTTP_PROXY, SEARCH_HTTPS_PROXY, search_http_proxy, search_https_proxy,
|
|
144
|
+
* then HTTP_PROXY, HTTPS_PROXY, http_proxy, https_proxy
|
|
145
|
+
* - For type 'url_reader' and HTTPS URLs:
|
|
146
|
+
* URL_READER_HTTPS_PROXY, URL_READER_HTTP_PROXY, url_reader_https_proxy, url_reader_http_proxy,
|
|
147
|
+
* then HTTPS_PROXY, HTTP_PROXY, https_proxy, http_proxy
|
|
148
|
+
* - For type 'url_reader' and HTTP/unknown URLs:
|
|
149
|
+
* URL_READER_HTTP_PROXY, URL_READER_HTTPS_PROXY, url_reader_http_proxy, url_reader_https_proxy,
|
|
150
|
+
* then HTTP_PROXY, HTTPS_PROXY, http_proxy, https_proxy
|
|
151
|
+
* - For no specific type and HTTPS URLs:
|
|
152
|
+
* HTTPS_PROXY, HTTP_PROXY, https_proxy, http_proxy
|
|
153
|
+
* - For no specific type and HTTP/unknown URLs:
|
|
154
|
+
* HTTP_PROXY, HTTPS_PROXY, http_proxy, https_proxy
|
|
62
155
|
* - NO_PROXY / no_proxy: Comma-separated list of hosts to bypass proxy
|
|
63
156
|
*
|
|
64
157
|
* @param targetUrl - Optional target URL to check against NO_PROXY rules
|
|
158
|
+
* @param type - Optional proxy type ('search' or 'url_reader') for separate proxy configs
|
|
65
159
|
* @returns ProxyAgent dispatcher for fetch, or undefined if no proxy configured or bypassed
|
|
66
160
|
*/
|
|
67
|
-
export function createProxyAgent(targetUrl) {
|
|
68
|
-
const proxyUrl =
|
|
161
|
+
export function createProxyAgent(targetUrl, type) {
|
|
162
|
+
const proxyUrl = getProxyUrl(type, targetUrl);
|
|
69
163
|
if (!proxyUrl) {
|
|
70
164
|
return undefined;
|
|
71
165
|
}
|
package/dist/search.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createProxyAgent } from "./proxy.js";
|
|
1
|
+
import { createProxyAgent, ProxyType } from "./proxy.js";
|
|
2
2
|
import { logMessage } from "./logging.js";
|
|
3
3
|
import { createConfigurationError, createNetworkError, createServerError, createJSONError, createDataError, createNoResultsMessage } from "./error-handler.js";
|
|
4
4
|
export async function performWebSearch(server, query, pageno = 1, time_range, language = "all", safesearch) {
|
|
@@ -44,7 +44,7 @@ export async function performWebSearch(server, query, pageno = 1, time_range, la
|
|
|
44
44
|
};
|
|
45
45
|
// Add proxy dispatcher if proxy is configured
|
|
46
46
|
// Node.js fetch uses 'dispatcher' option for proxy, not 'agent'
|
|
47
|
-
const proxyAgent = createProxyAgent(url.toString());
|
|
47
|
+
const proxyAgent = createProxyAgent(url.toString(), ProxyType.SEARCH);
|
|
48
48
|
if (proxyAgent) {
|
|
49
49
|
requestOptions.dispatcher = proxyAgent;
|
|
50
50
|
}
|
package/dist/url-reader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NodeHtmlMarkdown } from "node-html-markdown";
|
|
2
|
-
import { createProxyAgent } from "./proxy.js";
|
|
2
|
+
import { createProxyAgent, ProxyType } from "./proxy.js";
|
|
3
3
|
import { logMessage } from "./logging.js";
|
|
4
4
|
import { urlCache } from "./cache.js";
|
|
5
5
|
import { createURLFormatError, createNetworkError, createServerError, createContentError, createConversionError, createTimeoutError, createEmptyContentWarning, createUnexpectedError } from "./error-handler.js";
|
|
@@ -131,10 +131,18 @@ export async function fetchAndConvertToMarkdown(server, url, timeoutMs = 10000,
|
|
|
131
131
|
};
|
|
132
132
|
// Add proxy dispatcher if proxy is configured
|
|
133
133
|
// Node.js fetch uses 'dispatcher' option for proxy, not 'agent'
|
|
134
|
-
const proxyAgent = createProxyAgent(url);
|
|
134
|
+
const proxyAgent = createProxyAgent(url, ProxyType.URL_READER);
|
|
135
135
|
if (proxyAgent) {
|
|
136
136
|
requestOptions.dispatcher = proxyAgent;
|
|
137
137
|
}
|
|
138
|
+
// Add User-Agent header if configured (URL_READER_USER_AGENT takes priority over USER_AGENT)
|
|
139
|
+
const userAgent = process.env.URL_READER_USER_AGENT || process.env.USER_AGENT;
|
|
140
|
+
if (userAgent) {
|
|
141
|
+
requestOptions.headers = {
|
|
142
|
+
...requestOptions.headers,
|
|
143
|
+
'User-Agent': userAgent
|
|
144
|
+
};
|
|
145
|
+
}
|
|
138
146
|
let response;
|
|
139
147
|
try {
|
|
140
148
|
// Fetch the URL with the abort signal
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-searxng",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "MCP server for SearXNG integration",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ihor Sokoliuk (https://github.com/ihor-sokoliuk)",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsc && shx chmod +x dist/*.js",
|
|
38
38
|
"watch": "tsc --watch",
|
|
39
|
-
"test": "SEARXNG_URL=https://test-searx.example.com tsx __tests__/run-all.ts",
|
|
40
|
-
"test:coverage": "SEARXNG_URL=https://test-searx.example.com c8 --reporter=text tsx __tests__/run-all.ts",
|
|
39
|
+
"test": "cross-env SEARXNG_URL=https://test-searx.example.com tsx __tests__/run-all.ts",
|
|
40
|
+
"test:coverage": "cross-env SEARXNG_URL=https://test-searx.example.com c8 --reporter=text tsx __tests__/run-all.ts",
|
|
41
41
|
"bootstrap": "npm install && npm run build",
|
|
42
42
|
"inspector": "DANGEROUSLY_OMIT_AUTH=true npx @modelcontextprotocol/inspector node dist/index.js",
|
|
43
43
|
"postversion": "TAG=$(node scripts/update-version.js | tail -1) && git add src/index.ts && git commit --amend --no-edit && git tag -f $TAG"
|
|
@@ -52,10 +52,11 @@
|
|
|
52
52
|
"undici": "^6.20.1"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"mcp-evals": "^1.0.18",
|
|
56
55
|
"@types/node": "^22.17.2",
|
|
57
56
|
"@types/supertest": "^6.0.3",
|
|
58
57
|
"c8": "^10.1.3",
|
|
58
|
+
"cross-env": "^10.1.0",
|
|
59
|
+
"mcp-evals": "^1.0.18",
|
|
59
60
|
"shx": "^0.4.0",
|
|
60
61
|
"supertest": "^7.1.4",
|
|
61
62
|
"tsx": "^4.20.5",
|