mcp-searxng 0.4.3 → 0.4.6

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.
Files changed (2) hide show
  1. package/dist/index.js +13 -10
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -3,6 +3,8 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
3
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
4
  import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
5
5
  import { NodeHtmlMarkdown } from "node-html-markdown";
6
+ // Use a static version string that will be updated by the version script
7
+ const packageVersion = "0.4.5";
6
8
  const WEB_SEARCH_TOOL = {
7
9
  name: "searxng_web_search",
8
10
  description: "Performs a web search using the SearXNG API, ideal for general queries, news, articles, and online content. " +
@@ -22,7 +24,7 @@ const WEB_SEARCH_TOOL = {
22
24
  time_range: {
23
25
  type: "string",
24
26
  description: "Time range of search (day, month, year)",
25
- enum: ["", "day", "month", "year"],
27
+ enum: ["day", "month", "year"],
26
28
  default: "",
27
29
  },
28
30
  language: {
@@ -31,10 +33,10 @@ const WEB_SEARCH_TOOL = {
31
33
  default: "all",
32
34
  },
33
35
  safesearch: {
34
- type: "number",
36
+ type: "string",
35
37
  description: "Safe search filter level (0: None, 1: Moderate, 2: Strict)",
36
- enum: [0, 1, 2],
37
- default: undefined,
38
+ enum: ["0", "1", "2"],
39
+ default: "0",
38
40
  },
39
41
  },
40
42
  required: ["query"],
@@ -58,7 +60,7 @@ const READ_URL_TOOL = {
58
60
  // Server implementation
59
61
  const server = new Server({
60
62
  name: "ihor-sokoliuk/mcp-searxng",
61
- version: "v0.4.3",
63
+ version: packageVersion,
62
64
  }, {
63
65
  capabilities: {
64
66
  resources: {},
@@ -80,20 +82,21 @@ function isSearXNGWebSearchArgs(args) {
80
82
  "query" in args &&
81
83
  typeof args.query === "string");
82
84
  }
83
- async function performWebSearch(query, pageno = 1, time_range = "", language = "all", safesearch) {
85
+ async function performWebSearch(query, pageno = 1, time_range, language = "all", safesearch) {
84
86
  const searxngUrl = process.env.SEARXNG_URL || "http://localhost:8080";
85
87
  const url = new URL(`${searxngUrl}/search`);
86
88
  url.searchParams.set("q", query);
87
89
  url.searchParams.set("format", "json");
88
90
  url.searchParams.set("pageno", pageno.toString());
89
- if (time_range && ["day", "month", "year"].includes(time_range)) {
91
+ if (time_range !== undefined &&
92
+ ["day", "month", "year"].includes(time_range)) {
90
93
  url.searchParams.set("time_range", time_range);
91
94
  }
92
95
  if (language && language !== "all") {
93
96
  url.searchParams.set("language", language);
94
97
  }
95
- if (safesearch !== undefined && [0, 1, 2].includes(safesearch)) {
96
- url.searchParams.set("safesearch", safesearch.toString());
98
+ if (safesearch !== undefined && ["0", "1", "2"].includes(safesearch)) {
99
+ url.searchParams.set("safesearch", safesearch);
97
100
  }
98
101
  const response = await fetch(url.toString(), {
99
102
  method: "GET",
@@ -155,7 +158,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
155
158
  if (!isSearXNGWebSearchArgs(args)) {
156
159
  throw new Error("Invalid arguments for searxng_web_search");
157
160
  }
158
- const { query, pageno = 1, time_range = "", language = "all", safesearch, } = args;
161
+ const { query, pageno = 1, time_range, language = "all", safesearch, } = args;
159
162
  const results = await performWebSearch(query, pageno, time_range, language, safesearch);
160
163
  return {
161
164
  content: [{ type: "text", text: results }],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-searxng",
3
- "version": "0.4.3",
3
+ "version": "0.4.6",
4
4
  "description": "MCP server for SearXNG integration",
5
5
  "license": "MIT",
6
6
  "author": "Ihor Sokoliuk (https://github.com/ihor-sokoliuk)",
@@ -31,7 +31,8 @@
31
31
  "scripts": {
32
32
  "build": "tsc && shx chmod +x dist/*.js",
33
33
  "prepare": "npm run build",
34
- "watch": "tsc --watch"
34
+ "watch": "tsc --watch",
35
+ "postversion": "node scripts/update-version.js && git add index.ts && git commit --amend --no-edit"
35
36
  },
36
37
  "dependencies": {
37
38
  "@modelcontextprotocol/sdk": "1.10.1",