@just-every/mcp-read-website-fast 0.1.18 → 0.1.20
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/bin/mcp-read-website.js +7 -6
- package/dist/index.js +5 -1
- package/dist/internal/fetchMarkdown.d.ts +1 -0
- package/dist/internal/fetchMarkdown.js +3 -0
- package/dist/serve.js +7 -0
- package/package.json +17 -16
package/bin/mcp-read-website.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from 'url';
|
|
4
4
|
import { dirname, join } from 'path';
|
|
5
5
|
import { existsSync } from 'fs';
|
|
6
6
|
|
|
@@ -19,10 +19,11 @@ async function main() {
|
|
|
19
19
|
// Use compiled JavaScript for production (fast startup)
|
|
20
20
|
if (command === 'serve') {
|
|
21
21
|
const servePath = join(__dirname, '..', 'dist', 'serve-restart.js');
|
|
22
|
-
|
|
22
|
+
// Convert absolute path to file:// URL for Windows ESM loader compatibility
|
|
23
|
+
await import(pathToFileURL(servePath).href);
|
|
23
24
|
} else {
|
|
24
25
|
const cliPath = join(__dirname, '..', 'dist', 'index.js');
|
|
25
|
-
await import(cliPath);
|
|
26
|
+
await import(pathToFileURL(cliPath).href);
|
|
26
27
|
}
|
|
27
28
|
} else {
|
|
28
29
|
// Fall back to TypeScript with tsx for development
|
|
@@ -31,10 +32,10 @@ async function main() {
|
|
|
31
32
|
|
|
32
33
|
if (command === 'serve') {
|
|
33
34
|
const servePath = join(__dirname, '..', 'src', 'serve-restart.ts');
|
|
34
|
-
await import(servePath);
|
|
35
|
+
await import(pathToFileURL(servePath).href);
|
|
35
36
|
} else {
|
|
36
37
|
const cliPath = join(__dirname, '..', 'src', 'index.ts');
|
|
37
|
-
await import(cliPath);
|
|
38
|
+
await import(pathToFileURL(cliPath).href);
|
|
38
39
|
}
|
|
39
40
|
} catch (error) {
|
|
40
41
|
console.error('Error: Development dependencies not installed. Please run "npm install" first.');
|
|
@@ -46,4 +47,4 @@ async function main() {
|
|
|
46
47
|
main().catch(err => {
|
|
47
48
|
console.error('Error:', err);
|
|
48
49
|
process.exit(1);
|
|
49
|
-
});
|
|
50
|
+
});
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ program
|
|
|
23
23
|
.option('-u, --user-agent <string>', 'Custom user agent')
|
|
24
24
|
.option('--cache-dir <path>', 'Cache directory', '.cache')
|
|
25
25
|
.option('-t, --timeout <ms>', 'Request timeout in milliseconds', '30000')
|
|
26
|
+
.option('--cookies-file <path>', 'Path to Netscape cookie file for authenticated pages')
|
|
26
27
|
.option('-o, --output <format>', 'Output format: json, markdown, or both', 'markdown')
|
|
27
28
|
.action(async (url, options) => {
|
|
28
29
|
try {
|
|
@@ -37,6 +38,9 @@ program
|
|
|
37
38
|
cacheDir: options.cacheDir,
|
|
38
39
|
timeout: parseInt(options.timeout, 10),
|
|
39
40
|
};
|
|
41
|
+
if (options.cookiesFile) {
|
|
42
|
+
crawlOptions.cookiesFile = options.cookiesFile;
|
|
43
|
+
}
|
|
40
44
|
console.error(`Fetching ${url}...`);
|
|
41
45
|
if (options.output === 'json') {
|
|
42
46
|
const results = await fetch(url, crawlOptions);
|
|
@@ -56,7 +60,7 @@ program
|
|
|
56
60
|
}
|
|
57
61
|
else if (options.output === 'both') {
|
|
58
62
|
const results = await fetch(url, crawlOptions);
|
|
59
|
-
results.forEach(result => {
|
|
63
|
+
results.forEach((result) => {
|
|
60
64
|
console.log(`\n## URL: ${result.url}\n`);
|
|
61
65
|
if (result.markdown) {
|
|
62
66
|
console.log(result.markdown);
|
|
@@ -20,6 +20,9 @@ export async function fetchMarkdown(url, options = {}) {
|
|
|
20
20
|
cacheDir: options.cacheDir ?? '.cache',
|
|
21
21
|
timeout: options.timeout ?? 30000,
|
|
22
22
|
};
|
|
23
|
+
if (options.cookiesFile) {
|
|
24
|
+
crawlOptions.cookiesFile = options.cookiesFile;
|
|
25
|
+
}
|
|
23
26
|
const results = await fetch(currentUrl, crawlOptions);
|
|
24
27
|
if (results && results.length > 0) {
|
|
25
28
|
const result = results[0];
|
package/dist/serve.js
CHANGED
|
@@ -44,6 +44,11 @@ const READ_WEBSITE_TOOL = {
|
|
|
44
44
|
minimum: 1,
|
|
45
45
|
maximum: 100,
|
|
46
46
|
},
|
|
47
|
+
cookiesFile: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
description: 'Path to Netscape cookie file for authenticated pages',
|
|
50
|
+
optional: true,
|
|
51
|
+
},
|
|
47
52
|
},
|
|
48
53
|
required: ['url'],
|
|
49
54
|
},
|
|
@@ -99,6 +104,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
99
104
|
logger.debug('Read parameters:', {
|
|
100
105
|
url: args.url,
|
|
101
106
|
pages: args.pages,
|
|
107
|
+
cookiesFile: args.cookiesFile,
|
|
102
108
|
});
|
|
103
109
|
logger.debug('Calling fetchMarkdown...');
|
|
104
110
|
const depth = args.pages > 1 ? 1 : 0;
|
|
@@ -106,6 +112,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
106
112
|
depth: depth,
|
|
107
113
|
respectRobots: false,
|
|
108
114
|
maxPages: args.pages ?? 1,
|
|
115
|
+
cookiesFile: args.cookiesFile,
|
|
109
116
|
});
|
|
110
117
|
logger.info('Content fetched successfully');
|
|
111
118
|
if (result.error && result.markdown) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@just-every/mcp-read-website-fast",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "Markdown Content Preprocessor - Fetch web pages, extract content, convert to clean Markdown",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -50,23 +50,24 @@
|
|
|
50
50
|
"homepage": "https://github.com/just-every/mcp-read-website-fast#readme",
|
|
51
51
|
"license": "MIT",
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@just-every/crawl": "^1.0.
|
|
54
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
55
|
-
"commander": "^14.0.0"
|
|
53
|
+
"@just-every/crawl": "^1.0.8",
|
|
54
|
+
"@modelcontextprotocol/sdk": "^1.17.4",
|
|
55
|
+
"commander": "^14.0.0",
|
|
56
|
+
"uuid": "^11.1.0"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
|
-
"@types/jsdom": "^21.1.
|
|
59
|
-
"@types/node": "^24.
|
|
60
|
-
"@types/turndown": "^5.0.
|
|
61
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
62
|
-
"@typescript-eslint/parser": "^8.
|
|
63
|
-
"eslint": "^9.
|
|
64
|
-
"eslint-config-prettier": "^10.1.
|
|
65
|
-
"eslint-plugin-prettier": "^5.4
|
|
66
|
-
"tsx": "^4.
|
|
67
|
-
"typescript": "^5.
|
|
68
|
-
"typescript-eslint": "^8.
|
|
69
|
-
"vitest": "^3.2.
|
|
59
|
+
"@types/jsdom": "^21.1.7",
|
|
60
|
+
"@types/node": "^24.3.0",
|
|
61
|
+
"@types/turndown": "^5.0.5",
|
|
62
|
+
"@typescript-eslint/eslint-plugin": "^8.41.0",
|
|
63
|
+
"@typescript-eslint/parser": "^8.41.0",
|
|
64
|
+
"eslint": "^9.34.0",
|
|
65
|
+
"eslint-config-prettier": "^10.1.8",
|
|
66
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
67
|
+
"tsx": "^4.20.5",
|
|
68
|
+
"typescript": "^5.9.2",
|
|
69
|
+
"typescript-eslint": "^8.41.0",
|
|
70
|
+
"vitest": "^3.2.4"
|
|
70
71
|
},
|
|
71
72
|
"engines": {
|
|
72
73
|
"node": ">=20.0.0"
|