mineru-mcp 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.
- package/dist/index.js +33 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -180,7 +180,7 @@ export default function createServer({ config }) {
|
|
|
180
180
|
});
|
|
181
181
|
// Tool 3: mineru_batch
|
|
182
182
|
server.tool("mineru_batch", "Parse multiple URLs in one batch (max 200). Preferred over mineru_upload_batch — faster and more reliable. Use public URLs (arXiv, SSRN, publisher sites) when available.", {
|
|
183
|
-
urls: z.array(z.string()).describe("Array of document URLs"),
|
|
183
|
+
urls: z.union([z.array(z.string()), z.string()]).describe("Array of document URLs, or a single URL string"),
|
|
184
184
|
model: z
|
|
185
185
|
.enum(["pipeline", "vlm"])
|
|
186
186
|
.optional()
|
|
@@ -194,11 +194,25 @@ export default function createServer({ config }) {
|
|
|
194
194
|
.optional()
|
|
195
195
|
.describe("Extra export formats"),
|
|
196
196
|
}, async (params) => {
|
|
197
|
-
|
|
197
|
+
// Normalize urls: accept string (JSON array or single URL) or array
|
|
198
|
+
let urls;
|
|
199
|
+
if (typeof params.urls === "string") {
|
|
200
|
+
try {
|
|
201
|
+
const parsed = JSON.parse(params.urls);
|
|
202
|
+
urls = Array.isArray(parsed) ? parsed : [params.urls];
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
urls = [params.urls];
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
urls = params.urls;
|
|
210
|
+
}
|
|
211
|
+
if (urls.length > 200) {
|
|
198
212
|
throw new Error("Max 200 URLs per batch. Split into smaller batches.");
|
|
199
213
|
}
|
|
200
214
|
const requestData = {
|
|
201
|
-
files:
|
|
215
|
+
files: urls.map((url) => ({ url })),
|
|
202
216
|
model_version: params.model || defaultModel,
|
|
203
217
|
};
|
|
204
218
|
if (params.ocr !== undefined)
|
|
@@ -216,7 +230,7 @@ export default function createServer({ config }) {
|
|
|
216
230
|
content: [
|
|
217
231
|
{
|
|
218
232
|
type: "text",
|
|
219
|
-
text: `Batch created: ${result.batch_id}\n${
|
|
233
|
+
text: `Batch created: ${result.batch_id}\n${urls.length} files queued.\nUse mineru_batch_status to check progress.`,
|
|
220
234
|
},
|
|
221
235
|
],
|
|
222
236
|
};
|
|
@@ -243,7 +257,7 @@ export default function createServer({ config }) {
|
|
|
243
257
|
// Tool 5: mineru_upload_batch
|
|
244
258
|
server.tool("mineru_upload_batch", "Upload local files for batch parsing. SLOW: uploads can take minutes and may timeout. Prefer mineru_batch with public URLs (arXiv, SSRN, publisher sites) when available — it's faster and more reliable. Only use this for files not available online.", {
|
|
245
259
|
directory: z.string().optional().describe("Directory path containing PDF/DOC/PPT files"),
|
|
246
|
-
files: z.array(z.string()).optional().describe("Array of absolute file paths
|
|
260
|
+
files: z.union([z.array(z.string()), z.string()]).optional().describe("Array of absolute file paths, or a single path string"),
|
|
247
261
|
model: z
|
|
248
262
|
.enum(["pipeline", "vlm"])
|
|
249
263
|
.optional()
|
|
@@ -257,10 +271,21 @@ export default function createServer({ config }) {
|
|
|
257
271
|
.describe("Extra export formats"),
|
|
258
272
|
}, async (params) => {
|
|
259
273
|
const supportedExts = new Set([".pdf", ".doc", ".docx", ".ppt", ".pptx", ".png", ".jpg", ".jpeg"]);
|
|
260
|
-
// Collect files
|
|
274
|
+
// Collect files — normalize string input (JSON array or single path)
|
|
261
275
|
let filePaths = [];
|
|
262
|
-
if (params.files
|
|
263
|
-
|
|
276
|
+
if (params.files) {
|
|
277
|
+
if (typeof params.files === "string") {
|
|
278
|
+
try {
|
|
279
|
+
const parsed = JSON.parse(params.files);
|
|
280
|
+
filePaths = Array.isArray(parsed) ? parsed : [params.files];
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
filePaths = [params.files];
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
filePaths = params.files;
|
|
288
|
+
}
|
|
264
289
|
}
|
|
265
290
|
else if (params.directory) {
|
|
266
291
|
const dir = params.directory;
|