search1api-mcp 0.1.4 → 0.1.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.
- package/README.md +18 -38
- package/build/index.js +77 -33
- package/build/types.js +68 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
# Search1API MCP Server
|
|
2
2
|
|
|
3
|
+
[中文文档](./README_zh.md)
|
|
4
|
+
|
|
3
5
|
A Model Context Protocol (MCP) server that provides search and crawl functionality using Search1API.
|
|
4
6
|
|
|
5
7
|
https://github.com/user-attachments/assets/58bc98ae-3b6b-442c-a7fc-010508b5f028
|
|
6
8
|
|
|
9
|
+
More discussions, please join the official [discord](https://discord.com/invite/AKXYq32Bxc)
|
|
7
10
|
|
|
8
11
|
## Features
|
|
9
12
|
|
|
@@ -12,7 +15,7 @@ https://github.com/user-attachments/assets/58bc98ae-3b6b-442c-a7fc-010508b5f028
|
|
|
12
15
|
- Web page content extraction
|
|
13
16
|
- Website sitemap extraction
|
|
14
17
|
- Deep thinking and complex problem solving with DeepSeek R1
|
|
15
|
-
- Seamless integration with Claude Desktop, Cursor and
|
|
18
|
+
- Seamless integration with Claude Desktop, Cursor, Windsurf, Cline and other MCP clients
|
|
16
19
|
|
|
17
20
|
## Tools
|
|
18
21
|
|
|
@@ -20,17 +23,25 @@ https://github.com/user-attachments/assets/58bc98ae-3b6b-442c-a7fc-010508b5f028
|
|
|
20
23
|
- Name: `search`
|
|
21
24
|
- Description: Search the web using Search1API
|
|
22
25
|
- Parameters:
|
|
23
|
-
* `query` (required): Search query
|
|
26
|
+
* `query` (required): Search query in natural language. Be specific and concise for better results
|
|
24
27
|
* `max_results` (optional, default: 10): Number of results to return
|
|
25
|
-
* `search_service` (optional, default: "google"): Search service to use
|
|
28
|
+
* `search_service` (optional, default: "google"): Search service to use (google, bing, duckduckgo, yahoo, github, youtube, arxiv, wechat, bilibili, imdb, wikipedia)
|
|
29
|
+
* `crawl_results` (optional, default: 0): Number of results to crawl for full webpage content
|
|
30
|
+
* `include_sites` (optional): List of sites to include in search
|
|
31
|
+
* `exclude_sites` (optional): List of sites to exclude from search
|
|
32
|
+
* `time_range` (optional): Time range for search results ("day", "month", "year")
|
|
26
33
|
|
|
27
34
|
### 2. News Tool
|
|
28
35
|
- Name: `news`
|
|
29
36
|
- Description: Search for news articles using Search1API
|
|
30
37
|
- Parameters:
|
|
31
|
-
* `query` (required): Search query
|
|
38
|
+
* `query` (required): Search query in natural language. Be specific and concise for better results
|
|
32
39
|
* `max_results` (optional, default: 10): Number of results to return
|
|
33
|
-
* `search_service` (optional, default: "
|
|
40
|
+
* `search_service` (optional, default: "bing"): Search service to use (google, bing, duckduckgo, yahoo, hackernews)
|
|
41
|
+
* `crawl_results` (optional, default: 0): Number of results to crawl for full webpage content
|
|
42
|
+
* `include_sites` (optional): List of sites to include in search
|
|
43
|
+
* `exclude_sites` (optional): List of sites to exclude from search
|
|
44
|
+
* `time_range` (optional): Time range for search results ("day", "month", "year")
|
|
34
45
|
|
|
35
46
|
### 3. Crawl Tool
|
|
36
47
|
- Name: `crawl`
|
|
@@ -57,36 +68,6 @@ https://github.com/user-attachments/assets/58bc98ae-3b6b-442c-a7fc-010508b5f028
|
|
|
57
68
|
2. Get your api key and 100 free credits
|
|
58
69
|
|
|
59
70
|
### 2. Configure
|
|
60
|
-
#### 2.1 Claude Desktop
|
|
61
|
-
Update your Claude configuration file (`claude_desktop_config.json`) with the following content:
|
|
62
|
-
|
|
63
|
-
```json
|
|
64
|
-
{
|
|
65
|
-
"mcpServers": {
|
|
66
|
-
"search1api": {
|
|
67
|
-
"command": "npx",
|
|
68
|
-
"args": ["-y", "search1api-mcp"],
|
|
69
|
-
"env": {
|
|
70
|
-
"SEARCH1API_KEY": "YOUR_SEARCH1API_KEY"
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Configuration file location:
|
|
78
|
-
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
79
|
-
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
80
|
-
|
|
81
|
-
#### 2.2 Cursor
|
|
82
|
-
1. Copy the run.template.sh to your file path and rename it to run.sh
|
|
83
|
-
2. Add your own Search1API key to the run.sh file
|
|
84
|
-
3. Open Cursor Settings to add new MCP server `search1api` with the command `sh ./your_file_path/run.sh`
|
|
85
|
-
|
|
86
|
-
Read the Cursor MCP Server [Official Documentation](https://docs.cursor.com/context/model-context-protocol#adding-an-mcp-server-to-cursor) to get more information.
|
|
87
|
-
|
|
88
|
-
#### 2.3 Windsurf
|
|
89
|
-
Update your Windsurf configuration file (`mcp_config.json`) with the following content:
|
|
90
71
|
|
|
91
72
|
```json
|
|
92
73
|
{
|
|
@@ -101,12 +82,11 @@ Update your Windsurf configuration file (`mcp_config.json`) with the following c
|
|
|
101
82
|
}
|
|
102
83
|
}
|
|
103
84
|
```
|
|
104
|
-
Read the Windsurf MCP Server [Official Documentation](https://docs.codeium.com/windsurf/mcp) to get more information.
|
|
105
|
-
|
|
106
|
-
**Notice: After the configuration is done, you can close Windsurf offcial web tools to save your credits**
|
|
107
85
|
|
|
108
86
|
## Version History
|
|
109
87
|
|
|
88
|
+
- v0.1.6: Added Wikipedia search service
|
|
89
|
+
- v0.1.5: Added new search parameters (include_sites, exclude_sites, time_range) and new search services (arxiv, wechat, bilibili, imdb)
|
|
110
90
|
- v0.1.4: Added reasoning tool with deepseek r1 and updated the Cursor and Windsurf configuration guide
|
|
111
91
|
- v0.1.3: Added news search functionality
|
|
112
92
|
- 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
|
|
35
|
+
description: "Maximum number of results to return",
|
|
36
36
|
default: 10
|
|
37
37
|
},
|
|
38
38
|
search_service: {
|
|
39
39
|
type: "string",
|
|
40
|
-
description: "
|
|
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", "wikipedia"]
|
|
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: "
|
|
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
|
|
86
|
+
description: "Maximum number of results to return",
|
|
60
87
|
default: 10
|
|
61
88
|
},
|
|
62
89
|
search_service: {
|
|
63
90
|
type: "string",
|
|
64
|
-
description: "
|
|
65
|
-
default: "
|
|
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.
|
|
170
|
+
version: "0.1.6",
|
|
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
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
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,63 @@
|
|
|
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["WIKIPEDIA"] = "wikipedia";
|
|
14
|
+
})(SearchService || (SearchService = {}));
|
|
15
|
+
export var NewsService;
|
|
16
|
+
(function (NewsService) {
|
|
17
|
+
NewsService["GOOGLE"] = "google";
|
|
18
|
+
NewsService["BING"] = "bing";
|
|
19
|
+
NewsService["DUCKDUCKGO"] = "duckduckgo";
|
|
20
|
+
NewsService["YAHOO"] = "yahoo";
|
|
21
|
+
NewsService["HACKERNEWS"] = "hackernews";
|
|
22
|
+
})(NewsService || (NewsService = {}));
|
|
23
|
+
export var TimeRange;
|
|
24
|
+
(function (TimeRange) {
|
|
25
|
+
TimeRange["DAY"] = "day";
|
|
26
|
+
TimeRange["MONTH"] = "month";
|
|
27
|
+
TimeRange["YEAR"] = "year";
|
|
28
|
+
})(TimeRange || (TimeRange = {}));
|
|
1
29
|
export function isValidSearchArgs(args) {
|
|
2
30
|
if (typeof args !== 'object' || args === null) {
|
|
3
31
|
return false;
|
|
4
32
|
}
|
|
5
|
-
const { query, max_results, search_service } = args;
|
|
33
|
+
const { query, max_results, search_service, crawl_results, include_sites, exclude_sites, time_range } = args;
|
|
6
34
|
if (typeof query !== 'string' || query.trim().length === 0) {
|
|
7
35
|
return false;
|
|
8
36
|
}
|
|
9
37
|
if (max_results !== undefined && (typeof max_results !== 'number' || max_results < 1 || max_results > 50)) {
|
|
10
38
|
return false;
|
|
11
39
|
}
|
|
12
|
-
if (search_service !== undefined
|
|
40
|
+
if (search_service !== undefined) {
|
|
41
|
+
const validServices = Object.values(SearchService);
|
|
42
|
+
if (!validServices.includes(search_service)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (crawl_results !== undefined && (typeof crawl_results !== 'number' || crawl_results < 0)) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
if (include_sites !== undefined && (!Array.isArray(include_sites) || !include_sites.every(site => typeof site === 'string'))) {
|
|
13
50
|
return false;
|
|
14
51
|
}
|
|
52
|
+
if (exclude_sites !== undefined && (!Array.isArray(exclude_sites) || !exclude_sites.every(site => typeof site === 'string'))) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
if (time_range !== undefined) {
|
|
56
|
+
const validTimeRanges = Object.values(TimeRange);
|
|
57
|
+
if (!validTimeRanges.includes(time_range)) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
15
61
|
return true;
|
|
16
62
|
}
|
|
17
63
|
export function isValidCrawlArgs(args) {
|
|
@@ -38,16 +84,34 @@ export function isValidNewsArgs(args) {
|
|
|
38
84
|
if (typeof args !== 'object' || args === null) {
|
|
39
85
|
return false;
|
|
40
86
|
}
|
|
41
|
-
const { query, max_results, search_service } = args;
|
|
87
|
+
const { query, max_results, search_service, crawl_results, include_sites, exclude_sites, time_range } = args;
|
|
42
88
|
if (typeof query !== 'string' || query.trim().length === 0) {
|
|
43
89
|
return false;
|
|
44
90
|
}
|
|
45
91
|
if (max_results !== undefined && (typeof max_results !== 'number' || max_results < 1 || max_results > 50)) {
|
|
46
92
|
return false;
|
|
47
93
|
}
|
|
48
|
-
if (search_service !== undefined
|
|
94
|
+
if (search_service !== undefined) {
|
|
95
|
+
const validServices = Object.values(NewsService);
|
|
96
|
+
if (!validServices.includes(search_service)) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (crawl_results !== undefined && (typeof crawl_results !== 'number' || crawl_results < 0)) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
if (include_sites !== undefined && (!Array.isArray(include_sites) || !include_sites.every(site => typeof site === 'string'))) {
|
|
49
104
|
return false;
|
|
50
105
|
}
|
|
106
|
+
if (exclude_sites !== undefined && (!Array.isArray(exclude_sites) || !exclude_sites.every(site => typeof site === 'string'))) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
if (time_range !== undefined) {
|
|
110
|
+
const validTimeRanges = Object.values(TimeRange);
|
|
111
|
+
if (!validTimeRanges.includes(time_range)) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
51
115
|
return true;
|
|
52
116
|
}
|
|
53
117
|
export function isValidReasoningArgs(args) {
|