@opencraw/mcp 0.1.44 → 0.1.45

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 (2) hide show
  1. package/dist/index.esm.js +19 -5
  2. package/package.json +3 -3
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
2
2
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
- import { readRecordsFile, diffRecords, memorySink, jsonLinesSink, createCrawler, RecipeSet, RecipeValidationError, RecipeBindingError, parseOutputRecipe, parseInputRecipe, bindRecipeSet } from '@opencraw/core';
3
+ import { readRecordsFile, diffRecords, memorySink, fileSink, createCrawler, RecipeSet, RecipeValidationError, RecipeBindingError, parseOutputRecipe, parseInputRecipe, bindRecipeSet } from '@opencraw/core';
4
4
  import { diffReport, readRecipeFiles, probeUrl, loadForRun, loadPlugins, resolveAccess } from '@opencraw/cli';
5
5
  import { z } from 'zod';
6
6
 
@@ -173,7 +173,7 @@ const RECORD_CAP = 50;
173
173
  /** Input schema for the `run` tool. */
174
174
  const runInputShape = {
175
175
  ...recipeSourceShape,
176
- out: z.string().optional().describe('Write records to this JSON Lines file instead of returning them inline. Use for a crawl expected to produce more than a handful of records.'),
176
+ out: z.string().optional().describe('Write records to this file instead of returning them inline; its extension is the format: .jsonl, .json, .csv, .xlsx, .yml/.yaml, .html or .pdf (any other extension is an error). Use for a crawl expected to produce more than a handful of records.'),
177
177
  append: z.boolean().optional().describe('Keep what "out" holds and add to it; each line carries _key. Needs "out".'),
178
178
  resume: z.boolean().optional().describe('Skip records "out" already has. Needs "append".'),
179
179
  only: z.array(z.string()).optional().describe('Run only these input recipe ids.'),
@@ -216,9 +216,23 @@ async function runTool(args) {
216
216
  };
217
217
  }
218
218
  let crawler;
219
- const sink = args.dryRun === true || args.out === undefined ? memorySink() : jsonLinesSink(args.out, {
220
- append: args.append
221
- });
219
+ let sink;
220
+ try {
221
+ sink = args.dryRun === true || args.out === undefined ? memorySink() : fileSink(args.out, {
222
+ append: args.append,
223
+ browser: {
224
+ executablePath: args.browserPath ?? process.env.OPENCRAW_CHROMIUM
225
+ }
226
+ });
227
+ } catch (error) {
228
+ return {
229
+ content: [{
230
+ type: 'text',
231
+ text: error instanceof Error ? error.message : String(error)
232
+ }],
233
+ isError: true
234
+ };
235
+ }
222
236
  try {
223
237
  const pluginsFile = serverFile('OPENCRAW_PLUGINS') ?? serverFile('OPENCRAW_HOOKS');
224
238
  const plugins = pluginsFile === undefined ? undefined : await loadPlugins(pluginsFile);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencraw/mcp",
3
- "version": "0.1.44",
3
+ "version": "0.1.45",
4
4
  "type": "module",
5
5
  "main": "./dist/index.esm.js",
6
6
  "module": "./dist/index.esm.js",
@@ -24,8 +24,8 @@
24
24
  "!**/*.js.map"
25
25
  ],
26
26
  "dependencies": {
27
- "@opencraw/core": "^0.1.40",
28
- "@opencraw/cli": "^0.1.44",
27
+ "@opencraw/core": "^0.1.41",
28
+ "@opencraw/cli": "^0.1.45",
29
29
  "@modelcontextprotocol/sdk": "^1.32.1",
30
30
  "playwright": "^1.63.0",
31
31
  "zod": "^4.6.5"