@vespermcp/mcp-server 1.1.2 → 1.1.3
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { listFiles } from "@huggingface/hub";
|
|
2
|
+
import path from "path";
|
|
2
3
|
import { RobustDownloader } from "../utils/downloader.js";
|
|
3
4
|
export class HFDownloader {
|
|
4
5
|
hfToken;
|
|
@@ -14,13 +15,26 @@ export class HFDownloader {
|
|
|
14
15
|
async findBestFile(repoId) {
|
|
15
16
|
try {
|
|
16
17
|
const files = [];
|
|
18
|
+
const blacklist = [
|
|
19
|
+
".gitattributes",
|
|
20
|
+
".gitignore",
|
|
21
|
+
".git",
|
|
22
|
+
"README.md",
|
|
23
|
+
"LICENSE",
|
|
24
|
+
"package.json",
|
|
25
|
+
"requirements.txt",
|
|
26
|
+
"setup.py"
|
|
27
|
+
];
|
|
17
28
|
for await (const file of listFiles({
|
|
18
29
|
repo: { type: "dataset", name: repoId },
|
|
19
30
|
recursive: true,
|
|
20
31
|
...(this.hfToken ? { accessToken: this.hfToken } : {})
|
|
21
32
|
})) {
|
|
22
33
|
if (file.type === "file") {
|
|
23
|
-
|
|
34
|
+
const fileName = path.basename(file.path);
|
|
35
|
+
if (!blacklist.includes(fileName) && !fileName.startsWith(".")) {
|
|
36
|
+
files.push(file.path);
|
|
37
|
+
}
|
|
24
38
|
}
|
|
25
39
|
}
|
|
26
40
|
// Priority logic for data scientists
|
|
@@ -39,7 +53,13 @@ export class HFDownloader {
|
|
|
39
53
|
if (match)
|
|
40
54
|
return match;
|
|
41
55
|
}
|
|
42
|
-
return
|
|
56
|
+
// Strict fallback: Only return the first file if it has a data-like extension
|
|
57
|
+
const dataExtensions = [".csv", ".parquet", ".jsonl", ".json", ".txt", ".tsv", ".avro", ".orc"];
|
|
58
|
+
const fallback = files.find(f => {
|
|
59
|
+
const ext = path.extname(f).toLowerCase();
|
|
60
|
+
return dataExtensions.includes(ext);
|
|
61
|
+
});
|
|
62
|
+
return fallback || null;
|
|
43
63
|
}
|
|
44
64
|
catch (error) {
|
|
45
65
|
console.error(`[HF] Failed to list files for ${repoId}:`, error.message);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vespermcp/mcp-server",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "AI-powered dataset discovery, quality analysis, and preparation MCP server with multimodal support (text, image, audio, video)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.js",
|