simple-dynamsoft-mcp 7.2.3 → 7.2.4
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.
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"branch": "main",
|
|
29
29
|
"owner": "dynamsoft-docs",
|
|
30
30
|
"repo": "barcode-reader-docs-server",
|
|
31
|
-
"commit": "
|
|
32
|
-
"archiveUrl": "https://codeload.github.com/dynamsoft-docs/barcode-reader-docs-server/zip/
|
|
31
|
+
"commit": "5479d530342edc40d1602addebbb8cd60ed781ce",
|
|
32
|
+
"archiveUrl": "https://codeload.github.com/dynamsoft-docs/barcode-reader-docs-server/zip/5479d530342edc40d1602addebbb8cd60ed781ce"
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
"name": "data/documentation/capture-vision-docs",
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"branch": "main",
|
|
79
79
|
"owner": "dynamsoft-docs",
|
|
80
80
|
"repo": "document-viewer-docs",
|
|
81
|
-
"commit": "
|
|
82
|
-
"archiveUrl": "https://codeload.github.com/dynamsoft-docs/document-viewer-docs/zip/
|
|
81
|
+
"commit": "4a49e918d174f4efac927981b81c81024d9ba3dc",
|
|
82
|
+
"archiveUrl": "https://codeload.github.com/dynamsoft-docs/document-viewer-docs/zip/4a49e918d174f4efac927981b81c81024d9ba3dc"
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
"name": "data/documentation/web-twain-docs",
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
"branch": "master",
|
|
89
89
|
"owner": "dynamsoft-docs",
|
|
90
90
|
"repo": "web-twain-docs",
|
|
91
|
-
"commit": "
|
|
92
|
-
"archiveUrl": "https://codeload.github.com/dynamsoft-docs/web-twain-docs/zip/
|
|
91
|
+
"commit": "a38d73c583b8379c0d80337e92f291f6c1ab10a8",
|
|
92
|
+
"archiveUrl": "https://codeload.github.com/dynamsoft-docs/web-twain-docs/zip/a38d73c583b8379c0d80337e92f291f6c1ab10a8"
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
"name": "data/samples/dynamic-web-twain",
|
|
@@ -492,7 +492,7 @@
|
|
|
492
492
|
"ddv": {
|
|
493
493
|
"name": "Dynamsoft Document Viewer",
|
|
494
494
|
"description": "Browser-based JavaScript SDK for viewing, editing, and annotating documents (PDFs and images).",
|
|
495
|
-
"version": "3.2",
|
|
495
|
+
"version": "3.2.1",
|
|
496
496
|
"default_platform": "web",
|
|
497
497
|
"snippet_path": "dynamsoft-document-viewer",
|
|
498
498
|
"api_docs": "ddv-api-docs.json",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "simple-dynamsoft-mcp",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.4",
|
|
4
4
|
"description": "MCP server for Dynamsoft SDKs - Capture Vision, Barcode Reader (Mobile/Python/Web), Dynamic Web TWAIN, and Document Viewer. Provides documentation, code snippets, and API guidance.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"scripts": {
|
|
25
25
|
"start": "node src/index.js",
|
|
26
26
|
"test": "npm run test:lite",
|
|
27
|
-
"test:unit": "node --test test/unit/gemini-retry.test.js test/unit/profile-config.test.js test/unit/lexical-provider.test.js test/unit/hydration-mode.test.js test/unit/hydration-policy.test.js test/unit/repo-map.test.js test/unit/download-utils.test.js test/unit/logging.test.js test/unit/create-server.test.js test/unit/server-helpers.test.js",
|
|
27
|
+
"test:unit": "node --test test/unit/gemini-retry.test.js test/unit/profile-config.test.js test/unit/lexical-provider.test.js test/unit/hydration-mode.test.js test/unit/hydration-policy.test.js test/unit/repo-map.test.js test/unit/download-utils.test.js test/unit/logging.test.js test/unit/rag-signature-manifest.test.js test/unit/create-server.test.js test/unit/server-helpers.test.js",
|
|
28
28
|
"test:lite": "npm run test:stdio && npm run test:http && npm run test:package",
|
|
29
29
|
"test:lexical": "node --test test/integration/stdio.test.js test/integration/http.test.js",
|
|
30
30
|
"test:gemini": "node scripts/run-gemini-tests.mjs",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { existsSync, readFileSync
|
|
2
|
-
import { dirname, join, resolve } from "node:path";
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join, relative, resolve } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { DOC_DIRS, SAMPLE_DIRS } from "./config.js";
|
|
5
5
|
import { getResolvedDataRoot } from "../../data/root.js";
|
|
@@ -13,6 +13,9 @@ const samplesRoot = join(dataRoot, "samples");
|
|
|
13
13
|
const docsRoot = join(dataRoot, "documentation");
|
|
14
14
|
|
|
15
15
|
const registryPath = join(metadataRoot, "dynamsoft_sdks.json");
|
|
16
|
+
const dataManifestPath = join(metadataRoot, "data-manifest.json");
|
|
17
|
+
|
|
18
|
+
const manifestCommitLookupCache = new Map();
|
|
16
19
|
|
|
17
20
|
const SAMPLE_ROOTS = {
|
|
18
21
|
dbrWeb: join(samplesRoot, SAMPLE_DIRS.dbrWeb),
|
|
@@ -60,28 +63,92 @@ function getExistingPath(...candidates) {
|
|
|
60
63
|
return null;
|
|
61
64
|
}
|
|
62
65
|
|
|
63
|
-
function
|
|
66
|
+
function normalizeManifestRepoPath(pathValue) {
|
|
67
|
+
return String(pathValue || "")
|
|
68
|
+
.replace(/\\/g, "/")
|
|
69
|
+
.replace(/^\.\//, "")
|
|
70
|
+
.replace(/^\/+/, "")
|
|
71
|
+
.replace(/\/+$/, "");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function getManifestRepoPath(repoPath, dataRootPath = dataRoot) {
|
|
75
|
+
const resolvedDataRoot = resolve(dataRootPath);
|
|
76
|
+
const resolvedRepoPath = resolve(repoPath);
|
|
77
|
+
const manifestRepoPath = normalizeManifestRepoPath(
|
|
78
|
+
relative(resolvedDataRoot, resolvedRepoPath)
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
if (!manifestRepoPath || manifestRepoPath === ".") {
|
|
82
|
+
throw new Error(`Unable to resolve manifest repo path for ${repoPath}`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (manifestRepoPath.startsWith("..")) {
|
|
86
|
+
throw new Error(
|
|
87
|
+
`Repo path ${repoPath} is outside data root ${resolvedDataRoot}`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return manifestRepoPath;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function buildManifestCommitLookup(manifestPath = dataManifestPath) {
|
|
95
|
+
const resolvedManifestPath = resolve(manifestPath);
|
|
96
|
+
const cachedLookup = manifestCommitLookupCache.get(resolvedManifestPath);
|
|
97
|
+
if (cachedLookup) {
|
|
98
|
+
return cachedLookup;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (!existsSync(resolvedManifestPath)) {
|
|
102
|
+
throw new Error(`Missing data manifest at ${resolvedManifestPath}`);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
let manifest = null;
|
|
64
106
|
try {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
107
|
+
manifest = JSON.parse(readFileSync(resolvedManifestPath, "utf8"));
|
|
108
|
+
} catch (error) {
|
|
109
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
110
|
+
throw new Error(
|
|
111
|
+
`Failed to parse data manifest at ${resolvedManifestPath}: ${reason}`
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (!manifest || !Array.isArray(manifest.repos)) {
|
|
116
|
+
throw new Error(
|
|
117
|
+
`Invalid data manifest at ${resolvedManifestPath}: missing repos array`
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const lookup = new Map();
|
|
122
|
+
for (const repo of manifest.repos) {
|
|
123
|
+
const repoPath = normalizeManifestRepoPath(repo?.path);
|
|
124
|
+
const commit = String(repo?.commit || "").trim();
|
|
125
|
+
if (!repoPath || !commit) {
|
|
126
|
+
throw new Error(
|
|
127
|
+
`Invalid data manifest entry at ${resolvedManifestPath}: path and commit are required`
|
|
128
|
+
);
|
|
74
129
|
}
|
|
75
|
-
|
|
76
|
-
if (!existsSync(headPath)) return "";
|
|
77
|
-
const headText = readFileSync(headPath, "utf8").trim();
|
|
78
|
-
if (!headText.startsWith("ref:")) return headText;
|
|
79
|
-
const refPath = join(gitDir, headText.slice("ref:".length).trim());
|
|
80
|
-
if (!existsSync(refPath)) return "";
|
|
81
|
-
return readFileSync(refPath, "utf8").trim();
|
|
82
|
-
} catch {
|
|
83
|
-
return "";
|
|
130
|
+
lookup.set(repoPath, commit);
|
|
84
131
|
}
|
|
132
|
+
|
|
133
|
+
manifestCommitLookupCache.set(resolvedManifestPath, lookup);
|
|
134
|
+
return lookup;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function readManifestRepoCommit(repoPath, options = {}) {
|
|
138
|
+
const dataRootPath = options.dataRootPath || dataRoot;
|
|
139
|
+
const manifestPath = options.manifestPath || dataManifestPath;
|
|
140
|
+
const commitLookup =
|
|
141
|
+
options.commitLookup || buildManifestCommitLookup(manifestPath);
|
|
142
|
+
const manifestRepoPath = getManifestRepoPath(repoPath, dataRootPath);
|
|
143
|
+
const commit = commitLookup.get(manifestRepoPath);
|
|
144
|
+
|
|
145
|
+
if (!commit) {
|
|
146
|
+
throw new Error(
|
|
147
|
+
`Missing commit for ${manifestRepoPath} in data manifest ${resolve(manifestPath)}`
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return commit;
|
|
85
152
|
}
|
|
86
153
|
|
|
87
154
|
export {
|
|
@@ -91,8 +158,10 @@ export {
|
|
|
91
158
|
samplesRoot,
|
|
92
159
|
docsRoot,
|
|
93
160
|
registryPath,
|
|
161
|
+
dataManifestPath,
|
|
94
162
|
SAMPLE_ROOTS,
|
|
95
163
|
DOC_ROOTS,
|
|
96
164
|
getExistingPath,
|
|
97
|
-
|
|
165
|
+
buildManifestCommitLookup,
|
|
166
|
+
readManifestRepoCommit
|
|
98
167
|
};
|
|
@@ -17,7 +17,12 @@ import {
|
|
|
17
17
|
} from "./normalizers.js";
|
|
18
18
|
import { DOCS_CONFIG } from "./resource-index/config.js";
|
|
19
19
|
import { loadMarkdownDocs } from "./resource-index/docs-loader.js";
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
registryPath,
|
|
22
|
+
DOC_ROOTS,
|
|
23
|
+
SAMPLE_ROOTS,
|
|
24
|
+
readManifestRepoCommit
|
|
25
|
+
} from "./resource-index/paths.js";
|
|
21
26
|
import {
|
|
22
27
|
getCodeFileExtensions,
|
|
23
28
|
isCodeFile,
|
|
@@ -489,38 +494,38 @@ function getRagSignatureData() {
|
|
|
489
494
|
ddvDocCount: ddvDocs.articles.length,
|
|
490
495
|
versions: LATEST_VERSIONS,
|
|
491
496
|
dataSources: {
|
|
492
|
-
dbrWebSamplesHead:
|
|
493
|
-
dbrMobileSamplesHead:
|
|
494
|
-
dbrPythonSamplesHead:
|
|
495
|
-
dbrDotnetSamplesHead:
|
|
496
|
-
dbrJavaSamplesHead:
|
|
497
|
-
dbrCppSamplesHead:
|
|
498
|
-
dbrMauiSamplesHead:
|
|
499
|
-
dbrReactNativeSamplesHead:
|
|
500
|
-
dbrFlutterSamplesHead:
|
|
501
|
-
dbrNodejsSamplesHead:
|
|
502
|
-
dcvWebSamplesHead:
|
|
503
|
-
dcvMobileSamplesHead:
|
|
504
|
-
dcvPythonSamplesHead:
|
|
505
|
-
dcvDotnetSamplesHead:
|
|
506
|
-
dcvJavaSamplesHead:
|
|
507
|
-
dcvCppSamplesHead:
|
|
508
|
-
dcvMauiSamplesHead:
|
|
509
|
-
dcvReactNativeSamplesHead:
|
|
510
|
-
dcvFlutterSamplesHead:
|
|
511
|
-
dcvNodejsSamplesHead:
|
|
512
|
-
dcvSpmSamplesHead:
|
|
513
|
-
dwtSamplesHead:
|
|
514
|
-
ddvSamplesHead:
|
|
515
|
-
dbrWebDocsHead:
|
|
516
|
-
dbrMobileDocsHead:
|
|
517
|
-
dbrServerDocsHead:
|
|
518
|
-
dcvCoreDocsHead:
|
|
519
|
-
dcvWebDocsHead:
|
|
520
|
-
dcvMobileDocsHead:
|
|
521
|
-
dcvServerDocsHead:
|
|
522
|
-
dwtDocsHead:
|
|
523
|
-
ddvDocsHead:
|
|
497
|
+
dbrWebSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dbrWeb),
|
|
498
|
+
dbrMobileSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dbrMobile),
|
|
499
|
+
dbrPythonSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dbrPython),
|
|
500
|
+
dbrDotnetSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dbrDotnet),
|
|
501
|
+
dbrJavaSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dbrJava),
|
|
502
|
+
dbrCppSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dbrCpp),
|
|
503
|
+
dbrMauiSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dbrMaui),
|
|
504
|
+
dbrReactNativeSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dbrReactNative),
|
|
505
|
+
dbrFlutterSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dbrFlutter),
|
|
506
|
+
dbrNodejsSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dbrNodejs),
|
|
507
|
+
dcvWebSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dcvWeb),
|
|
508
|
+
dcvMobileSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dcvMobile),
|
|
509
|
+
dcvPythonSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dcvPython),
|
|
510
|
+
dcvDotnetSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dcvDotnet),
|
|
511
|
+
dcvJavaSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dcvJava),
|
|
512
|
+
dcvCppSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dcvCpp),
|
|
513
|
+
dcvMauiSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dcvMaui),
|
|
514
|
+
dcvReactNativeSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dcvReactNative),
|
|
515
|
+
dcvFlutterSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dcvFlutter),
|
|
516
|
+
dcvNodejsSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dcvNodejs),
|
|
517
|
+
dcvSpmSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dcvSpm),
|
|
518
|
+
dwtSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.dwt),
|
|
519
|
+
ddvSamplesHead: readManifestRepoCommit(SAMPLE_ROOTS.ddv),
|
|
520
|
+
dbrWebDocsHead: readManifestRepoCommit(DOC_ROOTS.dbrWeb),
|
|
521
|
+
dbrMobileDocsHead: readManifestRepoCommit(DOC_ROOTS.dbrMobile),
|
|
522
|
+
dbrServerDocsHead: readManifestRepoCommit(DOC_ROOTS.dbrServer),
|
|
523
|
+
dcvCoreDocsHead: readManifestRepoCommit(DOC_ROOTS.dcvCore),
|
|
524
|
+
dcvWebDocsHead: readManifestRepoCommit(DOC_ROOTS.dcvWeb),
|
|
525
|
+
dcvMobileDocsHead: readManifestRepoCommit(DOC_ROOTS.dcvMobile),
|
|
526
|
+
dcvServerDocsHead: readManifestRepoCommit(DOC_ROOTS.dcvServer),
|
|
527
|
+
dwtDocsHead: readManifestRepoCommit(DOC_ROOTS.dwt),
|
|
528
|
+
ddvDocsHead: readManifestRepoCommit(DOC_ROOTS.ddv),
|
|
524
529
|
registrySha256
|
|
525
530
|
}
|
|
526
531
|
};
|