simple-dynamsoft-mcp 6.4.0 → 7.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.
Files changed (48) hide show
  1. package/.env.example +29 -7
  2. package/README.md +157 -506
  3. package/data/metadata/data-manifest.json +2 -2
  4. package/package.json +12 -7
  5. package/scripts/prebuild-rag-index.mjs +1 -1
  6. package/scripts/run-gemini-tests.mjs +1 -1
  7. package/scripts/sync-submodules.mjs +1 -1
  8. package/scripts/verify-doc-resources.mjs +1 -1
  9. package/src/data/bootstrap.js +475 -0
  10. package/src/data/download-utils.js +99 -0
  11. package/src/data/hydration-mode.js +15 -0
  12. package/src/data/hydration-policy.js +39 -0
  13. package/src/data/repo-map.js +149 -0
  14. package/src/{data-root.js → data/root.js} +1 -1
  15. package/src/{submodule-sync.js → data/submodule-sync.js} +1 -1
  16. package/src/index.js +49 -1499
  17. package/src/observability/logging.js +51 -0
  18. package/src/rag/config.js +96 -0
  19. package/src/rag/index.js +266 -0
  20. package/src/rag/lexical-provider.js +170 -0
  21. package/src/rag/logger.js +46 -0
  22. package/src/rag/profile-config.js +48 -0
  23. package/src/rag/providers.js +585 -0
  24. package/src/rag/search-utils.js +166 -0
  25. package/src/rag/vector-cache.js +323 -0
  26. package/src/server/create-server.js +168 -0
  27. package/src/server/helpers/server-helpers.js +33 -0
  28. package/src/{resource-index → server/resource-index}/paths.js +2 -2
  29. package/src/{resource-index → server/resource-index}/samples.js +9 -1
  30. package/src/{resource-index.js → server/resource-index.js} +117 -92
  31. package/src/server/resources/register-resources.js +56 -0
  32. package/src/server/runtime-config.js +66 -0
  33. package/src/server/tools/register-index-tools.js +130 -0
  34. package/src/server/tools/register-project-tools.js +305 -0
  35. package/src/server/tools/register-quickstart-tools.js +572 -0
  36. package/src/server/tools/register-sample-tools.js +333 -0
  37. package/src/server/tools/register-version-tools.js +136 -0
  38. package/src/server/transports/http.js +84 -0
  39. package/src/server/transports/stdio.js +12 -0
  40. package/src/data-bootstrap.js +0 -255
  41. package/src/rag.js +0 -1245
  42. /package/src/{gemini-retry.js → rag/gemini-retry.js} +0 -0
  43. /package/src/{normalizers.js → server/normalizers.js} +0 -0
  44. /package/src/{resource-index → server/resource-index}/builders.js +0 -0
  45. /package/src/{resource-index → server/resource-index}/config.js +0 -0
  46. /package/src/{resource-index → server/resource-index}/docs-loader.js +0 -0
  47. /package/src/{resource-index → server/resource-index}/uri.js +0 -0
  48. /package/src/{resource-index → server/resource-index}/version-policy.js +0 -0
@@ -0,0 +1,39 @@
1
+ const VALID_TYPES = new Set(["any", "doc", "sample"]);
2
+
3
+ function normalizeValue(value) {
4
+ if (value === undefined || value === null) return "";
5
+ return String(value).trim().toLowerCase();
6
+ }
7
+
8
+ function normalizeHydrationScope(scope) {
9
+ if (!scope || typeof scope !== "object") return null;
10
+ const product = normalizeValue(scope.product);
11
+ if (!product) return null;
12
+
13
+ const edition = normalizeValue(scope.edition);
14
+ const platform = normalizeValue(scope.platform);
15
+ const requestedType = normalizeValue(scope.type);
16
+ const type = VALID_TYPES.has(requestedType) ? requestedType : "any";
17
+
18
+ return {
19
+ product,
20
+ edition,
21
+ platform,
22
+ type
23
+ };
24
+ }
25
+
26
+ function normalizeHydrationScopes(scopes = []) {
27
+ if (!Array.isArray(scopes)) return [];
28
+ const normalized = [];
29
+ for (const scope of scopes) {
30
+ const value = normalizeHydrationScope(scope);
31
+ if (value) normalized.push(value);
32
+ }
33
+ return normalized;
34
+ }
35
+
36
+ export {
37
+ normalizeHydrationScope,
38
+ normalizeHydrationScopes
39
+ };
@@ -0,0 +1,149 @@
1
+ import { normalizeHydrationScopes } from "./hydration-policy.js";
2
+
3
+ const REPO_MAP = {
4
+ dbr: {
5
+ docs: {
6
+ web: ["documentation/barcode-reader-docs-js"],
7
+ mobile: ["documentation/barcode-reader-docs-mobile"],
8
+ server: ["documentation/barcode-reader-docs-server"],
9
+ any: [
10
+ "documentation/barcode-reader-docs-js",
11
+ "documentation/barcode-reader-docs-mobile",
12
+ "documentation/barcode-reader-docs-server"
13
+ ]
14
+ },
15
+ samples: {
16
+ web: ["samples/dynamsoft-barcode-reader"],
17
+ mobile: [
18
+ "samples/dynamsoft-barcode-reader-mobile",
19
+ "samples/dynamsoft-barcode-reader-maui",
20
+ "samples/dynamsoft-barcode-reader-react-native",
21
+ "samples/dynamsoft-barcode-reader-flutter"
22
+ ],
23
+ server: [
24
+ "samples/dynamsoft-barcode-reader-python",
25
+ "samples/dynamsoft-barcode-reader-dotnet",
26
+ "samples/dynamsoft-barcode-reader-java",
27
+ "samples/dynamsoft-barcode-reader-c-cpp",
28
+ "samples/dynamsoft-capture-vision-nodejs"
29
+ ],
30
+ any: [
31
+ "samples/dynamsoft-barcode-reader",
32
+ "samples/dynamsoft-barcode-reader-mobile",
33
+ "samples/dynamsoft-barcode-reader-python",
34
+ "samples/dynamsoft-barcode-reader-dotnet",
35
+ "samples/dynamsoft-barcode-reader-java",
36
+ "samples/dynamsoft-barcode-reader-c-cpp",
37
+ "samples/dynamsoft-barcode-reader-maui",
38
+ "samples/dynamsoft-barcode-reader-react-native",
39
+ "samples/dynamsoft-barcode-reader-flutter",
40
+ "samples/dynamsoft-capture-vision-nodejs"
41
+ ]
42
+ }
43
+ },
44
+ dcv: {
45
+ docs: {
46
+ core: ["documentation/capture-vision-docs"],
47
+ web: ["documentation/capture-vision-docs-js"],
48
+ mobile: ["documentation/capture-vision-docs-mobile"],
49
+ server: ["documentation/capture-vision-docs-server"],
50
+ any: [
51
+ "documentation/capture-vision-docs",
52
+ "documentation/capture-vision-docs-js",
53
+ "documentation/capture-vision-docs-mobile",
54
+ "documentation/capture-vision-docs-server"
55
+ ]
56
+ },
57
+ samples: {
58
+ web: ["samples/dynamsoft-capture-vision-javascript"],
59
+ mobile: [
60
+ "samples/dynamsoft-capture-vision-mobile",
61
+ "samples/dynamsoft-capture-vision-maui",
62
+ "samples/dynamsoft-capture-vision-react-native",
63
+ "samples/dynamsoft-capture-vision-flutter",
64
+ "samples/dynamsoft-capture-vision-spm"
65
+ ],
66
+ server: [
67
+ "samples/dynamsoft-capture-vision-python",
68
+ "samples/dynamsoft-capture-vision-dotnet",
69
+ "samples/dynamsoft-capture-vision-java",
70
+ "samples/dynamsoft-capture-vision-c-cpp",
71
+ "samples/dynamsoft-capture-vision-nodejs"
72
+ ],
73
+ any: [
74
+ "samples/dynamsoft-capture-vision-javascript",
75
+ "samples/dynamsoft-capture-vision-mobile",
76
+ "samples/dynamsoft-capture-vision-python",
77
+ "samples/dynamsoft-capture-vision-dotnet",
78
+ "samples/dynamsoft-capture-vision-java",
79
+ "samples/dynamsoft-capture-vision-c-cpp",
80
+ "samples/dynamsoft-capture-vision-maui",
81
+ "samples/dynamsoft-capture-vision-react-native",
82
+ "samples/dynamsoft-capture-vision-flutter",
83
+ "samples/dynamsoft-capture-vision-nodejs",
84
+ "samples/dynamsoft-capture-vision-spm"
85
+ ]
86
+ }
87
+ },
88
+ dwt: {
89
+ docs: {
90
+ any: ["documentation/web-twain-docs"]
91
+ },
92
+ samples: {
93
+ any: ["samples/dynamic-web-twain"]
94
+ }
95
+ },
96
+ ddv: {
97
+ docs: {
98
+ any: ["documentation/document-viewer-docs"]
99
+ },
100
+ samples: {
101
+ any: ["samples/dynamsoft-document-viewer"]
102
+ }
103
+ }
104
+ };
105
+
106
+ function getMappedPaths(product, edition, sourceType) {
107
+ const productMap = REPO_MAP[product];
108
+ if (!productMap) return [];
109
+ const typeMap = productMap[sourceType];
110
+ if (!typeMap) return [];
111
+ if (edition && typeMap[edition]) return typeMap[edition];
112
+ return typeMap.any || [];
113
+ }
114
+
115
+ function resolveRepoPathsForScopes(scopes = [], manifest = null) {
116
+ const manifestPaths = new Set(
117
+ Array.isArray(manifest?.repos) ? manifest.repos.map((repo) => String(repo.path || "")) : []
118
+ );
119
+
120
+ const normalizedScopes = normalizeHydrationScopes(scopes);
121
+ if (normalizedScopes.length === 0) {
122
+ if (manifestPaths.size === 0) return [];
123
+ return Array.from(manifestPaths).sort((a, b) => a.localeCompare(b));
124
+ }
125
+
126
+ const resolved = new Set();
127
+ for (const scope of normalizedScopes) {
128
+ const includeDocs = scope.type === "any" || scope.type === "doc";
129
+ const includeSamples = scope.type === "any" || scope.type === "sample";
130
+
131
+ if (includeDocs) {
132
+ for (const path of getMappedPaths(scope.product, scope.edition, "docs")) {
133
+ resolved.add(path);
134
+ }
135
+ }
136
+ if (includeSamples) {
137
+ for (const path of getMappedPaths(scope.product, scope.edition, "samples")) {
138
+ resolved.add(path);
139
+ }
140
+ }
141
+ }
142
+
143
+ const filtered = Array.from(resolved).filter((path) => manifestPaths.size === 0 || manifestPaths.has(path));
144
+ return filtered.sort((a, b) => a.localeCompare(b));
145
+ }
146
+
147
+ export {
148
+ resolveRepoPathsForScopes
149
+ };
@@ -2,7 +2,7 @@ import { dirname, join, resolve } from "node:path";
2
2
  import { fileURLToPath } from "node:url";
3
3
 
4
4
  const __dirname = dirname(fileURLToPath(import.meta.url));
5
- const projectRoot = join(__dirname, "..");
5
+ const projectRoot = join(__dirname, "..", "..");
6
6
  const bundledDataRoot = join(projectRoot, "data");
7
7
 
8
8
  function getResolvedDataRoot() {
@@ -4,7 +4,7 @@ import { join, dirname } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
 
6
6
  const __dirname = dirname(fileURLToPath(import.meta.url));
7
- const projectRoot = join(__dirname, "..");
7
+ const projectRoot = join(__dirname, "..", "..");
8
8
 
9
9
  function logDataSync(message) {
10
10
  console.error(`[data-sync] ${message}`);