mcp-searxng 0.2.1 → 0.3.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.
Files changed (3) hide show
  1. package/README.md +24 -19
  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,7 +9,10 @@ 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
 
@@ -17,8 +20,10 @@ An [MCP server](https://modelcontextprotocol.io/introduction) implementation tha
17
20
  - Execute web searches with pagination
18
21
  - Inputs:
19
22
  - `query` (string): Search terms
20
- - `count` (number, optional): Results per page (default 20)
21
- - `offset` (number, optional): Pagination offset (default 0)
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
 
@@ -38,19 +43,17 @@ To install SearxNG Server for Claude Desktop automatically via [Smithery](https:
38
43
  npx -y @smithery/cli install @ihor-sokoliuk/server-searxng --client claude
39
44
  ```
40
45
 
41
- ### Installing via npm
42
-
43
- ```bash
44
- npm install -g mcp-searxng
45
- ```
46
-
47
- And then in your MCP config file:
46
+ ### NPX
48
47
 
49
48
  ```json
50
49
  {
51
50
  "mcpServers": {
52
51
  "searxng": {
53
- "command": "mcp-searxng",
52
+ "command": "npx",
53
+ "args": [
54
+ "-y",
55
+ "mcp-searxng"
56
+ ],
54
57
  "env": {
55
58
  "SEARXNG_URL": "YOUR_SEARXNG_INSTANCE_URL"
56
59
  }
@@ -59,17 +62,19 @@ And then in your MCP config file:
59
62
  }
60
63
  ```
61
64
 
62
- ### NPX
65
+ ### NPM
66
+
67
+ ```bash
68
+ npm install -g mcp-searxng
69
+ ```
70
+
71
+ And then in your MCP config file:
63
72
 
64
73
  ```json
65
74
  {
66
75
  "mcpServers": {
67
76
  "searxng": {
68
- "command": "npx",
69
- "args": [
70
- "-y",
71
- "mcp-searxng"
72
- ],
77
+ "command": "mcp-searxng",
73
78
  "env": {
74
79
  "SEARXNG_URL": "YOUR_SEARXNG_INSTANCE_URL"
75
80
  }
@@ -101,7 +106,7 @@ Add this to your `claude_desktop_config.json`:
101
106
  "--rm",
102
107
  "-e",
103
108
  "SEARXNG_URL",
104
- "mcp-server-searxng:latest"
109
+ "mcp-searxng:latest"
105
110
  ],
106
111
  "env": {
107
112
  "SEARXNG_URL": "YOUR_SEARXNG_INSTANCE_URL"
package/dist/index.js CHANGED
@@ -14,15 +14,27 @@ const WEB_SEARCH_TOOL = {
14
14
  type: "string",
15
15
  description: "Search query",
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"],
@@ -45,8 +57,8 @@ const READ_URL_TOOL = {
45
57
  };
46
58
  // Server implementation
47
59
  const server = new Server({
48
- name: "example-servers/searxng-search",
49
- version: "0.1.0",
60
+ name: "ihor-sokoliuk/mcp-searxng",
61
+ version: "0.3.0",
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.1",
3
+ "version": "0.3.0",
4
4
  "description": "MCP server for SearXNG integration",
5
5
  "license": "MIT",
6
6
  "author": "Ihor Sokoliuk (https://github.com/ihor-sokoliuk)",