@lmcc-dev/mult-fetch-mcp-server 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +512 -0
- package/README.zh.md +510 -0
- package/dist/index.js +21 -0
- package/dist/src/cli-language.js +78 -0
- package/dist/src/client.js +284 -0
- package/dist/src/index.js +21 -0
- package/dist/src/lib/BrowserFetcher.js +753 -0
- package/dist/src/lib/NodeFetcher.js +428 -0
- package/dist/src/lib/example.js +93 -0
- package/dist/src/lib/i18n/index.js +36 -0
- package/dist/src/lib/i18n/locales/en/browser.js +53 -0
- package/dist/src/lib/i18n/locales/en/client.js +40 -0
- package/dist/src/lib/i18n/locales/en/errors.js +18 -0
- package/dist/src/lib/i18n/locales/en/fetcher.js +67 -0
- package/dist/src/lib/i18n/locales/en/index.js +26 -0
- package/dist/src/lib/i18n/locales/en/node.js +42 -0
- package/dist/src/lib/i18n/locales/en/prompts.js +72 -0
- package/dist/src/lib/i18n/locales/en/resources.js +47 -0
- package/dist/src/lib/i18n/locales/en/server.js +32 -0
- package/dist/src/lib/i18n/locales/en/tools.js +25 -0
- package/dist/src/lib/i18n/locales/zh/browser.js +53 -0
- package/dist/src/lib/i18n/locales/zh/client.js +39 -0
- package/dist/src/lib/i18n/locales/zh/errors.js +18 -0
- package/dist/src/lib/i18n/locales/zh/fetcher.js +67 -0
- package/dist/src/lib/i18n/locales/zh/index.js +26 -0
- package/dist/src/lib/i18n/locales/zh/node.js +42 -0
- package/dist/src/lib/i18n/locales/zh/prompts.js +72 -0
- package/dist/src/lib/i18n/locales/zh/resources.js +47 -0
- package/dist/src/lib/i18n/locales/zh/server.js +32 -0
- package/dist/src/lib/i18n/locales/zh/tools.js +25 -0
- package/dist/src/lib/i18n/logger.js +57 -0
- package/dist/src/lib/logger.js +126 -0
- package/dist/src/lib/server/browser.js +86 -0
- package/dist/src/lib/server/fetcher.js +130 -0
- package/dist/src/lib/server/index.js +73 -0
- package/dist/src/lib/server/logger.js +23 -0
- package/dist/src/lib/server/prompts.js +207 -0
- package/dist/src/lib/server/resources.js +171 -0
- package/dist/src/lib/server/tools.js +346 -0
- package/dist/src/lib/server/types.js +6 -0
- package/dist/src/lib/types.js +35 -0
- package/dist/src/mcp-server.js +22 -0
- package/dist/tests/test-direct-client.js +129 -0
- package/dist/tests/test-mcp-methods.js +114 -0
- package/dist/tests/test-mcp.js +145 -0
- package/dist/tests/test-mini4k.js +147 -0
- package/images/example_en.png +0 -0
- package/images/example_zh.png +0 -0
- package/package.json +80 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
// 获取器相关消息 (Fetcher related messages)
|
|
7
|
+
export const fetcher = {
|
|
8
|
+
addingDelay: "Adding random delay",
|
|
9
|
+
delayCompleted: "Delay completed after {{delay}}ms",
|
|
10
|
+
usingProxy: "Using proxy: {{proxy}}",
|
|
11
|
+
usingSpecifiedProxy: "Using specified proxy: {{proxy}}",
|
|
12
|
+
attemptingToUseSystemProxy: "Attempting to use system proxy",
|
|
13
|
+
notUsingProxy: "Not using any proxy",
|
|
14
|
+
finalProxyUsed: "Final proxy used: {{proxy}}",
|
|
15
|
+
noProxy: "No proxy will be used",
|
|
16
|
+
fetchingUrl: "Fetching URL: {{url}} (Redirect: {{redirect}})",
|
|
17
|
+
usingUserAgent: "Using User-Agent: {{userAgent}}",
|
|
18
|
+
usingHttpsProxy: "Using HTTPS proxy",
|
|
19
|
+
usingHttpProxy: "Using HTTP proxy",
|
|
20
|
+
requestOptions: "Request options: {{options}}",
|
|
21
|
+
startingFetch: "Starting fetch",
|
|
22
|
+
fetchCompleted: "Fetch completed in {{duration}}ms",
|
|
23
|
+
responseStatus: "Response status: {{status}} {{statusText}}",
|
|
24
|
+
redirectingTo: "Redirecting to: {{location}}",
|
|
25
|
+
constructedFullRedirectUrl: "Constructed full redirect URL: {{redirectUrl}}",
|
|
26
|
+
requestSuccess: "Request successful",
|
|
27
|
+
errorResponse: "Error response: {{status}} {{statusText}}",
|
|
28
|
+
errorResponseBody: "Error response body (first 200 chars): {{body}}",
|
|
29
|
+
errorReadingBody: "Error reading response body: {{error}}",
|
|
30
|
+
fetchError: "Fetch error: {{error}}",
|
|
31
|
+
requestAborted: "Request aborted after {{duration}}ms",
|
|
32
|
+
networkError: "Network error ({{code}}), might retry with browser mode",
|
|
33
|
+
requestTimeout: "Request timeout after {{duration}}ms",
|
|
34
|
+
fetchFailed: "Failed to fetch: {{error}}",
|
|
35
|
+
tooManyRedirects: "Too many redirects ({{redirects}})",
|
|
36
|
+
startingHtmlFetch: "Starting HTML fetch",
|
|
37
|
+
readingText: "Reading text content",
|
|
38
|
+
htmlContentLength: "HTML content length: {{length}} bytes",
|
|
39
|
+
startingJsonFetch: "Starting JSON fetch",
|
|
40
|
+
parsingJson: "Parsing JSON",
|
|
41
|
+
jsonParsed: "JSON parsed successfully",
|
|
42
|
+
jsonParseError: "JSON parse error: {{error}}",
|
|
43
|
+
startingTxtFetch: "Starting text fetch",
|
|
44
|
+
textContentLength: "Text content length: {{length}} bytes",
|
|
45
|
+
startingMarkdownFetch: "Starting Markdown fetch",
|
|
46
|
+
creatingTurndown: "Creating Turndown service",
|
|
47
|
+
convertingToMarkdown: "Converting to Markdown",
|
|
48
|
+
markdownContentLength: "Markdown content length: {{length}} bytes",
|
|
49
|
+
checkingProxyEnv: "Checking proxy environment variables",
|
|
50
|
+
envVarValue: "Environment variable {{envVar}} value: {{value}}",
|
|
51
|
+
foundSystemProxy: "Found system proxy: {{proxy}}",
|
|
52
|
+
systemCommandProxySettings: "System command proxy settings: {{output}}",
|
|
53
|
+
foundProxyFromCommand: "Found proxy from command: {{proxy}}",
|
|
54
|
+
errorGettingProxyFromCommand: "Error getting proxy from command: {{error}}",
|
|
55
|
+
checkingSystemEnvVars: "Checking system environment variables for proxy settings on platform: {{platform}}",
|
|
56
|
+
windowsEnvVars: "Windows environment variables output: {{output}}",
|
|
57
|
+
foundWindowsEnvProxy: "Found Windows environment proxy: {{proxy}}",
|
|
58
|
+
errorGettingWindowsEnvVars: "Error getting Windows environment variables: {{error}}",
|
|
59
|
+
unixEnvVars: "Unix environment variables output: {{output}}",
|
|
60
|
+
foundUnixEnvProxy: "Found Unix environment proxy: {{proxy}}",
|
|
61
|
+
errorGettingUnixEnvVars: "Error getting Unix environment variables: {{error}}",
|
|
62
|
+
errorGettingSystemEnvVars: "Error getting system environment variables: {{error}}",
|
|
63
|
+
noSystemProxyFound: "No system proxy found",
|
|
64
|
+
notSet: "not set",
|
|
65
|
+
debug: "{{message}}",
|
|
66
|
+
none: "none"
|
|
67
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
import { server } from './server.js';
|
|
7
|
+
import { client } from './client.js';
|
|
8
|
+
import { fetcher } from './fetcher.js';
|
|
9
|
+
import { browser } from './browser.js';
|
|
10
|
+
import { node } from './node.js';
|
|
11
|
+
import { tools } from './tools.js';
|
|
12
|
+
import { errors } from './errors.js';
|
|
13
|
+
import resources from './resources.js';
|
|
14
|
+
import prompts from './prompts.js';
|
|
15
|
+
// 英文翻译资源 (English translation resources)
|
|
16
|
+
export const enTranslation = {
|
|
17
|
+
server,
|
|
18
|
+
client,
|
|
19
|
+
fetcher,
|
|
20
|
+
browser,
|
|
21
|
+
node,
|
|
22
|
+
tools,
|
|
23
|
+
errors,
|
|
24
|
+
resources,
|
|
25
|
+
prompts
|
|
26
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
// Node获取器相关消息 (Node fetcher related messages)
|
|
7
|
+
export const node = {
|
|
8
|
+
addingDelay: "Adding random delay...",
|
|
9
|
+
noProxy: "No proxy will be used",
|
|
10
|
+
usingProxy: "Using proxy: {{proxy}}",
|
|
11
|
+
usingHttpsProxy: "Using HTTPS proxy agent",
|
|
12
|
+
usingHttpProxy: "Using HTTP proxy agent",
|
|
13
|
+
usingUserAgent: "Using User-Agent: {{userAgent}}",
|
|
14
|
+
requestDetails: "Request details: URL={{url}}, Method={{method}}, Proxy={{proxy}}",
|
|
15
|
+
requestOptions: "Request options: {{options}}",
|
|
16
|
+
startingFetch: "Starting fetch request...",
|
|
17
|
+
fetchingUrl: "Fetching URL: {{url}}",
|
|
18
|
+
responseStatus: "Response status: {{status}} {{statusText}}",
|
|
19
|
+
redirectingTo: "Redirecting to: {{location}}",
|
|
20
|
+
constructedFullRedirectUrl: "Constructed full redirect URL: {{redirectUrl}}",
|
|
21
|
+
requestSuccess: "Request successful",
|
|
22
|
+
errorResponse: "Error response: {{status}} {{statusText}}",
|
|
23
|
+
errorResponseBody: "Error response body (first 200 chars): {{body}}",
|
|
24
|
+
errorReadingBody: "Failed to read error response body: {{error}}",
|
|
25
|
+
fetchError: "Fetch error: {{error}}",
|
|
26
|
+
requestAborted: "Request aborted after {{duration}}ms",
|
|
27
|
+
networkError: "Network error ({{code}}), might retry with browser mode",
|
|
28
|
+
tooManyRedirects: "Too many redirects ({{redirects}})",
|
|
29
|
+
startingHtmlFetch: "Starting HTML fetch",
|
|
30
|
+
readingText: "Got response, reading text",
|
|
31
|
+
htmlContentLength: "HTML content length: {{length}} bytes",
|
|
32
|
+
htmlFetchError: "HTML fetch error: {{error}}",
|
|
33
|
+
startingJsonFetch: "Starting JSON fetch",
|
|
34
|
+
parsingJson: "Got response, parsing JSON",
|
|
35
|
+
jsonParsed: "JSON parsed successfully",
|
|
36
|
+
jsonParseError: "JSON parse error: {{error}}",
|
|
37
|
+
jsonFetchError: "JSON fetch error: {{error}}",
|
|
38
|
+
startingTxtFetch: "Starting TXT fetch",
|
|
39
|
+
startingMarkdownFetch: "Starting Markdown fetch",
|
|
40
|
+
creatingTurndown: "Creating TurndownService instance",
|
|
41
|
+
convertingToMarkdown: "Converting HTML to Markdown"
|
|
42
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
export default {
|
|
7
|
+
// Prompt list and get
|
|
8
|
+
list: {
|
|
9
|
+
request: "Received prompt list request: {params}"
|
|
10
|
+
},
|
|
11
|
+
get: {
|
|
12
|
+
request: "Received prompt get request: {promptName}, {args}"
|
|
13
|
+
},
|
|
14
|
+
// Error messages
|
|
15
|
+
notFound: "Prompt template not found",
|
|
16
|
+
missingRequiredArg: "Missing required argument",
|
|
17
|
+
useBrowserValue: "Processing useBrowser parameter: original={original}, parsed={parsed}",
|
|
18
|
+
// Generic prompt
|
|
19
|
+
generic: {
|
|
20
|
+
result: "Execute generic prompt",
|
|
21
|
+
message: "Execute prompt template",
|
|
22
|
+
args: "Arguments"
|
|
23
|
+
},
|
|
24
|
+
// Yes/No
|
|
25
|
+
yes: "Yes",
|
|
26
|
+
no: "No",
|
|
27
|
+
// Prompt descriptions and parameters
|
|
28
|
+
url: {
|
|
29
|
+
description: "Website URL"
|
|
30
|
+
},
|
|
31
|
+
format: {
|
|
32
|
+
description: "Return format, options: html, json, text, markdown"
|
|
33
|
+
},
|
|
34
|
+
useBrowser: {
|
|
35
|
+
description: "Whether to use browser mode to fetch content"
|
|
36
|
+
},
|
|
37
|
+
selector: {
|
|
38
|
+
description: "CSS selector for extracting specific content"
|
|
39
|
+
},
|
|
40
|
+
dataType: {
|
|
41
|
+
description: "Type of data to extract, such as tables, lists, contact info, etc."
|
|
42
|
+
},
|
|
43
|
+
error: {
|
|
44
|
+
description: "Error information encountered during fetching"
|
|
45
|
+
},
|
|
46
|
+
// Fetch website prompt
|
|
47
|
+
fetchWebsite: {
|
|
48
|
+
description: "Fetch website content",
|
|
49
|
+
result: "Website content fetch result",
|
|
50
|
+
message: "I want to fetch the content of a website",
|
|
51
|
+
response: "I can help you fetch website content. Please provide the website URL and desired format.",
|
|
52
|
+
instruction: "Please fetch the content of the following website",
|
|
53
|
+
formatInstruction: "Please return the content in the following format",
|
|
54
|
+
browserInstruction: "Use browser mode"
|
|
55
|
+
},
|
|
56
|
+
// Extract content prompt
|
|
57
|
+
extractContent: {
|
|
58
|
+
description: "Extract specific content from a website",
|
|
59
|
+
result: "Content extraction result",
|
|
60
|
+
message: "Please extract content from the following website",
|
|
61
|
+
selectorInstruction: "Use the following CSS selector to extract content",
|
|
62
|
+
dataTypeInstruction: "Extract the following type of data"
|
|
63
|
+
},
|
|
64
|
+
// Debug fetch prompt
|
|
65
|
+
debugFetch: {
|
|
66
|
+
description: "Debug website fetching issues",
|
|
67
|
+
result: "Fetch issue debugging result",
|
|
68
|
+
message: "I'm having issues fetching the following website",
|
|
69
|
+
errorDetails: "Error details",
|
|
70
|
+
instruction: "Please analyze possible causes and provide solutions. Consider the following points:\n1. Does the website have anti-scraping measures\n2. Is browser mode needed\n3. Are specific headers required\n4. Is redirect or cookie handling needed\n5. Does the website require JavaScript rendering"
|
|
71
|
+
}
|
|
72
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
export default {
|
|
7
|
+
// Resource list errors
|
|
8
|
+
list: {
|
|
9
|
+
request: "Received resource list request: {params}"
|
|
10
|
+
},
|
|
11
|
+
// Resource read errors
|
|
12
|
+
read: {
|
|
13
|
+
request: "Received resource read request: {uri}",
|
|
14
|
+
error: "Error reading resource: {uri}, {error}"
|
|
15
|
+
},
|
|
16
|
+
// File read errors
|
|
17
|
+
fileReadError: "Error reading file: {filePath}, {error}",
|
|
18
|
+
// Invalid URI
|
|
19
|
+
invalidUri: "Invalid resource URI",
|
|
20
|
+
// Resource not found
|
|
21
|
+
notFound: "Resource not found",
|
|
22
|
+
// Resource descriptions
|
|
23
|
+
readme: {
|
|
24
|
+
description: "Project README file, containing project overview, installation and usage instructions"
|
|
25
|
+
},
|
|
26
|
+
package: {
|
|
27
|
+
description: "Project package configuration file, containing dependencies and script definitions"
|
|
28
|
+
},
|
|
29
|
+
index: {
|
|
30
|
+
description: "Project entry file, containing server startup logic"
|
|
31
|
+
},
|
|
32
|
+
client: {
|
|
33
|
+
description: "MCP client implementation, used for communicating with the server"
|
|
34
|
+
},
|
|
35
|
+
// Resource template descriptions
|
|
36
|
+
sourceFile: {
|
|
37
|
+
name: "Source Code File",
|
|
38
|
+
description: "Access project source code files"
|
|
39
|
+
},
|
|
40
|
+
docFile: {
|
|
41
|
+
name: "Documentation File",
|
|
42
|
+
description: "Access project documentation files"
|
|
43
|
+
},
|
|
44
|
+
filename: {
|
|
45
|
+
description: "Filename, including extension"
|
|
46
|
+
}
|
|
47
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
// 服务器相关消息 (Server related messages)
|
|
7
|
+
export const server = {
|
|
8
|
+
starting: "MCP server starting...",
|
|
9
|
+
connecting: "Connecting to MCP transport: {{transport}}",
|
|
10
|
+
started: "MCP server started",
|
|
11
|
+
stopping: "MCP server stopping...",
|
|
12
|
+
stopped: "MCP server stopped",
|
|
13
|
+
error: "MCP server error: {{error}}",
|
|
14
|
+
receivedRequest: "Received request for tool: {{tool}}",
|
|
15
|
+
processingRequest: "Processing request for tool: {{tool}}",
|
|
16
|
+
requestCompleted: "Request completed for tool: {{tool}}",
|
|
17
|
+
requestFailed: "Request failed for tool: {{tool}}, error: {{error}}",
|
|
18
|
+
receivedInterruptSignal: "Received interrupt signal, shutting down server...",
|
|
19
|
+
receivedTerminateSignal: "Received terminate signal, shutting down server...",
|
|
20
|
+
uncaughtException: "Uncaught exception: {{error}}",
|
|
21
|
+
debug: "{{message}}",
|
|
22
|
+
// 新增的翻译键 (New translation keys)
|
|
23
|
+
initializingBrowser: "Initializing browser instance...",
|
|
24
|
+
closingBrowser: "Closing browser instance...",
|
|
25
|
+
receivedToolRequest: "Received {{name}} request: {{url}}",
|
|
26
|
+
processingToolRequestError: "Error processing {{name}} request: {{error}}",
|
|
27
|
+
usingBrowserMode: "Using browser mode to fetch {{type}}: {{url}}",
|
|
28
|
+
usingAutoDetectMode: "Using auto-detect mode to fetch {{type}}: {{url}}",
|
|
29
|
+
switchingToBrowserMode: "Standard mode failed, switching to browser mode: {{url}}",
|
|
30
|
+
fetchError: "Error fetching {{type}}: {{error}}",
|
|
31
|
+
connectionError: "Error connecting to transport: {{error}}"
|
|
32
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
// 工具相关消息 (Tool related messages)
|
|
7
|
+
export const tools = {
|
|
8
|
+
fetchHtml: {
|
|
9
|
+
description: "Fetch a website and return the content as HTML",
|
|
10
|
+
error: "Error fetching HTML: {{error}}"
|
|
11
|
+
},
|
|
12
|
+
fetchJson: {
|
|
13
|
+
description: "Fetch a JSON file from a URL",
|
|
14
|
+
error: "Error fetching JSON: {{error}}",
|
|
15
|
+
invalidJson: "Invalid JSON response from URL: {{url}}"
|
|
16
|
+
},
|
|
17
|
+
fetchTxt: {
|
|
18
|
+
description: "Fetch a website, return the content as plain text (no HTML)",
|
|
19
|
+
error: "Error fetching text: {{error}}"
|
|
20
|
+
},
|
|
21
|
+
fetchMarkdown: {
|
|
22
|
+
description: "Fetch a website and return the content as Markdown",
|
|
23
|
+
error: "Error fetching Markdown: {{error}}"
|
|
24
|
+
}
|
|
25
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
// 浏览器相关消息 (Browser related messages)
|
|
7
|
+
export const browser = {
|
|
8
|
+
closing: "正在关闭浏览器...",
|
|
9
|
+
closed: "浏览器已关闭",
|
|
10
|
+
starting: "启动新的浏览器实例",
|
|
11
|
+
startingFailed: "浏览器启动失败: {{error}}",
|
|
12
|
+
waiting: "浏览器正在启动中,等待...",
|
|
13
|
+
startupSuccess: "浏览器启动成功",
|
|
14
|
+
navigating: "正在导航到URL...",
|
|
15
|
+
waitingForSelector: "等待选择器: {{selector}}",
|
|
16
|
+
waitingForTimeout: "等待超时: {{timeout}}",
|
|
17
|
+
scrolling: "自动滚动页面...",
|
|
18
|
+
scrollCompleted: "自动滚动完成",
|
|
19
|
+
gettingContent: "获取页面内容...",
|
|
20
|
+
savingCookies: "保存Cookie...",
|
|
21
|
+
contentLength: "内容长度: {{length}}",
|
|
22
|
+
contentTruncated: "内容过大,进行截断...",
|
|
23
|
+
pageClosed: "页面已关闭",
|
|
24
|
+
fetchError: "浏览器获取错误: {{error}}",
|
|
25
|
+
highMemory: "检测到内存使用率高,尝试释放资源...",
|
|
26
|
+
closingDueToMemory: "由于内存使用率高,关闭浏览器...",
|
|
27
|
+
closingError: "关闭浏览器错误: {{error}}",
|
|
28
|
+
forcingGC: "强制垃圾回收...",
|
|
29
|
+
memoryCheckError: "检查内存使用错误: {{error}}",
|
|
30
|
+
usingCookies: "使用存储的域名Cookie: {{domain}}",
|
|
31
|
+
usingProxy: "使用代理服务器: {{proxy}}",
|
|
32
|
+
checkingCloudflare: "检查是否存在Cloudflare保护...",
|
|
33
|
+
cloudflareDetected: "检测到Cloudflare保护,尝试绕过...",
|
|
34
|
+
simulatingHuman: "模拟人类行为...",
|
|
35
|
+
simulatingHumanError: "模拟人类行为时出错: {{error}}",
|
|
36
|
+
stillOnCloudflare: "仍然在Cloudflare保护页面,尝试刷新...",
|
|
37
|
+
bypassFailed: "无法绕过Cloudflare保护",
|
|
38
|
+
cloudflareError: "处理Cloudflare保护时出错: {{error}}",
|
|
39
|
+
continuingWithoutBypass: "无法绕过Cloudflare保护,继续尝试获取内容...",
|
|
40
|
+
fetchingWithRetry: "使用浏览器获取HTML(尝试 {{attempt}}/{{maxAttempts}}): {{url}}",
|
|
41
|
+
memoryUsage: "内存使用情况 - Heap: {{heapUsed}}MB/{{heapTotal}}MB, RSS: {{rss}}MB",
|
|
42
|
+
memoryTooHigh: "内存使用过高 - Heap: {{heapUsed}}MB/{{heapTotal}}MB, RSS: {{rss}}MB",
|
|
43
|
+
unableToBypassCloudflare: "无法绕过Cloudflare保护,继续尝试获取内容...",
|
|
44
|
+
contentTooLarge: "内容过大,截断中...",
|
|
45
|
+
failedToParseJSON: "解析JSON失败: {{error}}",
|
|
46
|
+
startingBrowserFetchForMarkdown: "开始使用浏览器获取Markdown: {{url}}",
|
|
47
|
+
errorInBrowserFetchForMarkdown: "使用浏览器获取Markdown时出错: {{error}}",
|
|
48
|
+
fetchRequest: "浏览器获取请求: {{url}}",
|
|
49
|
+
usingStoredCookies: "使用存储的域名Cookie: {{domain}}",
|
|
50
|
+
closingInstance: "关闭浏览器实例",
|
|
51
|
+
fetchErrorWithAttempt: "浏览器获取错误(尝试 {{attempt}}/{{maxAttempts}}): {{error}}",
|
|
52
|
+
retryingAfterDelay: "延迟 {{delayMs}}ms 后重试..."
|
|
53
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
// 客户端相关消息 (Client related messages)
|
|
7
|
+
export const client = {
|
|
8
|
+
connecting: "正在连接 MCP 服务器...",
|
|
9
|
+
connected: "已连接到 MCP 服务器",
|
|
10
|
+
disconnecting: "正在断开与 MCP 服务器的连接...",
|
|
11
|
+
disconnected: "已断开与 MCP 服务器的连接",
|
|
12
|
+
error: "客户端错误: {{error}}",
|
|
13
|
+
callTool: "调用工具: {{tool}}",
|
|
14
|
+
callToolSuccess: "工具调用成功: {{tool}}",
|
|
15
|
+
callToolError: "工具调用失败: {{tool}}, 错误: {{error}}",
|
|
16
|
+
statusCodeDetected: "检测到HTTP状态码: {{code}}",
|
|
17
|
+
usageInfo: "用法: node client.js <method> <params_json> [proxy]",
|
|
18
|
+
exampleUsage: "示例: node client.js fetch_html '{\"url\": \"https://example.com\", \"debug\": true}' http://127.0.0.1:7890",
|
|
19
|
+
invalidJson: "参数解析错误,请提供有效的JSON字符串",
|
|
20
|
+
usingCommandLineProxy: "使用命令行指定的代理: {{proxy}}",
|
|
21
|
+
invalidProxyFormat: "代理格式无效,应以 http:// 或 https:// 开头: {{proxy}}",
|
|
22
|
+
usingEnvProxy: "使用环境变量中的代理: {{proxy}}",
|
|
23
|
+
usingShellProxy: "使用 shell 中的代理: {{proxy}}",
|
|
24
|
+
noShellProxy: "无法从 shell 获取代理设置",
|
|
25
|
+
systemProxyDisabled: "系统代理检测已禁用 (useSystemProxy=false)",
|
|
26
|
+
proxySet: "已设置代理: {{proxy}}, 禁用系统代理自动检测",
|
|
27
|
+
requestFailed: "请求失败: {{error}}",
|
|
28
|
+
fatalError: "致命错误: {{error}}",
|
|
29
|
+
startingServer: "启动服务器: {{path}}",
|
|
30
|
+
fetchingUrl: "正在获取 URL: {{url}}",
|
|
31
|
+
usingMode: "使用 {{mode}} 模式获取: {{url}}",
|
|
32
|
+
fetchFailed: "获取失败: {{error}}",
|
|
33
|
+
fetchSuccess: "获取成功: 内容长度 {{length}} 字节",
|
|
34
|
+
browserModeNeeded: "需要浏览器模式, 切换: {{url}}",
|
|
35
|
+
retryingWithBrowser: "使用浏览器模式重试: {{url}}",
|
|
36
|
+
browserModeFetchFailed: "浏览器模式获取失败: {{error}}",
|
|
37
|
+
browserModeFetchSuccess: "浏览器模式获取成功: 内容长度 {{length}} 字节",
|
|
38
|
+
serverClosed: "服务器已关闭"
|
|
39
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
// 通用错误消息 (Common error messages)
|
|
7
|
+
export const errors = {
|
|
8
|
+
missingUrl: "缺少必需参数: url",
|
|
9
|
+
invalidUrl: "无效的 URL: {{url}}",
|
|
10
|
+
timeout: "请求超时,已经过 {{timeout}}ms",
|
|
11
|
+
networkError: "网络错误: {{error}}",
|
|
12
|
+
browserError: "浏览器错误: {{error}}",
|
|
13
|
+
unexpectedError: "意外错误: {{error}}",
|
|
14
|
+
forbidden: "原因: 访问被禁止 (403 Forbidden)",
|
|
15
|
+
cloudflareProtection: "原因: Cloudflare 保护",
|
|
16
|
+
captchaRequired: "原因: 需要验证码",
|
|
17
|
+
connectionProblem: "原因: 连接问题"
|
|
18
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
// 获取器相关消息 (Fetcher related messages)
|
|
7
|
+
export const fetcher = {
|
|
8
|
+
addingDelay: "添加随机延迟",
|
|
9
|
+
delayCompleted: "延迟完成,耗时 {{delay}}ms",
|
|
10
|
+
usingProxy: "使用代理: {{proxy}}",
|
|
11
|
+
usingSpecifiedProxy: "使用指定代理: {{proxy}}",
|
|
12
|
+
attemptingToUseSystemProxy: "尝试使用系统代理",
|
|
13
|
+
notUsingProxy: "不使用任何代理",
|
|
14
|
+
finalProxyUsed: "最终使用的代理: {{proxy}}",
|
|
15
|
+
noProxy: "不使用代理",
|
|
16
|
+
fetchingUrl: "获取URL: {{url}} (重定向: {{redirect}})",
|
|
17
|
+
usingUserAgent: "使用User-Agent: {{userAgent}}",
|
|
18
|
+
usingHttpsProxy: "使用HTTPS代理",
|
|
19
|
+
usingHttpProxy: "使用HTTP代理",
|
|
20
|
+
requestOptions: "请求选项: {{options}}",
|
|
21
|
+
startingFetch: "开始获取",
|
|
22
|
+
fetchCompleted: "获取完成,耗时 {{duration}}ms",
|
|
23
|
+
responseStatus: "响应状态: {{status}} {{statusText}}",
|
|
24
|
+
redirectingTo: "重定向到: {{location}}",
|
|
25
|
+
constructedFullRedirectUrl: "构建完整重定向URL: {{redirectUrl}}",
|
|
26
|
+
requestSuccess: "请求成功",
|
|
27
|
+
errorResponse: "错误响应: {{status}} {{statusText}}",
|
|
28
|
+
errorResponseBody: "错误响应内容(前200字符): {{body}}",
|
|
29
|
+
errorReadingBody: "读取响应内容时出错: {{error}}",
|
|
30
|
+
fetchError: "获取错误: {{error}}",
|
|
31
|
+
requestAborted: "请求中止,耗时 {{duration}}ms",
|
|
32
|
+
networkError: "网络错误 ({{code}}),可能需要使用浏览器模式重试",
|
|
33
|
+
requestTimeout: "请求超时,耗时 {{duration}}ms",
|
|
34
|
+
fetchFailed: "获取失败: {{error}}",
|
|
35
|
+
tooManyRedirects: "重定向次数过多 ({{redirects}})",
|
|
36
|
+
startingHtmlFetch: "开始HTML获取",
|
|
37
|
+
readingText: "获得响应,正在读取文本",
|
|
38
|
+
htmlContentLength: "HTML内容长度: {{length}} 字节",
|
|
39
|
+
startingJsonFetch: "开始JSON获取",
|
|
40
|
+
parsingJson: "解析JSON",
|
|
41
|
+
jsonParsed: "JSON解析成功",
|
|
42
|
+
jsonParseError: "JSON解析错误: {{error}}",
|
|
43
|
+
startingTxtFetch: "开始文本获取",
|
|
44
|
+
textContentLength: "文本内容长度: {{length}} 字节",
|
|
45
|
+
startingMarkdownFetch: "开始Markdown获取",
|
|
46
|
+
creatingTurndown: "创建Turndown服务",
|
|
47
|
+
convertingToMarkdown: "转换为Markdown",
|
|
48
|
+
markdownContentLength: "Markdown内容长度: {{length}} 字节",
|
|
49
|
+
checkingProxyEnv: "检查代理环境变量",
|
|
50
|
+
envVarValue: "环境变量 {{envVar}} 的值: {{value}}",
|
|
51
|
+
foundSystemProxy: "找到系统代理: {{proxy}}",
|
|
52
|
+
systemCommandProxySettings: "系统命令代理设置: {{output}}",
|
|
53
|
+
foundProxyFromCommand: "从命令中找到代理: {{proxy}}",
|
|
54
|
+
errorGettingProxyFromCommand: "从命令获取代理时出错: {{error}}",
|
|
55
|
+
checkingSystemEnvVars: "在平台 {{platform}} 上检查系统环境变量以获取代理设置",
|
|
56
|
+
windowsEnvVars: "Windows环境变量输出: {{output}}",
|
|
57
|
+
foundWindowsEnvProxy: "找到Windows环境代理: {{proxy}}",
|
|
58
|
+
errorGettingWindowsEnvVars: "获取Windows环境变量时出错: {{error}}",
|
|
59
|
+
unixEnvVars: "Unix环境变量输出: {{output}}",
|
|
60
|
+
foundUnixEnvProxy: "找到Unix环境代理: {{proxy}}",
|
|
61
|
+
errorGettingUnixEnvVars: "获取Unix环境变量时出错: {{error}}",
|
|
62
|
+
errorGettingSystemEnvVars: "获取系统环境变量时出错: {{error}}",
|
|
63
|
+
noSystemProxyFound: "未找到系统代理",
|
|
64
|
+
notSet: "未设置",
|
|
65
|
+
debug: "{{message}}",
|
|
66
|
+
none: "无"
|
|
67
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
import { server } from './server.js';
|
|
7
|
+
import { client } from './client.js';
|
|
8
|
+
import { fetcher } from './fetcher.js';
|
|
9
|
+
import { browser } from './browser.js';
|
|
10
|
+
import { node } from './node.js';
|
|
11
|
+
import { tools } from './tools.js';
|
|
12
|
+
import { errors } from './errors.js';
|
|
13
|
+
import resources from './resources.js';
|
|
14
|
+
import prompts from './prompts.js';
|
|
15
|
+
// 中文翻译资源 (Chinese translation resources)
|
|
16
|
+
export const zhTranslation = {
|
|
17
|
+
server,
|
|
18
|
+
client,
|
|
19
|
+
fetcher,
|
|
20
|
+
browser,
|
|
21
|
+
node,
|
|
22
|
+
tools,
|
|
23
|
+
errors,
|
|
24
|
+
resources,
|
|
25
|
+
prompts
|
|
26
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
// Node获取器相关消息 (Node fetcher related messages)
|
|
7
|
+
export const node = {
|
|
8
|
+
addingDelay: "添加随机延迟...",
|
|
9
|
+
noProxy: "不使用代理",
|
|
10
|
+
usingProxy: "使用代理: {{proxy}}",
|
|
11
|
+
usingHttpsProxy: "使用HTTPS代理代理",
|
|
12
|
+
usingHttpProxy: "使用HTTP代理代理",
|
|
13
|
+
usingUserAgent: "使用User-Agent: {{userAgent}}",
|
|
14
|
+
requestDetails: "请求详情: URL={{url}}, 方法={{method}}, 代理={{proxy}}",
|
|
15
|
+
requestOptions: "请求选项: {{options}}",
|
|
16
|
+
startingFetch: "开始获取请求...",
|
|
17
|
+
fetchingUrl: "获取URL: {{url}}",
|
|
18
|
+
responseStatus: "响应状态: {{status}} {{statusText}}",
|
|
19
|
+
redirectingTo: "重定向到: {{location}}",
|
|
20
|
+
constructedFullRedirectUrl: "构建完整重定向URL: {{redirectUrl}}",
|
|
21
|
+
requestSuccess: "请求成功",
|
|
22
|
+
errorResponse: "错误响应: {{status}} {{statusText}}",
|
|
23
|
+
errorResponseBody: "错误响应内容(前200字符): {{body}}",
|
|
24
|
+
errorReadingBody: "读取错误响应体失败: {{error}}",
|
|
25
|
+
fetchError: "获取错误: {{error}}",
|
|
26
|
+
requestAborted: "请求中止,耗时 {{duration}}ms",
|
|
27
|
+
networkError: "网络错误 ({{code}}),可能需要使用浏览器模式重试",
|
|
28
|
+
tooManyRedirects: "重定向次数过多 ({{redirects}})",
|
|
29
|
+
startingHtmlFetch: "开始HTML获取",
|
|
30
|
+
readingText: "获得响应,正在读取文本",
|
|
31
|
+
htmlContentLength: "HTML内容长度: {{length}} 字节",
|
|
32
|
+
htmlFetchError: "HTML获取错误: {{error}}",
|
|
33
|
+
startingJsonFetch: "开始JSON获取",
|
|
34
|
+
parsingJson: "获得响应,正在解析JSON",
|
|
35
|
+
jsonParsed: "JSON解析成功",
|
|
36
|
+
jsonParseError: "JSON解析错误: {{error}}",
|
|
37
|
+
jsonFetchError: "JSON获取错误: {{error}}",
|
|
38
|
+
startingTxtFetch: "开始TXT获取",
|
|
39
|
+
startingMarkdownFetch: "开始Markdown获取",
|
|
40
|
+
creatingTurndown: "创建TurndownService实例",
|
|
41
|
+
convertingToMarkdown: "将HTML转换为Markdown"
|
|
42
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
export default {
|
|
7
|
+
// 提示列表和获取 (Prompt list and get)
|
|
8
|
+
list: {
|
|
9
|
+
request: "收到提示列表请求: {params}"
|
|
10
|
+
},
|
|
11
|
+
get: {
|
|
12
|
+
request: "收到提示获取请求: {promptName}, {args}"
|
|
13
|
+
},
|
|
14
|
+
// 错误消息 (Error messages)
|
|
15
|
+
notFound: "提示模板未找到",
|
|
16
|
+
missingRequiredArg: "缺少必需参数",
|
|
17
|
+
useBrowserValue: "处理浏览器模式参数: 原始值={original}, 解析后={parsed}",
|
|
18
|
+
// 通用提示 (Generic prompt)
|
|
19
|
+
generic: {
|
|
20
|
+
result: "执行通用提示",
|
|
21
|
+
message: "执行提示模板",
|
|
22
|
+
args: "参数"
|
|
23
|
+
},
|
|
24
|
+
// 是/否 (Yes/No)
|
|
25
|
+
yes: "是",
|
|
26
|
+
no: "否",
|
|
27
|
+
// 提示描述和参数 (Prompt descriptions and parameters)
|
|
28
|
+
url: {
|
|
29
|
+
description: "网站URL"
|
|
30
|
+
},
|
|
31
|
+
format: {
|
|
32
|
+
description: "返回格式,可选值: html, json, text, markdown"
|
|
33
|
+
},
|
|
34
|
+
useBrowser: {
|
|
35
|
+
description: "是否使用浏览器模式获取内容"
|
|
36
|
+
},
|
|
37
|
+
selector: {
|
|
38
|
+
description: "CSS选择器,用于提取特定内容"
|
|
39
|
+
},
|
|
40
|
+
dataType: {
|
|
41
|
+
description: "要提取的数据类型,如表格、列表、联系信息等"
|
|
42
|
+
},
|
|
43
|
+
error: {
|
|
44
|
+
description: "获取过程中遇到的错误信息"
|
|
45
|
+
},
|
|
46
|
+
// 获取网站提示 (Fetch website prompt)
|
|
47
|
+
fetchWebsite: {
|
|
48
|
+
description: "获取网站内容",
|
|
49
|
+
result: "网站内容获取结果",
|
|
50
|
+
message: "我想获取一个网站的内容",
|
|
51
|
+
response: "我可以帮你获取网站内容。请提供网站URL和所需的格式。",
|
|
52
|
+
instruction: "请获取以下网站的内容",
|
|
53
|
+
formatInstruction: "请以以下格式返回内容",
|
|
54
|
+
browserInstruction: "是否使用浏览器模式"
|
|
55
|
+
},
|
|
56
|
+
// 提取内容提示 (Extract content prompt)
|
|
57
|
+
extractContent: {
|
|
58
|
+
description: "从网站提取特定内容",
|
|
59
|
+
result: "内容提取结果",
|
|
60
|
+
message: "请从以下网站提取内容",
|
|
61
|
+
selectorInstruction: "使用以下CSS选择器提取内容",
|
|
62
|
+
dataTypeInstruction: "提取以下类型的数据"
|
|
63
|
+
},
|
|
64
|
+
// 调试获取提示 (Debug fetch prompt)
|
|
65
|
+
debugFetch: {
|
|
66
|
+
description: "调试网站获取问题",
|
|
67
|
+
result: "获取问题调试结果",
|
|
68
|
+
message: "我在获取以下网站时遇到问题",
|
|
69
|
+
errorDetails: "错误详情",
|
|
70
|
+
instruction: "请分析可能的原因并提供解决方案。考虑以下几点:\n1. 网站是否有反爬虫措施\n2. 是否需要使用浏览器模式\n3. 是否需要设置特定的请求头\n4. 是否需要处理重定向或cookie\n5. 网站是否需要JavaScript渲染"
|
|
71
|
+
}
|
|
72
|
+
};
|