one-search-mcp 1.0.1 → 1.0.2
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 +48 -1
- package/dist/index.cjs +40 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +40 -17
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ A Model Context Protocol (MCP) server implementation that integrates with Searxn
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
13
13
|
```shell
|
|
14
|
+
# Install globally
|
|
14
15
|
npm install -g one-search-mcp
|
|
15
16
|
```
|
|
16
17
|
|
|
@@ -19,9 +20,55 @@ npm install -g one-search-mcp
|
|
|
19
20
|
env SEARCH_API_KEY=YOUR_API_KEY SEARCH_API_URL=YOUR_API_URL npx -y one-search-mcp
|
|
20
21
|
```
|
|
21
22
|
|
|
23
|
+
## Environment Variables
|
|
24
|
+
|
|
25
|
+
- SEARCH_PROVIDER (Optional): The search provider to use, either `searxng` or `tavily`, default is `searxng`.
|
|
26
|
+
- SEARCH_API_URL (Optional): The URL of the SearxNG API, required for `searxng`.
|
|
27
|
+
- SEARCH_API_KEY (Optional): The API key for the search provider, required for `tavily`.
|
|
28
|
+
|
|
29
|
+
## Running on Cursor
|
|
30
|
+
|
|
31
|
+
Your `mcp.json` file will look like this:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"mcpServers": {
|
|
36
|
+
"one-search-mcp": {
|
|
37
|
+
"command": "npx",
|
|
38
|
+
"args": ["-y", "one-search-mcp"],
|
|
39
|
+
"env": {
|
|
40
|
+
"SEARCH_PROVIDER": "searxng",
|
|
41
|
+
"SEARCH_API_URL": "http://127.0.0.1:8080",
|
|
42
|
+
"SEARCH_API_KEY": "YOUR_API_KEY"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Running on Windsurf
|
|
50
|
+
|
|
51
|
+
Add this to your `./codeium/windsurf/model_config.json` file:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"mcpServers": {
|
|
56
|
+
"one-search-mcp": {
|
|
57
|
+
"command": "npx",
|
|
58
|
+
"args": ["-y", "one-search-mcp"],
|
|
59
|
+
"env": {
|
|
60
|
+
"SEARCH_PROVIDER": "searxng",
|
|
61
|
+
"SEARCH_API_URL": "http://127.0.0.1:8080",
|
|
62
|
+
"SEARCH_API_KEY": "YOUR_API_KEY"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
22
69
|
## Self-host
|
|
23
70
|
|
|
24
|
-
Local deployment of
|
|
71
|
+
Local deployment of SearXNG and Firecrawl, please refer to [Deploy](./deploy/README.md)
|
|
25
72
|
|
|
26
73
|
## License
|
|
27
74
|
|
package/dist/index.cjs
CHANGED
|
@@ -33,7 +33,7 @@ var import_types = require("@modelcontextprotocol/sdk/types.js");
|
|
|
33
33
|
// src/search.ts
|
|
34
34
|
var import_node_url = __toESM(require("url"), 1);
|
|
35
35
|
var import_core = require("@tavily/core");
|
|
36
|
-
async function searxngSearch(
|
|
36
|
+
async function searxngSearch(params) {
|
|
37
37
|
try {
|
|
38
38
|
const {
|
|
39
39
|
query,
|
|
@@ -45,8 +45,12 @@ async function searxngSearch(apiUrl, params) {
|
|
|
45
45
|
language = "auto",
|
|
46
46
|
timeRange = "",
|
|
47
47
|
timeout = 1e4,
|
|
48
|
-
apiKey
|
|
48
|
+
apiKey,
|
|
49
|
+
apiUrl
|
|
49
50
|
} = params;
|
|
51
|
+
if (!apiUrl) {
|
|
52
|
+
throw new Error("SearxNG API URL is required");
|
|
53
|
+
}
|
|
50
54
|
const controller = new AbortController();
|
|
51
55
|
const timeoutId = setTimeout(() => controller.abort(), Number(timeout));
|
|
52
56
|
const config2 = {
|
|
@@ -104,13 +108,15 @@ async function searxngSearch(apiUrl, params) {
|
|
|
104
108
|
success: false
|
|
105
109
|
};
|
|
106
110
|
} catch (err) {
|
|
107
|
-
|
|
111
|
+
const msg = err instanceof Error ? err.message : "Searxng search error.";
|
|
112
|
+
process.stdout.write(msg);
|
|
108
113
|
throw err;
|
|
109
114
|
}
|
|
110
115
|
}
|
|
111
116
|
var tvly = null;
|
|
112
|
-
async function tavilySearch(
|
|
117
|
+
async function tavilySearch(options) {
|
|
113
118
|
const {
|
|
119
|
+
query,
|
|
114
120
|
limit = 10,
|
|
115
121
|
categories = "general",
|
|
116
122
|
timeRange,
|
|
@@ -157,11 +163,11 @@ var SEARCH_TOOL = {
|
|
|
157
163
|
},
|
|
158
164
|
limit: {
|
|
159
165
|
type: "number",
|
|
160
|
-
description: "Maximum number of results to return (default:
|
|
166
|
+
description: "Maximum number of results to return (default: 10)"
|
|
161
167
|
},
|
|
162
168
|
language: {
|
|
163
169
|
type: "string",
|
|
164
|
-
description: "Language code for search results (default:
|
|
170
|
+
description: "Language code for search results (default: auto)"
|
|
165
171
|
},
|
|
166
172
|
categories: {
|
|
167
173
|
type: "string",
|
|
@@ -379,10 +385,6 @@ var server = new import_server.Server(
|
|
|
379
385
|
var SEARCH_API_URL = process.env.SEARCH_API_URL;
|
|
380
386
|
var SEARCH_API_KEY = process.env.SEARCH_API_KEY;
|
|
381
387
|
var SEARCH_PROVIDER = process.env.SEARCH_PROVIDER ?? "searxng";
|
|
382
|
-
if (!SEARCH_API_URL) {
|
|
383
|
-
process.stderr.write("SEARCH_API_URL must be set");
|
|
384
|
-
process.exit(1);
|
|
385
|
-
}
|
|
386
388
|
var SAFE_SEARCH = process.env.SAFE_SEARCH ?? 0;
|
|
387
389
|
var LIMIT = process.env.LIMIT ?? 10;
|
|
388
390
|
var CATEGORIES = process.env.CATEGORIES ?? "general";
|
|
@@ -425,15 +427,26 @@ server.setRequestHandler(import_types.CallToolRequestSchema, async (request) =>
|
|
|
425
427
|
throw new Error(`Invalid arguments for tool: [${name}]`);
|
|
426
428
|
}
|
|
427
429
|
try {
|
|
428
|
-
const { results, success } = await processSearch(
|
|
430
|
+
const { results, success } = await processSearch({
|
|
429
431
|
...config,
|
|
430
432
|
...args,
|
|
431
|
-
apiKey: SEARCH_API_KEY ?? ""
|
|
433
|
+
apiKey: SEARCH_API_KEY ?? "",
|
|
434
|
+
apiUrl: SEARCH_API_URL ?? ""
|
|
432
435
|
});
|
|
433
436
|
if (!success) {
|
|
434
437
|
throw new Error("Failed to search");
|
|
435
438
|
}
|
|
439
|
+
const resultsText = results.map((result) => `Title: ${result.title}
|
|
440
|
+
URL: ${result.url}
|
|
441
|
+
Description: ${result.snippet}
|
|
442
|
+
${result.markdown ? `Content: ${result.markdown}` : ""}`);
|
|
436
443
|
return {
|
|
444
|
+
content: [
|
|
445
|
+
{
|
|
446
|
+
type: "text",
|
|
447
|
+
text: resultsText.join("\n\n")
|
|
448
|
+
}
|
|
449
|
+
],
|
|
437
450
|
results,
|
|
438
451
|
success
|
|
439
452
|
};
|
|
@@ -445,7 +458,12 @@ server.setRequestHandler(import_types.CallToolRequestSchema, async (request) =>
|
|
|
445
458
|
const msg = error instanceof Error ? error.message : "Unknown error";
|
|
446
459
|
return {
|
|
447
460
|
success: false,
|
|
448
|
-
|
|
461
|
+
content: [
|
|
462
|
+
{
|
|
463
|
+
type: "text",
|
|
464
|
+
text: msg
|
|
465
|
+
}
|
|
466
|
+
]
|
|
449
467
|
};
|
|
450
468
|
}
|
|
451
469
|
}
|
|
@@ -466,7 +484,12 @@ server.setRequestHandler(import_types.CallToolRequestSchema, async (request) =>
|
|
|
466
484
|
});
|
|
467
485
|
return {
|
|
468
486
|
success: false,
|
|
469
|
-
|
|
487
|
+
content: [
|
|
488
|
+
{
|
|
489
|
+
type: "text",
|
|
490
|
+
text: msg
|
|
491
|
+
}
|
|
492
|
+
]
|
|
470
493
|
};
|
|
471
494
|
} finally {
|
|
472
495
|
server.sendLoggingMessage({
|
|
@@ -475,16 +498,16 @@ server.setRequestHandler(import_types.CallToolRequestSchema, async (request) =>
|
|
|
475
498
|
});
|
|
476
499
|
}
|
|
477
500
|
});
|
|
478
|
-
async function processSearch(
|
|
501
|
+
async function processSearch(args) {
|
|
479
502
|
switch (SEARCH_PROVIDER) {
|
|
480
503
|
case "searxng":
|
|
481
|
-
return await searxngSearch(
|
|
504
|
+
return await searxngSearch({
|
|
482
505
|
...config,
|
|
483
506
|
...args,
|
|
484
507
|
apiKey: SEARCH_API_KEY
|
|
485
508
|
});
|
|
486
509
|
case "tavily":
|
|
487
|
-
return await tavilySearch(
|
|
510
|
+
return await tavilySearch({
|
|
488
511
|
...config,
|
|
489
512
|
...args,
|
|
490
513
|
apiKey: SEARCH_API_KEY
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/search.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Server } from '@modelcontextprotocol/sdk/server/index.js';\nimport { CallToolRequestSchema, ListToolsRequestSchema, Tool } from '@modelcontextprotocol/sdk/types.js';\nimport { ISearchRequestOptions, ISearchResponse, Provider } from './interface.js';\nimport { searxngSearch, tavilySearch } from './search.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport dotenvx from '@dotenvx/dotenvx';\n\ndotenvx.config();\n\n// tools definition\nconst SEARCH_TOOL: Tool = {\n name: 'one_search',\n description:\n 'Search and retrieve content from web pages. ' +\n 'Returns SERP results by default (url, title, description).',\n inputSchema: {\n type: 'object',\n properties: {\n query: {\n type: 'string',\n description: 'Search query string',\n },\n limit: {\n type: 'number',\n description: 'Maximum number of results to return (default: 5)',\n },\n language: {\n type: 'string',\n description: 'Language code for search results (default: en)',\n },\n categories: {\n type: 'string',\n description: 'Categories to search for (default: general)',\n },\n timeRange: {\n type: 'string',\n description: 'Time range for search results (default: all)',\n },\n },\n required: ['query'],\n },\n};\n\nconst SCRAPE_TOOL: Tool = {\n name: 'one_scrape',\n description:\n 'Scrape a single webpage with advanced options for content extraction. ' +\n 'Supports various formats including markdown, HTML, and screenshots. ' +\n 'Can execute custom actions like clicking or scrolling before scraping.',\n inputSchema: {\n type: 'object',\n properties: {\n url: {\n type: 'string',\n description: 'The URL to scrape',\n },\n formats: {\n type: 'array',\n items: {\n type: 'string',\n enum: [\n 'markdown',\n 'html',\n 'rawHtml',\n 'screenshot',\n 'links',\n 'screenshot@fullPage',\n 'extract',\n ],\n },\n description: \"Content formats to extract (default: ['markdown'])\",\n },\n onlyMainContent: {\n type: 'boolean',\n description:\n 'Extract only the main content, filtering out navigation, footers, etc.',\n },\n includeTags: {\n type: 'array',\n items: { type: 'string' },\n description: 'HTML tags to specifically include in extraction',\n },\n excludeTags: {\n type: 'array',\n items: { type: 'string' },\n description: 'HTML tags to exclude from extraction',\n },\n waitFor: {\n type: 'number',\n description: 'Time in milliseconds to wait for dynamic content to load',\n },\n timeout: {\n type: 'number',\n description:\n 'Maximum time in milliseconds to wait for the page to load',\n },\n actions: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: [\n 'wait',\n 'click',\n 'screenshot',\n 'write',\n 'press',\n 'scroll',\n 'scrape',\n 'executeJavascript',\n ],\n description: 'Type of action to perform',\n },\n selector: {\n type: 'string',\n description: 'CSS selector for the target element',\n },\n milliseconds: {\n type: 'number',\n description: 'Time to wait in milliseconds (for wait action)',\n },\n text: {\n type: 'string',\n description: 'Text to write (for write action)',\n },\n key: {\n type: 'string',\n description: 'Key to press (for press action)',\n },\n direction: {\n type: 'string',\n enum: ['up', 'down'],\n description: 'Scroll direction',\n },\n script: {\n type: 'string',\n description: 'JavaScript code to execute',\n },\n fullPage: {\n type: 'boolean',\n description: 'Take full page screenshot',\n },\n },\n required: ['type'],\n },\n description: 'List of actions to perform before scraping',\n },\n extract: {\n type: 'object',\n properties: {\n schema: {\n type: 'object',\n description: 'Schema for structured data extraction',\n },\n systemPrompt: {\n type: 'string',\n description: 'System prompt for LLM extraction',\n },\n prompt: {\n type: 'string',\n description: 'User prompt for LLM extraction',\n },\n },\n description: 'Configuration for structured data extraction',\n },\n mobile: {\n type: 'boolean',\n description: 'Use mobile viewport',\n },\n skipTlsVerification: {\n type: 'boolean',\n description: 'Skip TLS certificate verification',\n },\n removeBase64Images: {\n type: 'boolean',\n description: 'Remove base64 encoded images from output',\n },\n location: {\n type: 'object',\n properties: {\n country: {\n type: 'string',\n description: 'Country code for geolocation',\n },\n languages: {\n type: 'array',\n items: { type: 'string' },\n description: 'Language codes for content',\n },\n },\n description: 'Location settings for scraping',\n },\n },\n required: ['url'],\n },\n};\n\nconst EXTRACT_TOOL: Tool = {\n name: 'one_extract',\n description:\n 'Extract structured information from web pages using LLM. ' +\n 'Supports both cloud AI and self-hosted LLM extraction.',\n inputSchema: {\n type: 'object',\n properties: {\n urls: {\n type: 'array',\n items: { type: 'string' },\n description: 'List of URLs to extract information from',\n },\n prompt: {\n type: 'string',\n description: 'Prompt for the LLM extraction',\n },\n systemPrompt: {\n type: 'string',\n description: 'System prompt for LLM extraction',\n },\n schema: {\n type: 'object',\n description: 'JSON schema for structured data extraction',\n },\n allowExternalLinks: {\n type: 'boolean',\n description: 'Allow extraction from external links',\n },\n enableWebSearch: {\n type: 'boolean',\n description: 'Enable web search for additional context',\n },\n includeSubdomains: {\n type: 'boolean',\n description: 'Include subdomains in extraction',\n },\n },\n required: ['urls'],\n },\n};\n\n// Server implementation\nconst server = new Server(\n {\n name: 'one-search-mcp',\n version: '0.0.1',\n },\n {\n capabilities: {\n tools: {},\n logging: {},\n },\n },\n);\n\n// searxng api\nconst SEARCH_API_URL = process.env.SEARCH_API_URL;\nconst SEARCH_API_KEY = process.env.SEARCH_API_KEY;\nconst SEARCH_PROVIDER: Provider = process.env.SEARCH_PROVIDER as Provider ?? 'searxng';\n\nif (!SEARCH_API_URL) {\n process.stderr.write('SEARCH_API_URL must be set');\n process.exit(1);\n}\n\n// query params\nconst SAFE_SEARCH = process.env.SAFE_SEARCH ?? 0;\nconst LIMIT = process.env.LIMIT ?? 10;\nconst CATEGORIES = process.env.CATEGORIES ?? 'general';\nconst ENGINES = process.env.ENGINES ?? 'all';\nconst FORMAT = process.env.FORMAT ?? 'json';\nconst LANGUAGE = process.env.LANGUAGE ?? 'auto';\nconst TIME_RANGE = process.env.TIME_RANGE ?? '';\nconst DEFAULT_TIMEOUT = process.env.TIMEOUT ?? 10000;\n\nconst config = {\n pageno: LIMIT,\n categories: CATEGORIES,\n format: FORMAT,\n safesearch: SAFE_SEARCH,\n language: LANGUAGE,\n engines: ENGINES,\n time_range: TIME_RANGE,\n timeout: DEFAULT_TIMEOUT,\n};\n\n// Tool handlers\nserver.setRequestHandler(ListToolsRequestSchema, async () => ({\n tools: [\n SEARCH_TOOL,\n EXTRACT_TOOL,\n SCRAPE_TOOL,\n ],\n}));\n\nserver.setRequestHandler(CallToolRequestSchema, async (request) => {\n const startTime = Date.now();\n\n try {\n const { name, arguments: args } = request.params;\n\n if (!args) {\n throw new Error('No arguments provided');\n }\n \n server.sendLoggingMessage({\n level: 'info',\n data: `[${new Date().toISOString()}] Received request for tool: [${name}]`,\n });\n \n switch (name) {\n case 'one_search': {\n // check args.\n if (!checkSearchArgs(args)) {\n throw new Error(`Invalid arguments for tool: [${name}]`);\n }\n try {\n const { results, success } = await processSearch(SEARCH_API_URL, {\n ...config,\n ...args,\n apiKey: SEARCH_API_KEY ?? '',\n });\n if (!success) {\n throw new Error('Failed to search');\n }\n return {\n results,\n success,\n };\n } catch (error) {\n server.sendLoggingMessage({\n level: 'error',\n data: `[${new Date().toISOString()}] Error searching: ${error}`,\n });\n const msg = error instanceof Error ? error.message : 'Unknown error';\n return {\n success: false,\n error: msg,\n };\n }\n }\n default:\n throw new Error(`Unknown tool: ${name}`);\n }\n } catch(error) {\n const msg = error instanceof Error ? error.message : String(error);\n server.sendLoggingMessage({\n level: 'error',\n data: {\n message: `[${new Date().toISOString()}] Error processing request: ${msg}`,\n tool: request.params.name,\n arguments: request.params.arguments,\n timestamp: new Date().toISOString(),\n duration: Date.now() - startTime,\n },\n });\n return {\n success: false,\n error: error instanceof Error ? error.message : msg,\n };\n } finally {\n server.sendLoggingMessage({\n level: 'info',\n data: `[${new Date().toISOString()}] Request completed in ${Date.now() - startTime}ms`,\n });\n }\n});\n\nasync function processSearch(apiUrl: string, args: ISearchRequestOptions): Promise<ISearchResponse> {\n switch (SEARCH_PROVIDER) {\n case 'searxng':\n return await searxngSearch(apiUrl, {\n ...config,\n ...args,\n apiKey: SEARCH_API_KEY,\n });\n case 'tavily':\n return await tavilySearch(apiUrl, {\n ...config,\n ...args,\n apiKey: SEARCH_API_KEY,\n });\n default:\n throw new Error(`Unsupported search provider: ${SEARCH_PROVIDER}`);\n }\n}\n\nfunction checkSearchArgs(args: unknown): args is ISearchRequestOptions {\n return (\n typeof args === 'object' &&\n args !== null &&\n 'query' in args &&\n typeof args.query === 'string'\n );\n}\n\nasync function runServer() {\n try {\n process.stdout.write('Starting OneSearch MCP server...\\n');\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n\n server.sendLoggingMessage({\n level: 'info',\n data: 'OneSearch MCP server started',\n });\n\n } catch (error) {\n const msg = error instanceof Error ? error.message : String(error);\n process.stderr.write(`Error starting server: ${msg}\\n`);\n process.exit(1);\n }\n}\n\n// run server\nrunServer().catch((error) => {\n const msg = error instanceof Error ? error.message : String(error);\n process.stderr.write(`Error running server: ${msg}\\n`);\n process.exit(1);\n});\n\n// export types\nexport * from './interface.js';\n","import url from 'node:url';\nimport { tavily, TavilyClient, TavilySearchOptions } from '@tavily/core';\nimport { ISearchRequestOptions, ISearchResponse, ISearchResponseResult } from './interface.js';\n\n/**\n * SearxNG Search API\n * - https://docs.searxng.org/dev/search_api.html\n */\nexport async function searxngSearch(apiUrl: string, params: ISearchRequestOptions): Promise<ISearchResponse> {\n try {\n const {\n query,\n limit = 10,\n categories = 'general',\n engines = 'all',\n safeSearch = 0,\n format = 'json',\n language = 'auto',\n timeRange = '',\n timeout = 10000,\n apiKey = '',\n } = params;\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), Number(timeout));\n\n const config = {\n q: query,\n pageno: limit,\n categories,\n format,\n safesearch: safeSearch,\n language,\n engines,\n time_range: timeRange,\n };\n\n const endpoint = `${apiUrl}/search`;\n\n const queryParams = url.format({ query: config });\n\n const headers: HeadersInit = {\n 'Content-Type': 'application/json',\n };\n\n if (apiKey) {\n headers['Authorization'] = `Bearer ${apiKey}`;\n }\n\n const res = await fetch(`${endpoint}${queryParams}`, {\n method: 'POST',\n headers,\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n const result = await res.json();\n if (result.results) {\n const results: ISearchResponseResult[] = result.results.map((item: Record<string, unknown>) => {\n const image = item.img_src ? {\n thumbnail: item.thumbnail_src,\n src: item.img_src,\n } : null;\n const video = item.iframe_src ? {\n thumbnail: item.thumbnail_src,\n src: item.iframe_src,\n } : null;\n return {\n title: item.title,\n snippet: item.content,\n url: item.url,\n source: item.source,\n image,\n video,\n engine: item.engine,\n };\n });\n return {\n results,\n success: true,\n };\n }\n return {\n results: [],\n success: false,\n };\n } catch (err: any) {\n process.stdout.write(err?.message ?? 'Searxng search error.');\n throw err;\n }\n}\n\n\nlet tvly: TavilyClient | null = null;\nexport async function tavilySearch(query: string, options: ISearchRequestOptions): Promise<ISearchResponse> {\n const {\n limit = 10,\n categories = 'general',\n timeRange,\n apiKey,\n } = options;\n\n if (!apiKey) {\n throw new Error('Tavily API key is required');\n }\n\n if (!tvly) {\n tvly = tavily({\n apiKey,\n });\n }\n\n const params: TavilySearchOptions = {\n topic: categories as TavilySearchOptions['topic'],\n timeRange: timeRange as TavilySearchOptions['timeRange'],\n maxResults: limit,\n };\n\n const res = await tvly.search(query, params);\n const results = res.results.map(item => ({\n title: item.title,\n url: item.url,\n snippet: item.content,\n }));\n\n return {\n results,\n success: true,\n };\n}\n"],"mappings":";;;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AAAA,MACV,CAAC;AAAA,IACH,KAAK;AACH,aAAO,MAAM,aAAa,QAAQ;AAAA,QAChC,GAAG;AAAA,QACH,GAAG;AAAA,QACH,QAAQ;AAAA,MACV,CAAC;AAAA,IACH;AACE,YAAM,IAAI,MAAM,gCAAgC,eAAe,EAAE;AAAA,EACnE;AACF;AAEA,SAAS,gBAAgB,MAA8C;AACrE,SACE,OAAO,SAAS,YAChB,SAAS,QACT,WAAW,QACX,OAAO,KAAK,UAAU;AAE1B;AAEA,eAAe,YAAY;AACzB,MAAI;AACF,YAAQ,OAAO,MAAM,oCAAoC;AAEzD,UAAM,YAAY,IAAI,kCAAqB;AAC3C,UAAM,OAAO,QAAQ,SAAS;AAE9B,WAAO,mBAAmB;AAAA,MACxB,OAAO;AAAA,MACP,MAAM;AAAA,IACR,CAAC;AAAA,EAEH,SAAS,OAAO;AACd,UAAM,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACjE,YAAQ,OAAO,MAAM,0BAA0B,GAAG;AAAA,CAAI;AACtD,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAGA,UAAU,EAAE,MAAM,CAAC,UAAU;AAC3B,QAAM,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACjE,UAAQ,OAAO,MAAM,yBAAyB,GAAG;AAAA,CAAI;AACrD,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["config","url","dotenvx"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/search.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Server } from '@modelcontextprotocol/sdk/server/index.js';\nimport { CallToolRequestSchema, ListToolsRequestSchema, Tool } from '@modelcontextprotocol/sdk/types.js';\nimport { ISearchRequestOptions, ISearchResponse, Provider } from './interface.js';\nimport { searxngSearch, tavilySearch } from './search.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport dotenvx from '@dotenvx/dotenvx';\n\ndotenvx.config();\n\n// tools definition\nconst SEARCH_TOOL: Tool = {\n name: 'one_search',\n description:\n 'Search and retrieve content from web pages. ' +\n 'Returns SERP results by default (url, title, description).',\n inputSchema: {\n type: 'object',\n properties: {\n query: {\n type: 'string',\n description: 'Search query string',\n },\n limit: {\n type: 'number',\n description: 'Maximum number of results to return (default: 10)',\n },\n language: {\n type: 'string',\n description: 'Language code for search results (default: auto)',\n },\n categories: {\n type: 'string',\n description: 'Categories to search for (default: general)',\n },\n timeRange: {\n type: 'string',\n description: 'Time range for search results (default: all)',\n },\n },\n required: ['query'],\n },\n};\n\nconst SCRAPE_TOOL: Tool = {\n name: 'one_scrape',\n description:\n 'Scrape a single webpage with advanced options for content extraction. ' +\n 'Supports various formats including markdown, HTML, and screenshots. ' +\n 'Can execute custom actions like clicking or scrolling before scraping.',\n inputSchema: {\n type: 'object',\n properties: {\n url: {\n type: 'string',\n description: 'The URL to scrape',\n },\n formats: {\n type: 'array',\n items: {\n type: 'string',\n enum: [\n 'markdown',\n 'html',\n 'rawHtml',\n 'screenshot',\n 'links',\n 'screenshot@fullPage',\n 'extract',\n ],\n },\n description: \"Content formats to extract (default: ['markdown'])\",\n },\n onlyMainContent: {\n type: 'boolean',\n description:\n 'Extract only the main content, filtering out navigation, footers, etc.',\n },\n includeTags: {\n type: 'array',\n items: { type: 'string' },\n description: 'HTML tags to specifically include in extraction',\n },\n excludeTags: {\n type: 'array',\n items: { type: 'string' },\n description: 'HTML tags to exclude from extraction',\n },\n waitFor: {\n type: 'number',\n description: 'Time in milliseconds to wait for dynamic content to load',\n },\n timeout: {\n type: 'number',\n description:\n 'Maximum time in milliseconds to wait for the page to load',\n },\n actions: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: [\n 'wait',\n 'click',\n 'screenshot',\n 'write',\n 'press',\n 'scroll',\n 'scrape',\n 'executeJavascript',\n ],\n description: 'Type of action to perform',\n },\n selector: {\n type: 'string',\n description: 'CSS selector for the target element',\n },\n milliseconds: {\n type: 'number',\n description: 'Time to wait in milliseconds (for wait action)',\n },\n text: {\n type: 'string',\n description: 'Text to write (for write action)',\n },\n key: {\n type: 'string',\n description: 'Key to press (for press action)',\n },\n direction: {\n type: 'string',\n enum: ['up', 'down'],\n description: 'Scroll direction',\n },\n script: {\n type: 'string',\n description: 'JavaScript code to execute',\n },\n fullPage: {\n type: 'boolean',\n description: 'Take full page screenshot',\n },\n },\n required: ['type'],\n },\n description: 'List of actions to perform before scraping',\n },\n extract: {\n type: 'object',\n properties: {\n schema: {\n type: 'object',\n description: 'Schema for structured data extraction',\n },\n systemPrompt: {\n type: 'string',\n description: 'System prompt for LLM extraction',\n },\n prompt: {\n type: 'string',\n description: 'User prompt for LLM extraction',\n },\n },\n description: 'Configuration for structured data extraction',\n },\n mobile: {\n type: 'boolean',\n description: 'Use mobile viewport',\n },\n skipTlsVerification: {\n type: 'boolean',\n description: 'Skip TLS certificate verification',\n },\n removeBase64Images: {\n type: 'boolean',\n description: 'Remove base64 encoded images from output',\n },\n location: {\n type: 'object',\n properties: {\n country: {\n type: 'string',\n description: 'Country code for geolocation',\n },\n languages: {\n type: 'array',\n items: { type: 'string' },\n description: 'Language codes for content',\n },\n },\n description: 'Location settings for scraping',\n },\n },\n required: ['url'],\n },\n};\n\nconst EXTRACT_TOOL: Tool = {\n name: 'one_extract',\n description:\n 'Extract structured information from web pages using LLM. ' +\n 'Supports both cloud AI and self-hosted LLM extraction.',\n inputSchema: {\n type: 'object',\n properties: {\n urls: {\n type: 'array',\n items: { type: 'string' },\n description: 'List of URLs to extract information from',\n },\n prompt: {\n type: 'string',\n description: 'Prompt for the LLM extraction',\n },\n systemPrompt: {\n type: 'string',\n description: 'System prompt for LLM extraction',\n },\n schema: {\n type: 'object',\n description: 'JSON schema for structured data extraction',\n },\n allowExternalLinks: {\n type: 'boolean',\n description: 'Allow extraction from external links',\n },\n enableWebSearch: {\n type: 'boolean',\n description: 'Enable web search for additional context',\n },\n includeSubdomains: {\n type: 'boolean',\n description: 'Include subdomains in extraction',\n },\n },\n required: ['urls'],\n },\n};\n\n// Server implementation\nconst server = new Server(\n {\n name: 'one-search-mcp',\n version: '0.0.1',\n },\n {\n capabilities: {\n tools: {},\n logging: {},\n },\n },\n);\n\n// searxng api\nconst SEARCH_API_URL = process.env.SEARCH_API_URL;\nconst SEARCH_API_KEY = process.env.SEARCH_API_KEY;\nconst SEARCH_PROVIDER: Provider = process.env.SEARCH_PROVIDER as Provider ?? 'searxng';\n\n// query params\nconst SAFE_SEARCH = process.env.SAFE_SEARCH ?? 0;\nconst LIMIT = process.env.LIMIT ?? 10;\nconst CATEGORIES = process.env.CATEGORIES ?? 'general';\nconst ENGINES = process.env.ENGINES ?? 'all';\nconst FORMAT = process.env.FORMAT ?? 'json';\nconst LANGUAGE = process.env.LANGUAGE ?? 'auto';\nconst TIME_RANGE = process.env.TIME_RANGE ?? '';\nconst DEFAULT_TIMEOUT = process.env.TIMEOUT ?? 10000;\n\nconst config = {\n pageno: LIMIT,\n categories: CATEGORIES,\n format: FORMAT,\n safesearch: SAFE_SEARCH,\n language: LANGUAGE,\n engines: ENGINES,\n time_range: TIME_RANGE,\n timeout: DEFAULT_TIMEOUT,\n};\n\n// Tool handlers\nserver.setRequestHandler(ListToolsRequestSchema, async () => ({\n tools: [\n SEARCH_TOOL,\n EXTRACT_TOOL,\n SCRAPE_TOOL,\n ],\n}));\n\nserver.setRequestHandler(CallToolRequestSchema, async (request) => {\n const startTime = Date.now();\n\n try {\n const { name, arguments: args } = request.params;\n\n if (!args) {\n throw new Error('No arguments provided');\n }\n \n server.sendLoggingMessage({\n level: 'info',\n data: `[${new Date().toISOString()}] Received request for tool: [${name}]`,\n });\n \n switch (name) {\n case 'one_search': {\n // check args.\n if (!checkSearchArgs(args)) {\n throw new Error(`Invalid arguments for tool: [${name}]`);\n }\n try {\n const { results, success } = await processSearch({\n ...config,\n ...args,\n apiKey: SEARCH_API_KEY ?? '',\n apiUrl: SEARCH_API_URL ?? '',\n });\n if (!success) {\n throw new Error('Failed to search');\n }\n const resultsText = results.map((result) => (\n `Title: ${result.title}\nURL: ${result.url}\nDescription: ${result.snippet}\n${result.markdown ? `Content: ${result.markdown}` : ''}`\n ));\n return {\n content: [\n {\n type: 'text',\n text: resultsText.join('\\n\\n'),\n },\n ],\n results,\n success,\n };\n } catch (error) {\n server.sendLoggingMessage({\n level: 'error',\n data: `[${new Date().toISOString()}] Error searching: ${error}`,\n });\n const msg = error instanceof Error ? error.message : 'Unknown error';\n return {\n success: false,\n content: [\n {\n type: 'text',\n text: msg,\n },\n ],\n };\n }\n }\n default:\n throw new Error(`Unknown tool: ${name}`);\n }\n } catch(error) {\n const msg = error instanceof Error ? error.message : String(error);\n server.sendLoggingMessage({\n level: 'error',\n data: {\n message: `[${new Date().toISOString()}] Error processing request: ${msg}`,\n tool: request.params.name,\n arguments: request.params.arguments,\n timestamp: new Date().toISOString(),\n duration: Date.now() - startTime,\n },\n });\n return {\n success: false,\n content: [\n {\n type: 'text',\n text: msg,\n },\n ],\n };\n } finally {\n server.sendLoggingMessage({\n level: 'info',\n data: `[${new Date().toISOString()}] Request completed in ${Date.now() - startTime}ms`,\n });\n }\n});\n\nasync function processSearch(args: ISearchRequestOptions): Promise<ISearchResponse> {\n switch (SEARCH_PROVIDER) {\n case 'searxng':\n return await searxngSearch({\n ...config,\n ...args,\n apiKey: SEARCH_API_KEY,\n });\n case 'tavily':\n return await tavilySearch({\n ...config,\n ...args,\n apiKey: SEARCH_API_KEY,\n });\n default:\n throw new Error(`Unsupported search provider: ${SEARCH_PROVIDER}`);\n }\n}\n\nfunction checkSearchArgs(args: unknown): args is ISearchRequestOptions {\n return (\n typeof args === 'object' &&\n args !== null &&\n 'query' in args &&\n typeof args.query === 'string'\n );\n}\n\nasync function runServer() {\n try {\n process.stdout.write('Starting OneSearch MCP server...\\n');\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n\n server.sendLoggingMessage({\n level: 'info',\n data: 'OneSearch MCP server started',\n });\n\n } catch (error) {\n const msg = error instanceof Error ? error.message : String(error);\n process.stderr.write(`Error starting server: ${msg}\\n`);\n process.exit(1);\n }\n}\n\n// run server\nrunServer().catch((error) => {\n const msg = error instanceof Error ? error.message : String(error);\n process.stderr.write(`Error running server: ${msg}\\n`);\n process.exit(1);\n});\n\n// export types\nexport * from './interface.js';\n","import url from 'node:url';\nimport { tavily, TavilyClient, TavilySearchOptions } from '@tavily/core';\nimport { ISearchRequestOptions, ISearchResponse, ISearchResponseResult } from './interface.js';\n\n/**\n * SearxNG Search API\n * - https://docs.searxng.org/dev/search_api.html\n */\nexport async function searxngSearch(params: ISearchRequestOptions): Promise<ISearchResponse> {\n try {\n const {\n query,\n limit = 10,\n categories = 'general',\n engines = 'all',\n safeSearch = 0,\n format = 'json',\n language = 'auto',\n timeRange = '',\n timeout = 10000,\n apiKey,\n apiUrl,\n } = params;\n\n if (!apiUrl) {\n throw new Error('SearxNG API URL is required');\n }\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), Number(timeout));\n\n const config = {\n q: query,\n pageno: limit,\n categories,\n format,\n safesearch: safeSearch,\n language,\n engines,\n time_range: timeRange,\n };\n\n const endpoint = `${apiUrl}/search`;\n\n const queryParams = url.format({ query: config });\n\n const headers: HeadersInit = {\n 'Content-Type': 'application/json',\n };\n\n if (apiKey) {\n headers['Authorization'] = `Bearer ${apiKey}`;\n }\n\n const res = await fetch(`${endpoint}${queryParams}`, {\n method: 'POST',\n headers,\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n const result = await res.json();\n if (result.results) {\n const results: ISearchResponseResult[] = result.results.map((item: Record<string, unknown>) => {\n const image = item.img_src ? {\n thumbnail: item.thumbnail_src,\n src: item.img_src,\n } : null;\n const video = item.iframe_src ? {\n thumbnail: item.thumbnail_src,\n src: item.iframe_src,\n } : null;\n return {\n title: item.title,\n snippet: item.content,\n url: item.url,\n source: item.source,\n image,\n video,\n engine: item.engine,\n };\n });\n return {\n results,\n success: true,\n };\n }\n return {\n results: [],\n success: false,\n };\n } catch (err: unknown) {\n const msg = err instanceof Error ? err.message : 'Searxng search error.';\n process.stdout.write(msg);\n throw err;\n }\n}\n\n\nlet tvly: TavilyClient | null = null;\nexport async function tavilySearch(options: ISearchRequestOptions): Promise<ISearchResponse> {\n const {\n query,\n limit = 10,\n categories = 'general',\n timeRange,\n apiKey,\n } = options;\n\n if (!apiKey) {\n throw new Error('Tavily API key is required');\n }\n\n if (!tvly) {\n tvly = tavily({\n apiKey,\n });\n }\n\n const params: TavilySearchOptions = {\n topic: categories as TavilySearchOptions['topic'],\n timeRange: timeRange as TavilySearchOptions['timeRange'],\n maxResults: limit,\n };\n\n const res = await tvly.search(query, params);\n const results = res.results.map(item => ({\n title: item.title,\n url: item.url,\n snippet: item.content,\n }));\n\n return {\n results,\n success: true,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAEA,oBAAuB;AACvB,mBAAqE;;;ACHrE,sBAAgB;AAChB,kBAA0D;AAO1D,eAAsB,cAAc,QAAyD;AAC3F,MAAI;AACF,UAAM;AAAA,MACJ;AAAA,MACA,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,UAAU;AAAA,MACV,aAAa;AAAA,MACb,SAAS;AAAA,MACT,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,UAAU;AAAA,MACV;AAAA,MACA;AAAA,IACF,IAAI;AAEJ,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,6BAA6B;AAAA,IAC/C;AAEA,UAAM,aAAa,IAAI,gBAAgB;AACvC,UAAM,YAAY,WAAW,MAAM,WAAW,MAAM,GAAG,OAAO,OAAO,CAAC;AAEtE,UAAMA,UAAS;AAAA,MACb,GAAG;AAAA,MACH,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA,YAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA,YAAY;AAAA,IACd;AAEA,UAAM,WAAW,GAAG,MAAM;AAE1B,UAAM,cAAc,gBAAAC,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AAY;AACzB,MAAI;AACF,YAAQ,OAAO,MAAM,oCAAoC;AAEzD,UAAM,YAAY,IAAI,kCAAqB;AAC3C,UAAM,OAAO,QAAQ,SAAS;AAE9B,WAAO,mBAAmB;AAAA,MACxB,OAAO;AAAA,MACP,MAAM;AAAA,IACR,CAAC;AAAA,EAEH,SAAS,OAAO;AACd,UAAM,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACjE,YAAQ,OAAO,MAAM,0BAA0B,GAAG;AAAA,CAAI;AACtD,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAGA,UAAU,EAAE,MAAM,CAAC,UAAU;AAC3B,QAAM,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACjE,UAAQ,OAAO,MAAM,yBAAyB,GAAG;AAAA,CAAI;AACrD,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["config","url","dotenvx"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -14,11 +14,13 @@ interface ISearchRequestOptions {
|
|
|
14
14
|
timeRange?: string;
|
|
15
15
|
timeout?: number | string;
|
|
16
16
|
apiKey?: string;
|
|
17
|
+
apiUrl?: string;
|
|
17
18
|
}
|
|
18
19
|
interface ISearchResponseResult {
|
|
19
20
|
title: string;
|
|
20
21
|
snippet: string;
|
|
21
22
|
url: string;
|
|
23
|
+
markdown?: string;
|
|
22
24
|
source?: string;
|
|
23
25
|
engine?: string;
|
|
24
26
|
image?: IMediaItem | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -14,11 +14,13 @@ interface ISearchRequestOptions {
|
|
|
14
14
|
timeRange?: string;
|
|
15
15
|
timeout?: number | string;
|
|
16
16
|
apiKey?: string;
|
|
17
|
+
apiUrl?: string;
|
|
17
18
|
}
|
|
18
19
|
interface ISearchResponseResult {
|
|
19
20
|
title: string;
|
|
20
21
|
snippet: string;
|
|
21
22
|
url: string;
|
|
23
|
+
markdown?: string;
|
|
22
24
|
source?: string;
|
|
23
25
|
engine?: string;
|
|
24
26
|
image?: IMediaItem | null;
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprot
|
|
|
7
7
|
// src/search.ts
|
|
8
8
|
import url from "node:url";
|
|
9
9
|
import { tavily } from "@tavily/core";
|
|
10
|
-
async function searxngSearch(
|
|
10
|
+
async function searxngSearch(params) {
|
|
11
11
|
try {
|
|
12
12
|
const {
|
|
13
13
|
query,
|
|
@@ -19,8 +19,12 @@ async function searxngSearch(apiUrl, params) {
|
|
|
19
19
|
language = "auto",
|
|
20
20
|
timeRange = "",
|
|
21
21
|
timeout = 1e4,
|
|
22
|
-
apiKey
|
|
22
|
+
apiKey,
|
|
23
|
+
apiUrl
|
|
23
24
|
} = params;
|
|
25
|
+
if (!apiUrl) {
|
|
26
|
+
throw new Error("SearxNG API URL is required");
|
|
27
|
+
}
|
|
24
28
|
const controller = new AbortController();
|
|
25
29
|
const timeoutId = setTimeout(() => controller.abort(), Number(timeout));
|
|
26
30
|
const config2 = {
|
|
@@ -78,13 +82,15 @@ async function searxngSearch(apiUrl, params) {
|
|
|
78
82
|
success: false
|
|
79
83
|
};
|
|
80
84
|
} catch (err) {
|
|
81
|
-
|
|
85
|
+
const msg = err instanceof Error ? err.message : "Searxng search error.";
|
|
86
|
+
process.stdout.write(msg);
|
|
82
87
|
throw err;
|
|
83
88
|
}
|
|
84
89
|
}
|
|
85
90
|
var tvly = null;
|
|
86
|
-
async function tavilySearch(
|
|
91
|
+
async function tavilySearch(options) {
|
|
87
92
|
const {
|
|
93
|
+
query,
|
|
88
94
|
limit = 10,
|
|
89
95
|
categories = "general",
|
|
90
96
|
timeRange,
|
|
@@ -131,11 +137,11 @@ var SEARCH_TOOL = {
|
|
|
131
137
|
},
|
|
132
138
|
limit: {
|
|
133
139
|
type: "number",
|
|
134
|
-
description: "Maximum number of results to return (default:
|
|
140
|
+
description: "Maximum number of results to return (default: 10)"
|
|
135
141
|
},
|
|
136
142
|
language: {
|
|
137
143
|
type: "string",
|
|
138
|
-
description: "Language code for search results (default:
|
|
144
|
+
description: "Language code for search results (default: auto)"
|
|
139
145
|
},
|
|
140
146
|
categories: {
|
|
141
147
|
type: "string",
|
|
@@ -353,10 +359,6 @@ var server = new Server(
|
|
|
353
359
|
var SEARCH_API_URL = process.env.SEARCH_API_URL;
|
|
354
360
|
var SEARCH_API_KEY = process.env.SEARCH_API_KEY;
|
|
355
361
|
var SEARCH_PROVIDER = process.env.SEARCH_PROVIDER ?? "searxng";
|
|
356
|
-
if (!SEARCH_API_URL) {
|
|
357
|
-
process.stderr.write("SEARCH_API_URL must be set");
|
|
358
|
-
process.exit(1);
|
|
359
|
-
}
|
|
360
362
|
var SAFE_SEARCH = process.env.SAFE_SEARCH ?? 0;
|
|
361
363
|
var LIMIT = process.env.LIMIT ?? 10;
|
|
362
364
|
var CATEGORIES = process.env.CATEGORIES ?? "general";
|
|
@@ -399,15 +401,26 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
399
401
|
throw new Error(`Invalid arguments for tool: [${name}]`);
|
|
400
402
|
}
|
|
401
403
|
try {
|
|
402
|
-
const { results, success } = await processSearch(
|
|
404
|
+
const { results, success } = await processSearch({
|
|
403
405
|
...config,
|
|
404
406
|
...args,
|
|
405
|
-
apiKey: SEARCH_API_KEY ?? ""
|
|
407
|
+
apiKey: SEARCH_API_KEY ?? "",
|
|
408
|
+
apiUrl: SEARCH_API_URL ?? ""
|
|
406
409
|
});
|
|
407
410
|
if (!success) {
|
|
408
411
|
throw new Error("Failed to search");
|
|
409
412
|
}
|
|
413
|
+
const resultsText = results.map((result) => `Title: ${result.title}
|
|
414
|
+
URL: ${result.url}
|
|
415
|
+
Description: ${result.snippet}
|
|
416
|
+
${result.markdown ? `Content: ${result.markdown}` : ""}`);
|
|
410
417
|
return {
|
|
418
|
+
content: [
|
|
419
|
+
{
|
|
420
|
+
type: "text",
|
|
421
|
+
text: resultsText.join("\n\n")
|
|
422
|
+
}
|
|
423
|
+
],
|
|
411
424
|
results,
|
|
412
425
|
success
|
|
413
426
|
};
|
|
@@ -419,7 +432,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
419
432
|
const msg = error instanceof Error ? error.message : "Unknown error";
|
|
420
433
|
return {
|
|
421
434
|
success: false,
|
|
422
|
-
|
|
435
|
+
content: [
|
|
436
|
+
{
|
|
437
|
+
type: "text",
|
|
438
|
+
text: msg
|
|
439
|
+
}
|
|
440
|
+
]
|
|
423
441
|
};
|
|
424
442
|
}
|
|
425
443
|
}
|
|
@@ -440,7 +458,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
440
458
|
});
|
|
441
459
|
return {
|
|
442
460
|
success: false,
|
|
443
|
-
|
|
461
|
+
content: [
|
|
462
|
+
{
|
|
463
|
+
type: "text",
|
|
464
|
+
text: msg
|
|
465
|
+
}
|
|
466
|
+
]
|
|
444
467
|
};
|
|
445
468
|
} finally {
|
|
446
469
|
server.sendLoggingMessage({
|
|
@@ -449,16 +472,16 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
449
472
|
});
|
|
450
473
|
}
|
|
451
474
|
});
|
|
452
|
-
async function processSearch(
|
|
475
|
+
async function processSearch(args) {
|
|
453
476
|
switch (SEARCH_PROVIDER) {
|
|
454
477
|
case "searxng":
|
|
455
|
-
return await searxngSearch(
|
|
478
|
+
return await searxngSearch({
|
|
456
479
|
...config,
|
|
457
480
|
...args,
|
|
458
481
|
apiKey: SEARCH_API_KEY
|
|
459
482
|
});
|
|
460
483
|
case "tavily":
|
|
461
|
-
return await tavilySearch(
|
|
484
|
+
return await tavilySearch({
|
|
462
485
|
...config,
|
|
463
486
|
...args,
|
|
464
487
|
apiKey: SEARCH_API_KEY
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/search.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Server } from '@modelcontextprotocol/sdk/server/index.js';\nimport { CallToolRequestSchema, ListToolsRequestSchema, Tool } from '@modelcontextprotocol/sdk/types.js';\nimport { ISearchRequestOptions, ISearchResponse, Provider } from './interface.js';\nimport { searxngSearch, tavilySearch } from './search.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport dotenvx from '@dotenvx/dotenvx';\n\ndotenvx.config();\n\n// tools definition\nconst SEARCH_TOOL: Tool = {\n name: 'one_search',\n description:\n 'Search and retrieve content from web pages. ' +\n 'Returns SERP results by default (url, title, description).',\n inputSchema: {\n type: 'object',\n properties: {\n query: {\n type: 'string',\n description: 'Search query string',\n },\n limit: {\n type: 'number',\n description: 'Maximum number of results to return (default: 5)',\n },\n language: {\n type: 'string',\n description: 'Language code for search results (default: en)',\n },\n categories: {\n type: 'string',\n description: 'Categories to search for (default: general)',\n },\n timeRange: {\n type: 'string',\n description: 'Time range for search results (default: all)',\n },\n },\n required: ['query'],\n },\n};\n\nconst SCRAPE_TOOL: Tool = {\n name: 'one_scrape',\n description:\n 'Scrape a single webpage with advanced options for content extraction. ' +\n 'Supports various formats including markdown, HTML, and screenshots. ' +\n 'Can execute custom actions like clicking or scrolling before scraping.',\n inputSchema: {\n type: 'object',\n properties: {\n url: {\n type: 'string',\n description: 'The URL to scrape',\n },\n formats: {\n type: 'array',\n items: {\n type: 'string',\n enum: [\n 'markdown',\n 'html',\n 'rawHtml',\n 'screenshot',\n 'links',\n 'screenshot@fullPage',\n 'extract',\n ],\n },\n description: \"Content formats to extract (default: ['markdown'])\",\n },\n onlyMainContent: {\n type: 'boolean',\n description:\n 'Extract only the main content, filtering out navigation, footers, etc.',\n },\n includeTags: {\n type: 'array',\n items: { type: 'string' },\n description: 'HTML tags to specifically include in extraction',\n },\n excludeTags: {\n type: 'array',\n items: { type: 'string' },\n description: 'HTML tags to exclude from extraction',\n },\n waitFor: {\n type: 'number',\n description: 'Time in milliseconds to wait for dynamic content to load',\n },\n timeout: {\n type: 'number',\n description:\n 'Maximum time in milliseconds to wait for the page to load',\n },\n actions: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: [\n 'wait',\n 'click',\n 'screenshot',\n 'write',\n 'press',\n 'scroll',\n 'scrape',\n 'executeJavascript',\n ],\n description: 'Type of action to perform',\n },\n selector: {\n type: 'string',\n description: 'CSS selector for the target element',\n },\n milliseconds: {\n type: 'number',\n description: 'Time to wait in milliseconds (for wait action)',\n },\n text: {\n type: 'string',\n description: 'Text to write (for write action)',\n },\n key: {\n type: 'string',\n description: 'Key to press (for press action)',\n },\n direction: {\n type: 'string',\n enum: ['up', 'down'],\n description: 'Scroll direction',\n },\n script: {\n type: 'string',\n description: 'JavaScript code to execute',\n },\n fullPage: {\n type: 'boolean',\n description: 'Take full page screenshot',\n },\n },\n required: ['type'],\n },\n description: 'List of actions to perform before scraping',\n },\n extract: {\n type: 'object',\n properties: {\n schema: {\n type: 'object',\n description: 'Schema for structured data extraction',\n },\n systemPrompt: {\n type: 'string',\n description: 'System prompt for LLM extraction',\n },\n prompt: {\n type: 'string',\n description: 'User prompt for LLM extraction',\n },\n },\n description: 'Configuration for structured data extraction',\n },\n mobile: {\n type: 'boolean',\n description: 'Use mobile viewport',\n },\n skipTlsVerification: {\n type: 'boolean',\n description: 'Skip TLS certificate verification',\n },\n removeBase64Images: {\n type: 'boolean',\n description: 'Remove base64 encoded images from output',\n },\n location: {\n type: 'object',\n properties: {\n country: {\n type: 'string',\n description: 'Country code for geolocation',\n },\n languages: {\n type: 'array',\n items: { type: 'string' },\n description: 'Language codes for content',\n },\n },\n description: 'Location settings for scraping',\n },\n },\n required: ['url'],\n },\n};\n\nconst EXTRACT_TOOL: Tool = {\n name: 'one_extract',\n description:\n 'Extract structured information from web pages using LLM. ' +\n 'Supports both cloud AI and self-hosted LLM extraction.',\n inputSchema: {\n type: 'object',\n properties: {\n urls: {\n type: 'array',\n items: { type: 'string' },\n description: 'List of URLs to extract information from',\n },\n prompt: {\n type: 'string',\n description: 'Prompt for the LLM extraction',\n },\n systemPrompt: {\n type: 'string',\n description: 'System prompt for LLM extraction',\n },\n schema: {\n type: 'object',\n description: 'JSON schema for structured data extraction',\n },\n allowExternalLinks: {\n type: 'boolean',\n description: 'Allow extraction from external links',\n },\n enableWebSearch: {\n type: 'boolean',\n description: 'Enable web search for additional context',\n },\n includeSubdomains: {\n type: 'boolean',\n description: 'Include subdomains in extraction',\n },\n },\n required: ['urls'],\n },\n};\n\n// Server implementation\nconst server = new Server(\n {\n name: 'one-search-mcp',\n version: '0.0.1',\n },\n {\n capabilities: {\n tools: {},\n logging: {},\n },\n },\n);\n\n// searxng api\nconst SEARCH_API_URL = process.env.SEARCH_API_URL;\nconst SEARCH_API_KEY = process.env.SEARCH_API_KEY;\nconst SEARCH_PROVIDER: Provider = process.env.SEARCH_PROVIDER as Provider ?? 'searxng';\n\nif (!SEARCH_API_URL) {\n process.stderr.write('SEARCH_API_URL must be set');\n process.exit(1);\n}\n\n// query params\nconst SAFE_SEARCH = process.env.SAFE_SEARCH ?? 0;\nconst LIMIT = process.env.LIMIT ?? 10;\nconst CATEGORIES = process.env.CATEGORIES ?? 'general';\nconst ENGINES = process.env.ENGINES ?? 'all';\nconst FORMAT = process.env.FORMAT ?? 'json';\nconst LANGUAGE = process.env.LANGUAGE ?? 'auto';\nconst TIME_RANGE = process.env.TIME_RANGE ?? '';\nconst DEFAULT_TIMEOUT = process.env.TIMEOUT ?? 10000;\n\nconst config = {\n pageno: LIMIT,\n categories: CATEGORIES,\n format: FORMAT,\n safesearch: SAFE_SEARCH,\n language: LANGUAGE,\n engines: ENGINES,\n time_range: TIME_RANGE,\n timeout: DEFAULT_TIMEOUT,\n};\n\n// Tool handlers\nserver.setRequestHandler(ListToolsRequestSchema, async () => ({\n tools: [\n SEARCH_TOOL,\n EXTRACT_TOOL,\n SCRAPE_TOOL,\n ],\n}));\n\nserver.setRequestHandler(CallToolRequestSchema, async (request) => {\n const startTime = Date.now();\n\n try {\n const { name, arguments: args } = request.params;\n\n if (!args) {\n throw new Error('No arguments provided');\n }\n \n server.sendLoggingMessage({\n level: 'info',\n data: `[${new Date().toISOString()}] Received request for tool: [${name}]`,\n });\n \n switch (name) {\n case 'one_search': {\n // check args.\n if (!checkSearchArgs(args)) {\n throw new Error(`Invalid arguments for tool: [${name}]`);\n }\n try {\n const { results, success } = await processSearch(SEARCH_API_URL, {\n ...config,\n ...args,\n apiKey: SEARCH_API_KEY ?? '',\n });\n if (!success) {\n throw new Error('Failed to search');\n }\n return {\n results,\n success,\n };\n } catch (error) {\n server.sendLoggingMessage({\n level: 'error',\n data: `[${new Date().toISOString()}] Error searching: ${error}`,\n });\n const msg = error instanceof Error ? error.message : 'Unknown error';\n return {\n success: false,\n error: msg,\n };\n }\n }\n default:\n throw new Error(`Unknown tool: ${name}`);\n }\n } catch(error) {\n const msg = error instanceof Error ? error.message : String(error);\n server.sendLoggingMessage({\n level: 'error',\n data: {\n message: `[${new Date().toISOString()}] Error processing request: ${msg}`,\n tool: request.params.name,\n arguments: request.params.arguments,\n timestamp: new Date().toISOString(),\n duration: Date.now() - startTime,\n },\n });\n return {\n success: false,\n error: error instanceof Error ? error.message : msg,\n };\n } finally {\n server.sendLoggingMessage({\n level: 'info',\n data: `[${new Date().toISOString()}] Request completed in ${Date.now() - startTime}ms`,\n });\n }\n});\n\nasync function processSearch(apiUrl: string, args: ISearchRequestOptions): Promise<ISearchResponse> {\n switch (SEARCH_PROVIDER) {\n case 'searxng':\n return await searxngSearch(apiUrl, {\n ...config,\n ...args,\n apiKey: SEARCH_API_KEY,\n });\n case 'tavily':\n return await tavilySearch(apiUrl, {\n ...config,\n ...args,\n apiKey: SEARCH_API_KEY,\n });\n default:\n throw new Error(`Unsupported search provider: ${SEARCH_PROVIDER}`);\n }\n}\n\nfunction checkSearchArgs(args: unknown): args is ISearchRequestOptions {\n return (\n typeof args === 'object' &&\n args !== null &&\n 'query' in args &&\n typeof args.query === 'string'\n );\n}\n\nasync function runServer() {\n try {\n process.stdout.write('Starting OneSearch MCP server...\\n');\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n\n server.sendLoggingMessage({\n level: 'info',\n data: 'OneSearch MCP server started',\n });\n\n } catch (error) {\n const msg = error instanceof Error ? error.message : String(error);\n process.stderr.write(`Error starting server: ${msg}\\n`);\n process.exit(1);\n }\n}\n\n// run server\nrunServer().catch((error) => {\n const msg = error instanceof Error ? error.message : String(error);\n process.stderr.write(`Error running server: ${msg}\\n`);\n process.exit(1);\n});\n\n// export types\nexport * from './interface.js';\n","import url from 'node:url';\nimport { tavily, TavilyClient, TavilySearchOptions } from '@tavily/core';\nimport { ISearchRequestOptions, ISearchResponse, ISearchResponseResult } from './interface.js';\n\n/**\n * SearxNG Search API\n * - https://docs.searxng.org/dev/search_api.html\n */\nexport async function searxngSearch(apiUrl: string, params: ISearchRequestOptions): Promise<ISearchResponse> {\n try {\n const {\n query,\n limit = 10,\n categories = 'general',\n engines = 'all',\n safeSearch = 0,\n format = 'json',\n language = 'auto',\n timeRange = '',\n timeout = 10000,\n apiKey = '',\n } = params;\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), Number(timeout));\n\n const config = {\n q: query,\n pageno: limit,\n categories,\n format,\n safesearch: safeSearch,\n language,\n engines,\n time_range: timeRange,\n };\n\n const endpoint = `${apiUrl}/search`;\n\n const queryParams = url.format({ query: config });\n\n const headers: HeadersInit = {\n 'Content-Type': 'application/json',\n };\n\n if (apiKey) {\n headers['Authorization'] = `Bearer ${apiKey}`;\n }\n\n const res = await fetch(`${endpoint}${queryParams}`, {\n method: 'POST',\n headers,\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n const result = await res.json();\n if (result.results) {\n const results: ISearchResponseResult[] = result.results.map((item: Record<string, unknown>) => {\n const image = item.img_src ? {\n thumbnail: item.thumbnail_src,\n src: item.img_src,\n } : null;\n const video = item.iframe_src ? {\n thumbnail: item.thumbnail_src,\n src: item.iframe_src,\n } : null;\n return {\n title: item.title,\n snippet: item.content,\n url: item.url,\n source: item.source,\n image,\n video,\n engine: item.engine,\n };\n });\n return {\n results,\n success: true,\n };\n }\n return {\n results: [],\n success: false,\n };\n } catch (err: any) {\n process.stdout.write(err?.message ?? 'Searxng search error.');\n throw err;\n }\n}\n\n\nlet tvly: TavilyClient | null = null;\nexport async function tavilySearch(query: string, options: ISearchRequestOptions): Promise<ISearchResponse> {\n const {\n limit = 10,\n categories = 'general',\n timeRange,\n apiKey,\n } = options;\n\n if (!apiKey) {\n throw new Error('Tavily API key is required');\n }\n\n if (!tvly) {\n tvly = tavily({\n apiKey,\n });\n }\n\n const params: TavilySearchOptions = {\n topic: categories as TavilySearchOptions['topic'],\n timeRange: timeRange as TavilySearchOptions['timeRange'],\n maxResults: limit,\n };\n\n const res = await tvly.search(query, params);\n const results = res.results.map(item => ({\n title: item.title,\n url: item.url,\n snippet: item.content,\n }));\n\n return {\n results,\n success: true,\n };\n}\n"],"mappings":";;;AAEA,SAAS,cAAc;AACvB,SAAU,uBAAuB,8BAAoC;;;ACHrE,OAAO,SAAS;AAChB,SAAS,cAAiD;AAO1D,eAAsB,cAAc,QAAgB,QAAyD;AAC3G,MAAI;AACF,UAAM;AAAA,MACJ;AAAA,MACA,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,UAAU;AAAA,MACV,aAAa;AAAA,MACb,SAAS;AAAA,MACT,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,SAAS;AAAA,IACX,IAAI;AAEJ,UAAM,aAAa,IAAI,gBAAgB;AACvC,UAAM,YAAY,WAAW,MAAM,WAAW,MAAM,GAAG,OAAO,OAAO,CAAC;AAEtE,UAAMA,UAAS;AAAA,MACb,GAAG;AAAA,MACH,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA,YAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA,YAAY;AAAA,IACd;AAEA,UAAM,WAAW,GAAG,MAAM;AAE1B,UAAM,cAAc,IAAI,OAAO,EAA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,CAAC;AAAA,EAChB;AACF;AAGA,UAAU,EAAE,MAAM,CAAC,UAAU;AAC3B,QAAM,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACjE,UAAQ,OAAO,MAAM,yBAAyB,GAAG;AAAA,CAAI;AACrD,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["config"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/search.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Server } from '@modelcontextprotocol/sdk/server/index.js';\nimport { CallToolRequestSchema, ListToolsRequestSchema, Tool } from '@modelcontextprotocol/sdk/types.js';\nimport { ISearchRequestOptions, ISearchResponse, Provider } from './interface.js';\nimport { searxngSearch, tavilySearch } from './search.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport dotenvx from '@dotenvx/dotenvx';\n\ndotenvx.config();\n\n// tools definition\nconst SEARCH_TOOL: Tool = {\n name: 'one_search',\n description:\n 'Search and retrieve content from web pages. ' +\n 'Returns SERP results by default (url, title, description).',\n inputSchema: {\n type: 'object',\n properties: {\n query: {\n type: 'string',\n description: 'Search query string',\n },\n limit: {\n type: 'number',\n description: 'Maximum number of results to return (default: 10)',\n },\n language: {\n type: 'string',\n description: 'Language code for search results (default: auto)',\n },\n categories: {\n type: 'string',\n description: 'Categories to search for (default: general)',\n },\n timeRange: {\n type: 'string',\n description: 'Time range for search results (default: all)',\n },\n },\n required: ['query'],\n },\n};\n\nconst SCRAPE_TOOL: Tool = {\n name: 'one_scrape',\n description:\n 'Scrape a single webpage with advanced options for content extraction. ' +\n 'Supports various formats including markdown, HTML, and screenshots. ' +\n 'Can execute custom actions like clicking or scrolling before scraping.',\n inputSchema: {\n type: 'object',\n properties: {\n url: {\n type: 'string',\n description: 'The URL to scrape',\n },\n formats: {\n type: 'array',\n items: {\n type: 'string',\n enum: [\n 'markdown',\n 'html',\n 'rawHtml',\n 'screenshot',\n 'links',\n 'screenshot@fullPage',\n 'extract',\n ],\n },\n description: \"Content formats to extract (default: ['markdown'])\",\n },\n onlyMainContent: {\n type: 'boolean',\n description:\n 'Extract only the main content, filtering out navigation, footers, etc.',\n },\n includeTags: {\n type: 'array',\n items: { type: 'string' },\n description: 'HTML tags to specifically include in extraction',\n },\n excludeTags: {\n type: 'array',\n items: { type: 'string' },\n description: 'HTML tags to exclude from extraction',\n },\n waitFor: {\n type: 'number',\n description: 'Time in milliseconds to wait for dynamic content to load',\n },\n timeout: {\n type: 'number',\n description:\n 'Maximum time in milliseconds to wait for the page to load',\n },\n actions: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: [\n 'wait',\n 'click',\n 'screenshot',\n 'write',\n 'press',\n 'scroll',\n 'scrape',\n 'executeJavascript',\n ],\n description: 'Type of action to perform',\n },\n selector: {\n type: 'string',\n description: 'CSS selector for the target element',\n },\n milliseconds: {\n type: 'number',\n description: 'Time to wait in milliseconds (for wait action)',\n },\n text: {\n type: 'string',\n description: 'Text to write (for write action)',\n },\n key: {\n type: 'string',\n description: 'Key to press (for press action)',\n },\n direction: {\n type: 'string',\n enum: ['up', 'down'],\n description: 'Scroll direction',\n },\n script: {\n type: 'string',\n description: 'JavaScript code to execute',\n },\n fullPage: {\n type: 'boolean',\n description: 'Take full page screenshot',\n },\n },\n required: ['type'],\n },\n description: 'List of actions to perform before scraping',\n },\n extract: {\n type: 'object',\n properties: {\n schema: {\n type: 'object',\n description: 'Schema for structured data extraction',\n },\n systemPrompt: {\n type: 'string',\n description: 'System prompt for LLM extraction',\n },\n prompt: {\n type: 'string',\n description: 'User prompt for LLM extraction',\n },\n },\n description: 'Configuration for structured data extraction',\n },\n mobile: {\n type: 'boolean',\n description: 'Use mobile viewport',\n },\n skipTlsVerification: {\n type: 'boolean',\n description: 'Skip TLS certificate verification',\n },\n removeBase64Images: {\n type: 'boolean',\n description: 'Remove base64 encoded images from output',\n },\n location: {\n type: 'object',\n properties: {\n country: {\n type: 'string',\n description: 'Country code for geolocation',\n },\n languages: {\n type: 'array',\n items: { type: 'string' },\n description: 'Language codes for content',\n },\n },\n description: 'Location settings for scraping',\n },\n },\n required: ['url'],\n },\n};\n\nconst EXTRACT_TOOL: Tool = {\n name: 'one_extract',\n description:\n 'Extract structured information from web pages using LLM. ' +\n 'Supports both cloud AI and self-hosted LLM extraction.',\n inputSchema: {\n type: 'object',\n properties: {\n urls: {\n type: 'array',\n items: { type: 'string' },\n description: 'List of URLs to extract information from',\n },\n prompt: {\n type: 'string',\n description: 'Prompt for the LLM extraction',\n },\n systemPrompt: {\n type: 'string',\n description: 'System prompt for LLM extraction',\n },\n schema: {\n type: 'object',\n description: 'JSON schema for structured data extraction',\n },\n allowExternalLinks: {\n type: 'boolean',\n description: 'Allow extraction from external links',\n },\n enableWebSearch: {\n type: 'boolean',\n description: 'Enable web search for additional context',\n },\n includeSubdomains: {\n type: 'boolean',\n description: 'Include subdomains in extraction',\n },\n },\n required: ['urls'],\n },\n};\n\n// Server implementation\nconst server = new Server(\n {\n name: 'one-search-mcp',\n version: '0.0.1',\n },\n {\n capabilities: {\n tools: {},\n logging: {},\n },\n },\n);\n\n// searxng api\nconst SEARCH_API_URL = process.env.SEARCH_API_URL;\nconst SEARCH_API_KEY = process.env.SEARCH_API_KEY;\nconst SEARCH_PROVIDER: Provider = process.env.SEARCH_PROVIDER as Provider ?? 'searxng';\n\n// query params\nconst SAFE_SEARCH = process.env.SAFE_SEARCH ?? 0;\nconst LIMIT = process.env.LIMIT ?? 10;\nconst CATEGORIES = process.env.CATEGORIES ?? 'general';\nconst ENGINES = process.env.ENGINES ?? 'all';\nconst FORMAT = process.env.FORMAT ?? 'json';\nconst LANGUAGE = process.env.LANGUAGE ?? 'auto';\nconst TIME_RANGE = process.env.TIME_RANGE ?? '';\nconst DEFAULT_TIMEOUT = process.env.TIMEOUT ?? 10000;\n\nconst config = {\n pageno: LIMIT,\n categories: CATEGORIES,\n format: FORMAT,\n safesearch: SAFE_SEARCH,\n language: LANGUAGE,\n engines: ENGINES,\n time_range: TIME_RANGE,\n timeout: DEFAULT_TIMEOUT,\n};\n\n// Tool handlers\nserver.setRequestHandler(ListToolsRequestSchema, async () => ({\n tools: [\n SEARCH_TOOL,\n EXTRACT_TOOL,\n SCRAPE_TOOL,\n ],\n}));\n\nserver.setRequestHandler(CallToolRequestSchema, async (request) => {\n const startTime = Date.now();\n\n try {\n const { name, arguments: args } = request.params;\n\n if (!args) {\n throw new Error('No arguments provided');\n }\n \n server.sendLoggingMessage({\n level: 'info',\n data: `[${new Date().toISOString()}] Received request for tool: [${name}]`,\n });\n \n switch (name) {\n case 'one_search': {\n // check args.\n if (!checkSearchArgs(args)) {\n throw new Error(`Invalid arguments for tool: [${name}]`);\n }\n try {\n const { results, success } = await processSearch({\n ...config,\n ...args,\n apiKey: SEARCH_API_KEY ?? '',\n apiUrl: SEARCH_API_URL ?? '',\n });\n if (!success) {\n throw new Error('Failed to search');\n }\n const resultsText = results.map((result) => (\n `Title: ${result.title}\nURL: ${result.url}\nDescription: ${result.snippet}\n${result.markdown ? `Content: ${result.markdown}` : ''}`\n ));\n return {\n content: [\n {\n type: 'text',\n text: resultsText.join('\\n\\n'),\n },\n ],\n results,\n success,\n };\n } catch (error) {\n server.sendLoggingMessage({\n level: 'error',\n data: `[${new Date().toISOString()}] Error searching: ${error}`,\n });\n const msg = error instanceof Error ? error.message : 'Unknown error';\n return {\n success: false,\n content: [\n {\n type: 'text',\n text: msg,\n },\n ],\n };\n }\n }\n default:\n throw new Error(`Unknown tool: ${name}`);\n }\n } catch(error) {\n const msg = error instanceof Error ? error.message : String(error);\n server.sendLoggingMessage({\n level: 'error',\n data: {\n message: `[${new Date().toISOString()}] Error processing request: ${msg}`,\n tool: request.params.name,\n arguments: request.params.arguments,\n timestamp: new Date().toISOString(),\n duration: Date.now() - startTime,\n },\n });\n return {\n success: false,\n content: [\n {\n type: 'text',\n text: msg,\n },\n ],\n };\n } finally {\n server.sendLoggingMessage({\n level: 'info',\n data: `[${new Date().toISOString()}] Request completed in ${Date.now() - startTime}ms`,\n });\n }\n});\n\nasync function processSearch(args: ISearchRequestOptions): Promise<ISearchResponse> {\n switch (SEARCH_PROVIDER) {\n case 'searxng':\n return await searxngSearch({\n ...config,\n ...args,\n apiKey: SEARCH_API_KEY,\n });\n case 'tavily':\n return await tavilySearch({\n ...config,\n ...args,\n apiKey: SEARCH_API_KEY,\n });\n default:\n throw new Error(`Unsupported search provider: ${SEARCH_PROVIDER}`);\n }\n}\n\nfunction checkSearchArgs(args: unknown): args is ISearchRequestOptions {\n return (\n typeof args === 'object' &&\n args !== null &&\n 'query' in args &&\n typeof args.query === 'string'\n );\n}\n\nasync function runServer() {\n try {\n process.stdout.write('Starting OneSearch MCP server...\\n');\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n\n server.sendLoggingMessage({\n level: 'info',\n data: 'OneSearch MCP server started',\n });\n\n } catch (error) {\n const msg = error instanceof Error ? error.message : String(error);\n process.stderr.write(`Error starting server: ${msg}\\n`);\n process.exit(1);\n }\n}\n\n// run server\nrunServer().catch((error) => {\n const msg = error instanceof Error ? error.message : String(error);\n process.stderr.write(`Error running server: ${msg}\\n`);\n process.exit(1);\n});\n\n// export types\nexport * from './interface.js';\n","import url from 'node:url';\nimport { tavily, TavilyClient, TavilySearchOptions } from '@tavily/core';\nimport { ISearchRequestOptions, ISearchResponse, ISearchResponseResult } from './interface.js';\n\n/**\n * SearxNG Search API\n * - https://docs.searxng.org/dev/search_api.html\n */\nexport async function searxngSearch(params: ISearchRequestOptions): Promise<ISearchResponse> {\n try {\n const {\n query,\n limit = 10,\n categories = 'general',\n engines = 'all',\n safeSearch = 0,\n format = 'json',\n language = 'auto',\n timeRange = '',\n timeout = 10000,\n apiKey,\n apiUrl,\n } = params;\n\n if (!apiUrl) {\n throw new Error('SearxNG API URL is required');\n }\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), Number(timeout));\n\n const config = {\n q: query,\n pageno: limit,\n categories,\n format,\n safesearch: safeSearch,\n language,\n engines,\n time_range: timeRange,\n };\n\n const endpoint = `${apiUrl}/search`;\n\n const queryParams = url.format({ query: config });\n\n const headers: HeadersInit = {\n 'Content-Type': 'application/json',\n };\n\n if (apiKey) {\n headers['Authorization'] = `Bearer ${apiKey}`;\n }\n\n const res = await fetch(`${endpoint}${queryParams}`, {\n method: 'POST',\n headers,\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n const result = await res.json();\n if (result.results) {\n const results: ISearchResponseResult[] = result.results.map((item: Record<string, unknown>) => {\n const image = item.img_src ? {\n thumbnail: item.thumbnail_src,\n src: item.img_src,\n } : null;\n const video = item.iframe_src ? {\n thumbnail: item.thumbnail_src,\n src: item.iframe_src,\n } : null;\n return {\n title: item.title,\n snippet: item.content,\n url: item.url,\n source: item.source,\n image,\n video,\n engine: item.engine,\n };\n });\n return {\n results,\n success: true,\n };\n }\n return {\n results: [],\n success: false,\n };\n } catch (err: unknown) {\n const msg = err instanceof Error ? err.message : 'Searxng search error.';\n process.stdout.write(msg);\n throw err;\n }\n}\n\n\nlet tvly: TavilyClient | null = null;\nexport async function tavilySearch(options: ISearchRequestOptions): Promise<ISearchResponse> {\n const {\n query,\n limit = 10,\n categories = 'general',\n timeRange,\n apiKey,\n } = options;\n\n if (!apiKey) {\n throw new Error('Tavily API key is required');\n }\n\n if (!tvly) {\n tvly = tavily({\n apiKey,\n });\n }\n\n const params: TavilySearchOptions = {\n topic: categories as TavilySearchOptions['topic'],\n timeRange: timeRange as TavilySearchOptions['timeRange'],\n maxResults: limit,\n };\n\n const res = await tvly.search(query, params);\n const results = res.results.map(item => ({\n title: item.title,\n url: item.url,\n snippet: item.content,\n }));\n\n return {\n results,\n success: true,\n };\n}\n"],"mappings":";;;AAEA,SAAS,cAAc;AACvB,SAAU,uBAAuB,8BAAoC;;;ACHrE,OAAO,SAAS;AAChB,SAAS,cAAiD;AAO1D,eAAsB,cAAc,QAAyD;AAC3F,MAAI;AACF,UAAM;AAAA,MACJ;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|
4
4
|
"description": "One Search MCP Server, Web Search & Crawl & Scraper & Extract, support SearXNG, Firecrawl, Tavily, etc.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"start": "node dist/index.js",
|
|
44
44
|
"lint": "eslint src",
|
|
45
45
|
"lint:fix": "eslint src --fix",
|
|
46
|
-
"publish": "npm
|
|
46
|
+
"publish": "npm publish --registry=https://registry.npmjs.org/"
|
|
47
47
|
},
|
|
48
48
|
"tsup": {
|
|
49
49
|
"entry": [
|