mcp-searxng 1.3.1 → 1.3.3

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 CHANGED
@@ -9,8 +9,9 @@
9
9
  [![npm downloads](https://img.shields.io/npm/dm/mcp-searxng?style=flat-square&logo=npm&label=downloads%2Fmo)](https://www.npmjs.com/package/mcp-searxng)
10
10
  [![Docker Pulls](https://img.shields.io/docker/pulls/isokoliuk/mcp-searxng?style=flat-square&logo=docker)](https://hub.docker.com/r/isokoliuk/mcp-searxng)
11
11
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](LICENSE)
12
- [![mcp-searxng MCP server](https://glama.ai/mcp/servers/ihor-sokoliuk/mcp-searxng/badges/score.svg)](https://glama.ai/mcp/servers/ihor-sokoliuk/mcp-searxng)
13
12
  [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/ihor-sokoliuk/mcp-searxng/badge)](https://scorecard.dev/viewer/?uri=github.com/ihor-sokoliuk/mcp-searxng)
13
+ [![OpenSSF Baseline](https://www.bestpractices.dev/projects/13143/baseline)](https://www.bestpractices.dev/projects/13143)
14
+ [![mcp-searxng MCP server](https://glama.ai/mcp/servers/ihor-sokoliuk/mcp-searxng/badges/score.svg)](https://glama.ai/mcp/servers/ihor-sokoliuk/mcp-searxng)
14
15
 
15
16
  An [MCP server](https://modelcontextprotocol.io/introduction) that integrates the [SearXNG](https://docs.searxng.org) API, giving AI assistants web search capabilities.
16
17
 
@@ -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 "./index.js";
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
@@ -1,6 +1,4 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- declare const packageVersion = "1.3.1";
3
- export { packageVersion };
4
2
  export declare function isWebUrlReadArgs(args: unknown): args is {
5
3
  url: string;
6
4
  startChar?: number;
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
- // Use a static version string that will be updated by the version script
12
- const packageVersion = "1.3.1";
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 "./index.js";
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(), requestOptions);
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 SearXNGWeb {
3
- results: Array<{
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.3";
@@ -0,0 +1 @@
1
+ export const packageVersion = "1.3.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-searxng",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "mcpName": "io.github.ihor-sokoliuk/mcp-searxng",
5
5
  "description": "MCP server for SearXNG integration",
6
6
  "license": "MIT",
@@ -38,13 +38,14 @@
38
38
  "build": "tsc && shx chmod +x dist/*.js",
39
39
  "watch": "tsc --watch",
40
40
  "test": "cross-env SEARXNG_URL=https://test-searx.example.com tsx __tests__/run-all.ts",
41
- "test:coverage": "cross-env SEARXNG_URL=https://test-searx.example.com c8 --reporter=text --exclude 'dist/**' tsx __tests__/run-all.ts",
41
+ "test:coverage": "cross-env SEARXNG_URL=https://test-searx.example.com c8 --reporter=text --exclude 'dist/**' --check-coverage --lines 80 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/index.ts .mcp/server.json && git commit --amend --no-edit && git tag -f $TAG"
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": "^7.24.0"
58
+ "undici": "7.27.2"
58
59
  },
59
60
  "devDependencies": {
60
- "@types/node": "^22.17.2",
61
+ "@types/node": "22.19.20",
61
62
  "@types/supertest": "^7.2.0",
62
- "@typescript-eslint/eslint-plugin": "^8.58.0",
63
- "@typescript-eslint/parser": "^8.58.0",
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": "^10.1.0",
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": "^4.21.0",
71
+ "tsx": "4.22.4",
71
72
  "typescript": "^5.8.3"
72
73
  }
73
74
  }