crawlforge-mcp-server 4.2.12 → 4.6.0

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.
Files changed (48) hide show
  1. package/CLAUDE.md +19 -7
  2. package/README.md +11 -3
  3. package/package.json +3 -2
  4. package/server.js +195 -22
  5. package/src/cli/commands/init.js +107 -0
  6. package/src/cli/index.js +2 -0
  7. package/src/constants/config.js +5 -0
  8. package/src/core/ActionExecutor.js +13 -1
  9. package/src/core/AgentOrchestrator.js +300 -0
  10. package/src/core/AuthManager.js +21 -1
  11. package/src/core/ChangeTracker.js +8 -5
  12. package/src/core/LLMsTxtAnalyzer.js +71 -47
  13. package/src/core/LocalizationManager.js +7 -4
  14. package/src/core/ResearchOrchestrator.js +10 -6
  15. package/src/core/StealthBrowserManager.js +52 -13
  16. package/src/core/analysis/ContentAnalyzer.js +2 -2
  17. package/src/core/crawlers/BFSCrawler.js +23 -12
  18. package/src/core/processing/ContentProcessor.js +19 -3
  19. package/src/core/processing/PDFProcessor.js +72 -23
  20. package/src/tools/advanced/ScrapeWithActionsTool.js +63 -25
  21. package/src/tools/advanced/batchScrape/index.js +3 -1
  22. package/src/tools/advanced/batchScrape/reporter.js +5 -1
  23. package/src/tools/advanced/batchScrape/worker.js +6 -1
  24. package/src/tools/agent/agent.js +71 -0
  25. package/src/tools/basic/_fetch.js +78 -5
  26. package/src/tools/basic/extractLinks.js +1 -1
  27. package/src/tools/basic/extractMetadata.js +65 -1
  28. package/src/tools/basic/extractText.js +73 -5
  29. package/src/tools/basic/scrapeStructured.js +48 -10
  30. package/src/tools/crawl/crawlDeep.js +13 -5
  31. package/src/tools/crawl/mapSite.js +53 -52
  32. package/src/tools/extract/analyzeContent.js +11 -6
  33. package/src/tools/extract/extractContent.js +23 -5
  34. package/src/tools/extract/extractStructured.js +65 -16
  35. package/src/tools/extract/extractWithLlm.js +192 -11
  36. package/src/tools/extract/listOllamaModels.js +19 -8
  37. package/src/tools/extract/processDocument.js +10 -4
  38. package/src/tools/extract/summarizeContent.js +58 -1
  39. package/src/tools/llmstxt/generateLLMsTxt.js +124 -3
  40. package/src/tools/research/deepResearch.js +43 -4
  41. package/src/tools/scrape/unifiedScrape.js +314 -0
  42. package/src/tools/search/providers/searxng.js +2 -2
  43. package/src/tools/search/ranking/ResultDeduplicator.js +32 -9
  44. package/src/tools/search/ranking/ResultRanker.js +13 -4
  45. package/src/tools/search/searchWeb.js +5 -5
  46. package/src/tools/templates/TemplateRegistry.js +3 -2
  47. package/src/tools/tracking/trackChanges/differ.js +33 -1
  48. package/src/utils/htmlToMarkdown.js +5 -1
@@ -3,6 +3,38 @@
3
3
  * URL content fetching and history/stat helper functions.
4
4
  */
5
5
 
6
+ /**
7
+ * Default Jaccard similarity threshold below which a change is considered
8
+ * meaningful (i.e. worth flagging). 0.85 means content must be at least 85 %
9
+ * similar to be treated as "no significant change".
10
+ */
11
+ export const DEFAULT_CHANGE_THRESHOLD = 0.85;
12
+
13
+ /**
14
+ * Compute token-based Jaccard similarity between two text strings.
15
+ * Tokenises on whitespace; returns a value in [0, 1] where 1 is identical.
16
+ *
17
+ * @param {string} text1
18
+ * @param {string} text2
19
+ * @returns {number}
20
+ */
21
+ export function calculateSimilarity(text1, text2) {
22
+ if (!text1 && !text2) return 1;
23
+ if (!text1 || !text2) return 0;
24
+
25
+ const tokenise = (str) => new Set(str.toLowerCase().split(/\s+/).filter(Boolean));
26
+ const setA = tokenise(text1);
27
+ const setB = tokenise(text2);
28
+
29
+ let intersection = 0;
30
+ for (const token of setA) {
31
+ if (setB.has(token)) intersection++;
32
+ }
33
+
34
+ const union = setA.size + setB.size - intersection;
35
+ return union === 0 ? 1 : intersection / union;
36
+ }
37
+
6
38
  /**
7
39
  * Fetch the HTML/text content of a URL with change-tracking headers.
8
40
  * @param {string} url
@@ -18,7 +50,7 @@ export async function fetchContent(url) {
18
50
  'Accept-Encoding': 'gzip, deflate',
19
51
  'Cache-Control': 'no-cache'
20
52
  },
21
- timeout: 30000
53
+ signal: AbortSignal.timeout(30000)
22
54
  });
23
55
 
24
56
  if (!response.ok) {
@@ -11,10 +11,11 @@
11
11
  * headingStyle: 'atx' -> # H1 / ## H2 instead of underline style
12
12
  * codeBlockStyle: 'fenced' -> triple-backtick fences
13
13
  * bulletListMarker: '-'
14
- * - Tables fall back to prose (no GFM plugin loaded by default).
14
+ * - GFM plugin enabled for table support (turndown-plugin-gfm).
15
15
  */
16
16
 
17
17
  import TurndownService from 'turndown';
18
+ import { gfm } from 'turndown-plugin-gfm';
18
19
 
19
20
  let _td = null;
20
21
 
@@ -30,6 +31,9 @@ function getTurndown() {
30
31
  linkStyle: 'inlined'
31
32
  });
32
33
 
34
+ // Enable GFM extensions (tables, strikethrough, task lists)
35
+ _td.use(gfm);
36
+
33
37
  // Remove boilerplate elements before converting
34
38
  _td.remove(['script', 'style', 'nav', 'footer', 'aside', 'noscript']);
35
39
  }