mcp-searxng 0.2.2 → 0.3.1

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 (3) hide show
  1. package/README.md +10 -5
  2. package/dist/index.js +33 -13
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # SearXNG MCP Server
2
2
 
3
- An [MCP server](https://modelcontextprotocol.io/introduction) implementation that integrates the SearxNG API, providing web search capabilities.
3
+ An [MCP server](https://modelcontextprotocol.io/introduction) implementation that integrates the [SearXNG](https://docs.searxng.org) API, providing web search capabilities.
4
4
 
5
5
  <a href="https://glama.ai/mcp/servers/0j7jjyt7m9"><img width="380" height="200" src="https://glama.ai/mcp/servers/0j7jjyt7m9/badge" alt="SearXNG Server MCP server" /></a>
6
6
 
@@ -9,16 +9,21 @@ An [MCP server](https://modelcontextprotocol.io/introduction) implementation tha
9
9
  ## Features
10
10
 
11
11
  - **Web Search**: General queries, news, articles, with pagination.
12
- - **Pagination**: Control return size and result counts options.
12
+ - **Pagination**: Control which page of results to retrieve.
13
+ - **Time Filtering**: Filter results by time range (day, month, year).
14
+ - **Language Selection**: Filter results by preferred language.
15
+ - **Safe Search**: Control content filtering level for search results.
13
16
 
14
17
  ## Tools
15
18
 
16
19
  - **searxng_web_search**
17
20
  - Execute web searches with pagination
18
21
  - Inputs:
19
- - `query` (string): Search terms
20
- - `count` (number, optional): Results per page (default 20)
21
- - `offset` (number, optional): Pagination offset (default 0)
22
+ - `query` (string): The search query. This string is passed to external search services.
23
+ - `pageno` (number, optional): Search page number, starts at 1 (default 1)
24
+ - `time_range` (string, optional): Filter results by time range - one of: "day", "month", "year" (default: none)
25
+ - `language` (string, optional): Language code for results (e.g., "en", "fr", "de") or "all" (default: "all")
26
+ - `safesearch` (number, optional): Safe search filter level (0: None, 1: Moderate, 2: Strict) (default: instance setting)
22
27
 
23
28
  ## Configuration
24
29
 
package/dist/index.js CHANGED
@@ -12,17 +12,29 @@ const WEB_SEARCH_TOOL = {
12
12
  properties: {
13
13
  query: {
14
14
  type: "string",
15
- description: "Search query",
15
+ description: "The search query. This string is passed to external search services.",
16
16
  },
17
- count: {
17
+ pageno: {
18
18
  type: "number",
19
- description: "Number of results",
20
- default: 20,
19
+ description: "Search page number (starts at 1)",
20
+ default: 1,
21
21
  },
22
- offset: {
22
+ time_range: {
23
+ type: "string",
24
+ description: "Time range of search (day, month, year)",
25
+ enum: ["", "day", "month", "year"],
26
+ default: "",
27
+ },
28
+ language: {
29
+ type: "string",
30
+ description: "Language code for search results (e.g., 'en', 'fr', 'de'). Default is instance-dependent.",
31
+ default: "all",
32
+ },
33
+ safesearch: {
23
34
  type: "number",
24
- description: "Pagination offset",
25
- default: 0,
35
+ description: "Safe search filter level (0: None, 1: Moderate, 2: Strict)",
36
+ enum: [0, 1, 2],
37
+ default: undefined,
26
38
  },
27
39
  },
28
40
  required: ["query"],
@@ -46,7 +58,7 @@ const READ_URL_TOOL = {
46
58
  // Server implementation
47
59
  const server = new Server({
48
60
  name: "ihor-sokoliuk/mcp-searxng",
49
- version: "0.2.2",
61
+ version: "0.3.1",
50
62
  }, {
51
63
  capabilities: {
52
64
  resources: {},
@@ -59,13 +71,21 @@ function isSearXNGWebSearchArgs(args) {
59
71
  "query" in args &&
60
72
  typeof args.query === "string");
61
73
  }
62
- async function performWebSearch(query, count = 10, offset = 0) {
74
+ async function performWebSearch(query, pageno = 1, time_range = "", language = "all", safesearch) {
63
75
  const searxngUrl = process.env.SEARXNG_URL || "http://localhost:8080";
64
76
  const url = new URL(`${searxngUrl}/search`);
65
77
  url.searchParams.set("q", query);
66
78
  url.searchParams.set("format", "json");
67
- url.searchParams.set("start", offset.toString());
68
- url.searchParams.set("count", count.toString());
79
+ url.searchParams.set("pageno", pageno.toString());
80
+ if (time_range && ["day", "month", "year"].includes(time_range)) {
81
+ url.searchParams.set("time_range", time_range);
82
+ }
83
+ if (language && language !== "all") {
84
+ url.searchParams.set("language", language);
85
+ }
86
+ if (safesearch !== undefined && [0, 1, 2].includes(safesearch)) {
87
+ url.searchParams.set("safesearch", safesearch.toString());
88
+ }
69
89
  const response = await fetch(url.toString(), {
70
90
  method: "GET",
71
91
  });
@@ -126,8 +146,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
126
146
  if (!isSearXNGWebSearchArgs(args)) {
127
147
  throw new Error("Invalid arguments for searxng_web_search");
128
148
  }
129
- const { query, count = 10 } = args;
130
- const results = await performWebSearch(query, count);
149
+ const { query, pageno = 1, time_range = "", language = "all", safesearch, } = args;
150
+ const results = await performWebSearch(query, pageno, time_range, language, safesearch);
131
151
  return {
132
152
  content: [{ type: "text", text: results }],
133
153
  isError: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-searxng",
3
- "version": "0.2.2",
3
+ "version": "0.3.1",
4
4
  "description": "MCP server for SearXNG integration",
5
5
  "license": "MIT",
6
6
  "author": "Ihor Sokoliuk (https://github.com/ihor-sokoliuk)",