search1api-mcp 0.1.4 → 0.1.5

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
@@ -20,17 +20,25 @@ https://github.com/user-attachments/assets/58bc98ae-3b6b-442c-a7fc-010508b5f028
20
20
  - Name: `search`
21
21
  - Description: Search the web using Search1API
22
22
  - Parameters:
23
- * `query` (required): Search query
23
+ * `query` (required): Search query in natural language. Be specific and concise for better results
24
24
  * `max_results` (optional, default: 10): Number of results to return
25
- * `search_service` (optional, default: "google"): Search service to use
25
+ * `search_service` (optional, default: "google"): Search service to use (google, bing, duckduckgo, yahoo, github, youtube, arxiv, wechat, bilibili, imdb)
26
+ * `crawl_results` (optional, default: 0): Number of results to crawl for full webpage content
27
+ * `include_sites` (optional): List of sites to include in search
28
+ * `exclude_sites` (optional): List of sites to exclude from search
29
+ * `time_range` (optional): Time range for search results ("day", "month", "year")
26
30
 
27
31
  ### 2. News Tool
28
32
  - Name: `news`
29
33
  - Description: Search for news articles using Search1API
30
34
  - Parameters:
31
- * `query` (required): Search query
35
+ * `query` (required): Search query in natural language. Be specific and concise for better results
32
36
  * `max_results` (optional, default: 10): Number of results to return
33
- * `search_service` (optional, default: "google"): Search service to use
37
+ * `search_service` (optional, default: "bing"): Search service to use (google, bing, duckduckgo, yahoo, hackernews)
38
+ * `crawl_results` (optional, default: 0): Number of results to crawl for full webpage content
39
+ * `include_sites` (optional): List of sites to include in search
40
+ * `exclude_sites` (optional): List of sites to exclude from search
41
+ * `time_range` (optional): Time range for search results ("day", "month", "year")
34
42
 
35
43
  ### 3. Crawl Tool
36
44
  - Name: `crawl`
@@ -79,6 +87,11 @@ Configuration file location:
79
87
  - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
80
88
 
81
89
  #### 2.2 Cursor
90
+ Easy way:
91
+ 1. Open Cursor Settings to add new MCP server `search1api` with the command `env SEARCH1API_KEY=your-search1api-key npx -y search1api-mcp`
92
+ 2. Add your own Search1API key to the command
93
+
94
+ Safe way:
82
95
  1. Copy the run.template.sh to your file path and rename it to run.sh
83
96
  2. Add your own Search1API key to the run.sh file
84
97
  3. Open Cursor Settings to add new MCP server `search1api` with the command `sh ./your_file_path/run.sh`
@@ -107,6 +120,7 @@ Read the Windsurf MCP Server [Official Documentation](https://docs.codeium.com/w
107
120
 
108
121
  ## Version History
109
122
 
123
+ - v0.1.5: Added new search parameters (include_sites, exclude_sites, time_range) and new search services (arxiv, wechat, bilibili, imdb)
110
124
  - v0.1.4: Added reasoning tool with deepseek r1 and updated the Cursor and Windsurf configuration guide
111
125
  - v0.1.3: Added news search functionality
112
126
  - v0.1.2: Added sitemap functionality
package/build/index.js CHANGED
@@ -28,17 +28,44 @@ const SEARCH_TOOL = {
28
28
  properties: {
29
29
  query: {
30
30
  type: "string",
31
- description: "Search query"
31
+ description: "Search query in natural language. Be specific and concise for better results"
32
32
  },
33
33
  max_results: {
34
34
  type: "number",
35
- description: "Maximum number of results to return (default: 10)",
35
+ description: "Maximum number of results to return",
36
36
  default: 10
37
37
  },
38
38
  search_service: {
39
39
  type: "string",
40
- description: "Search service to use (default: google)",
41
- default: "google"
40
+ description: "Specify the search engine to use. Choose based on your specific needs",
41
+ default: "google",
42
+ enum: ["google", "bing", "duckduckgo", "yahoo", "github", "youtube", "arxiv", "wechat", "bilibili", "imdb"]
43
+ },
44
+ crawl_results: {
45
+ type: "number",
46
+ description: "Number of results to crawl for full webpage content, useful when search result summaries are insufficient for complex queries",
47
+ default: 0
48
+ },
49
+ include_sites: {
50
+ type: "array",
51
+ items: {
52
+ type: "string"
53
+ },
54
+ description: "List of sites to include in search. Only use when you need special results from sites not available in search_service",
55
+ default: []
56
+ },
57
+ exclude_sites: {
58
+ type: "array",
59
+ items: {
60
+ type: "string"
61
+ },
62
+ description: "List of sites to exclude from search. Only use when you need to explicitly filter out specific domains from results",
63
+ default: []
64
+ },
65
+ time_range: {
66
+ type: "string",
67
+ description: "Time range for search results, only use when specific time constraints are required",
68
+ enum: ["day", "month", "year"]
42
69
  }
43
70
  },
44
71
  required: ["query"]
@@ -52,17 +79,44 @@ const NEWS_TOOL = {
52
79
  properties: {
53
80
  query: {
54
81
  type: "string",
55
- description: "News search query"
82
+ description: "Search query in natural language. Be specific and concise for better results"
56
83
  },
57
84
  max_results: {
58
85
  type: "number",
59
- description: "Maximum number of results to return (default: 10)",
86
+ description: "Maximum number of results to return",
60
87
  default: 10
61
88
  },
62
89
  search_service: {
63
90
  type: "string",
64
- description: "Search service to use (default: google)",
65
- default: "google"
91
+ description: "Specify the news engine to use. Choose based on your specific needs",
92
+ default: "bing",
93
+ enum: ["google", "bing", "duckduckgo", "yahoo", "hackernews"]
94
+ },
95
+ crawl_results: {
96
+ type: "number",
97
+ description: "Number of results to crawl for full webpage content, useful when search result summaries are insufficient for complex queries",
98
+ default: 0
99
+ },
100
+ include_sites: {
101
+ type: "array",
102
+ items: {
103
+ type: "string"
104
+ },
105
+ description: "List of sites to include in search. Only use when you need special results from sites not available in search_service",
106
+ default: []
107
+ },
108
+ exclude_sites: {
109
+ type: "array",
110
+ items: {
111
+ type: "string"
112
+ },
113
+ description: "List of sites to exclude from search. Only use when you need to explicitly filter out specific domains from results",
114
+ default: []
115
+ },
116
+ time_range: {
117
+ type: "string",
118
+ description: "Time range for search results, only use when specific time constraints are required",
119
+ enum: ["day", "month", "year"]
66
120
  }
67
121
  },
68
122
  required: ["query"]
@@ -113,7 +167,7 @@ const REASONING_TOOL = {
113
167
  // Server implementation
114
168
  const server = new Server({
115
169
  name: "search1api-mcp",
116
- version: "0.1.3",
170
+ version: "0.1.5",
117
171
  }, {
118
172
  capabilities: {
119
173
  resources: {
@@ -238,12 +292,20 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
238
292
  if (!isValidSearchArgs(args)) {
239
293
  throw new McpError(ErrorCode.InvalidParams, "Invalid search arguments");
240
294
  }
241
- const { query, max_results = 10, search_service = "google" } = args;
242
- const response = await makeRequest(API_CONFIG.ENDPOINTS.SEARCH, {
243
- query,
244
- search_service,
245
- max_results
246
- });
295
+ const response = await makeRequest(API_CONFIG.ENDPOINTS.SEARCH, args);
296
+ return {
297
+ content: [{
298
+ type: "text",
299
+ mimeType: "application/json",
300
+ text: JSON.stringify(response.results, null, 2)
301
+ }]
302
+ };
303
+ }
304
+ case "news": {
305
+ if (!isValidNewsArgs(args)) {
306
+ throw new McpError(ErrorCode.InvalidParams, "Invalid news arguments");
307
+ }
308
+ const response = await makeRequest(API_CONFIG.ENDPOINTS.NEWS, args);
247
309
  return {
248
310
  content: [{
249
311
  type: "text",
@@ -301,24 +363,6 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
301
363
  throw formatError(error);
302
364
  }
303
365
  }
304
- case "news": {
305
- if (!isValidNewsArgs(args)) {
306
- throw new McpError(ErrorCode.InvalidParams, "Invalid news arguments");
307
- }
308
- const { query, max_results = 10, search_service = "google" } = args;
309
- const response = await makeRequest(API_CONFIG.ENDPOINTS.NEWS, {
310
- query,
311
- search_service,
312
- max_results
313
- });
314
- return {
315
- content: [{
316
- type: "text",
317
- mimeType: "application/json",
318
- text: JSON.stringify(response.results, null, 2)
319
- }]
320
- };
321
- }
322
366
  case "reasoning": {
323
367
  if (!args) {
324
368
  throw new Error("No arguments provided");
package/build/types.js CHANGED
@@ -1,17 +1,62 @@
1
+ export var SearchService;
2
+ (function (SearchService) {
3
+ SearchService["GOOGLE"] = "google";
4
+ SearchService["BING"] = "bing";
5
+ SearchService["DUCKDUCKGO"] = "duckduckgo";
6
+ SearchService["YAHOO"] = "yahoo";
7
+ SearchService["GITHUB"] = "github";
8
+ SearchService["YOUTUBE"] = "youtube";
9
+ SearchService["ARXIV"] = "arxiv";
10
+ SearchService["WECHAT"] = "wechat";
11
+ SearchService["BILIBILI"] = "bilibili";
12
+ SearchService["IMDB"] = "imdb";
13
+ })(SearchService || (SearchService = {}));
14
+ export var NewsService;
15
+ (function (NewsService) {
16
+ NewsService["GOOGLE"] = "google";
17
+ NewsService["BING"] = "bing";
18
+ NewsService["DUCKDUCKGO"] = "duckduckgo";
19
+ NewsService["YAHOO"] = "yahoo";
20
+ NewsService["HACKERNEWS"] = "hackernews";
21
+ })(NewsService || (NewsService = {}));
22
+ export var TimeRange;
23
+ (function (TimeRange) {
24
+ TimeRange["DAY"] = "day";
25
+ TimeRange["MONTH"] = "month";
26
+ TimeRange["YEAR"] = "year";
27
+ })(TimeRange || (TimeRange = {}));
1
28
  export function isValidSearchArgs(args) {
2
29
  if (typeof args !== 'object' || args === null) {
3
30
  return false;
4
31
  }
5
- const { query, max_results, search_service } = args;
32
+ const { query, max_results, search_service, crawl_results, include_sites, exclude_sites, time_range } = args;
6
33
  if (typeof query !== 'string' || query.trim().length === 0) {
7
34
  return false;
8
35
  }
9
36
  if (max_results !== undefined && (typeof max_results !== 'number' || max_results < 1 || max_results > 50)) {
10
37
  return false;
11
38
  }
12
- if (search_service !== undefined && typeof search_service !== 'string') {
39
+ if (search_service !== undefined) {
40
+ const validServices = Object.values(SearchService);
41
+ if (!validServices.includes(search_service)) {
42
+ return false;
43
+ }
44
+ }
45
+ if (crawl_results !== undefined && (typeof crawl_results !== 'number' || crawl_results < 0)) {
46
+ return false;
47
+ }
48
+ if (include_sites !== undefined && (!Array.isArray(include_sites) || !include_sites.every(site => typeof site === 'string'))) {
13
49
  return false;
14
50
  }
51
+ if (exclude_sites !== undefined && (!Array.isArray(exclude_sites) || !exclude_sites.every(site => typeof site === 'string'))) {
52
+ return false;
53
+ }
54
+ if (time_range !== undefined) {
55
+ const validTimeRanges = Object.values(TimeRange);
56
+ if (!validTimeRanges.includes(time_range)) {
57
+ return false;
58
+ }
59
+ }
15
60
  return true;
16
61
  }
17
62
  export function isValidCrawlArgs(args) {
@@ -38,16 +83,34 @@ export function isValidNewsArgs(args) {
38
83
  if (typeof args !== 'object' || args === null) {
39
84
  return false;
40
85
  }
41
- const { query, max_results, search_service } = args;
86
+ const { query, max_results, search_service, crawl_results, include_sites, exclude_sites, time_range } = args;
42
87
  if (typeof query !== 'string' || query.trim().length === 0) {
43
88
  return false;
44
89
  }
45
90
  if (max_results !== undefined && (typeof max_results !== 'number' || max_results < 1 || max_results > 50)) {
46
91
  return false;
47
92
  }
48
- if (search_service !== undefined && typeof search_service !== 'string') {
93
+ if (search_service !== undefined) {
94
+ const validServices = Object.values(NewsService);
95
+ if (!validServices.includes(search_service)) {
96
+ return false;
97
+ }
98
+ }
99
+ if (crawl_results !== undefined && (typeof crawl_results !== 'number' || crawl_results < 0)) {
100
+ return false;
101
+ }
102
+ if (include_sites !== undefined && (!Array.isArray(include_sites) || !include_sites.every(site => typeof site === 'string'))) {
49
103
  return false;
50
104
  }
105
+ if (exclude_sites !== undefined && (!Array.isArray(exclude_sites) || !exclude_sites.every(site => typeof site === 'string'))) {
106
+ return false;
107
+ }
108
+ if (time_range !== undefined) {
109
+ const validTimeRanges = Object.values(TimeRange);
110
+ if (!validTimeRanges.includes(time_range)) {
111
+ return false;
112
+ }
113
+ }
51
114
  return true;
52
115
  }
53
116
  export function isValidReasoningArgs(args) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "search1api-mcp",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "A Model Context Protocol (MCP) server that provides search and crawl functionality using Search1API",
5
5
  "private": false,
6
6
  "type": "module",