mcp-searxng 1.3.0 → 1.3.2
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 +2 -0
- package/dist/http-server.js +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +1 -4
- package/dist/resources.js +1 -1
- package/dist/search.js +10 -2
- package/dist/types.d.ts +26 -4
- package/dist/version.d.ts +1 -0
- package/dist/version.js +1 -0
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
[](https://www.npmjs.com/package/mcp-searxng)
|
|
10
10
|
[](https://hub.docker.com/r/isokoliuk/mcp-searxng)
|
|
11
11
|
[](LICENSE)
|
|
12
|
+
[](https://scorecard.dev/viewer/?uri=github.com/ihor-sokoliuk/mcp-searxng)
|
|
13
|
+
[](https://www.bestpractices.dev/projects/13143)
|
|
12
14
|
[](https://glama.ai/mcp/servers/ihor-sokoliuk/mcp-searxng)
|
|
13
15
|
|
|
14
16
|
An [MCP server](https://modelcontextprotocol.io/introduction) that integrates the [SearXNG](https://docs.searxng.org) API, giving AI assistants web search capabilities.
|
package/dist/http-server.js
CHANGED
|
@@ -5,7 +5,7 @@ import { randomUUID } from "crypto";
|
|
|
5
5
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
6
6
|
import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
|
|
7
7
|
import { logMessage } from "./logging.js";
|
|
8
|
-
import { packageVersion } from "./
|
|
8
|
+
import { packageVersion } from "./version.js";
|
|
9
9
|
import { getHttpSecurityConfig, isOriginAllowed, isRequestAuthorized, validateHttpSecurityConfig, } from "./http-security.js";
|
|
10
10
|
/**
|
|
11
11
|
* Resolves the bind host from the MCP_HTTP_HOST environment variable.
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -8,10 +8,7 @@ import { performWebSearch } from "./search.js";
|
|
|
8
8
|
import { fetchAndConvertToMarkdown } from "./url-reader.js";
|
|
9
9
|
import { createConfigResource, createHelpResource } from "./resources.js";
|
|
10
10
|
import { createHttpServer, resolveBindHost } from "./http-server.js";
|
|
11
|
-
|
|
12
|
-
const packageVersion = "1.3.0";
|
|
13
|
-
// Export the version for use in other modules
|
|
14
|
-
export { packageVersion };
|
|
11
|
+
import { packageVersion } from "./version.js";
|
|
15
12
|
// Type guard for URL reading args
|
|
16
13
|
export function isWebUrlReadArgs(args) {
|
|
17
14
|
if (typeof args !== "object" ||
|
package/dist/resources.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getCurrentLogLevel } from "./logging.js";
|
|
2
|
-
import { packageVersion } from "./
|
|
2
|
+
import { packageVersion } from "./version.js";
|
|
3
3
|
import { getHttpSecurityConfig } from "./http-security.js";
|
|
4
4
|
export function createConfigResource() {
|
|
5
5
|
const security = getHttpSecurityConfig();
|
package/dist/search.js
CHANGED
|
@@ -60,13 +60,20 @@ export async function performWebSearch(mcpServer, query, pageno = 1, time_range,
|
|
|
60
60
|
'User-Agent': userAgent
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
// Fetch with enhanced error handling
|
|
63
|
+
// Fetch with AbortController timeout and enhanced error handling
|
|
64
|
+
const SEARCH_TIMEOUT_MS = parseInt(process.env.SEARXNG_TIMEOUT_MS ?? "10000", 10);
|
|
65
|
+
const controller = new AbortController();
|
|
66
|
+
const timeoutId = setTimeout(() => controller.abort(), SEARCH_TIMEOUT_MS);
|
|
64
67
|
let response;
|
|
65
68
|
try {
|
|
66
69
|
logMessage(mcpServer, "info", `Making request to: ${url.toString()}`);
|
|
67
|
-
response = await fetch(url.toString(),
|
|
70
|
+
response = await fetch(url.toString(), {
|
|
71
|
+
...requestOptions,
|
|
72
|
+
signal: controller.signal,
|
|
73
|
+
});
|
|
68
74
|
}
|
|
69
75
|
catch (error) {
|
|
76
|
+
clearTimeout(timeoutId);
|
|
70
77
|
logMessage(mcpServer, "error", `Network error during search request: ${error.message}`, { query, url: url.toString() });
|
|
71
78
|
const context = {
|
|
72
79
|
url: url.toString(),
|
|
@@ -76,6 +83,7 @@ export async function performWebSearch(mcpServer, query, pageno = 1, time_range,
|
|
|
76
83
|
};
|
|
77
84
|
throw createNetworkError(error, context);
|
|
78
85
|
}
|
|
86
|
+
clearTimeout(timeoutId);
|
|
79
87
|
if (!response.ok) {
|
|
80
88
|
let responseBody;
|
|
81
89
|
try {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,12 +1,34 @@
|
|
|
1
1
|
import { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
-
export interface
|
|
3
|
-
|
|
2
|
+
export interface SearXNGWebResult {
|
|
3
|
+
title: string;
|
|
4
|
+
content: string;
|
|
5
|
+
url: string;
|
|
6
|
+
score: number;
|
|
7
|
+
engine?: string;
|
|
8
|
+
engines?: string[];
|
|
9
|
+
category?: string;
|
|
10
|
+
publishedDate?: string;
|
|
11
|
+
thumbnail?: string;
|
|
12
|
+
img_src?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface SearXNGWebInfobox {
|
|
15
|
+
infobox: string;
|
|
16
|
+
content?: string;
|
|
17
|
+
urls?: Array<{
|
|
4
18
|
title: string;
|
|
5
|
-
content: string;
|
|
6
19
|
url: string;
|
|
7
|
-
score: number;
|
|
8
20
|
}>;
|
|
9
21
|
}
|
|
22
|
+
export interface SearXNGWeb {
|
|
23
|
+
query: string;
|
|
24
|
+
number_of_results: number;
|
|
25
|
+
results: SearXNGWebResult[];
|
|
26
|
+
suggestions?: string[];
|
|
27
|
+
corrections?: string[];
|
|
28
|
+
answers?: string[];
|
|
29
|
+
infoboxes?: SearXNGWebInfobox[];
|
|
30
|
+
unresponsive_engines?: Array<[string, string]>;
|
|
31
|
+
}
|
|
10
32
|
export declare function isSearXNGWebSearchArgs(args: unknown): args is {
|
|
11
33
|
query: string;
|
|
12
34
|
pageno?: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const packageVersion = "1.3.2";
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const packageVersion = "1.3.2";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-searxng",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"mcpName": "io.github.ihor-sokoliuk/mcp-searxng",
|
|
5
5
|
"description": "MCP server for SearXNG integration",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,12 +39,13 @@
|
|
|
39
39
|
"watch": "tsc --watch",
|
|
40
40
|
"test": "cross-env SEARXNG_URL=https://test-searx.example.com tsx __tests__/run-all.ts",
|
|
41
41
|
"test:coverage": "cross-env SEARXNG_URL=https://test-searx.example.com c8 --reporter=text --exclude 'dist/**' tsx __tests__/run-all.ts",
|
|
42
|
+
"test:e2e": "node --env-file-if-exists=.env.e2e node_modules/.bin/tsx __tests__/e2e/run-e2e.ts",
|
|
42
43
|
"bootstrap": "npm install && npm run build",
|
|
43
44
|
"inspector": "DANGEROUSLY_OMIT_AUTH=true npx @modelcontextprotocol/inspector node dist/cli.js",
|
|
44
45
|
"lint": "eslint src __tests__",
|
|
45
46
|
"audit:deps": "npm audit --audit-level=moderate",
|
|
46
47
|
"security": "npm run lint && npm run audit:deps",
|
|
47
|
-
"postversion": "TAG=$(node scripts/update-version.js | tail -1) && git add src/
|
|
48
|
+
"postversion": "TAG=$(node scripts/update-version.js | tail -1) && git add src/version.ts .mcp/server.json && git commit --amend --no-edit && git tag -f $TAG"
|
|
48
49
|
},
|
|
49
50
|
"dependencies": {
|
|
50
51
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
@@ -54,20 +55,20 @@
|
|
|
54
55
|
"express": "^5.2.1",
|
|
55
56
|
"express-rate-limit": "^8.5.2",
|
|
56
57
|
"node-html-markdown": "^2.0.0",
|
|
57
|
-
"undici": "
|
|
58
|
+
"undici": "7.27.2"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
|
-
"@types/node": "
|
|
61
|
+
"@types/node": "22.19.20",
|
|
61
62
|
"@types/supertest": "^7.2.0",
|
|
62
|
-
"@typescript-eslint/eslint-plugin": "
|
|
63
|
-
"@typescript-eslint/parser": "
|
|
63
|
+
"@typescript-eslint/eslint-plugin": "8.61.0",
|
|
64
|
+
"@typescript-eslint/parser": "8.61.0",
|
|
64
65
|
"c8": "^11.0.0",
|
|
65
66
|
"cross-env": "^10.1.0",
|
|
66
|
-
"eslint": "
|
|
67
|
+
"eslint": "10.4.1",
|
|
67
68
|
"eslint-plugin-security": "^4.0.0",
|
|
68
69
|
"shx": "^0.4.0",
|
|
69
70
|
"supertest": "^7.2.2",
|
|
70
|
-
"tsx": "
|
|
71
|
+
"tsx": "4.22.4",
|
|
71
72
|
"typescript": "^5.8.3"
|
|
72
73
|
}
|
|
73
74
|
}
|