@fre4x/jupyter 1.0.50 → 1.0.53

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.js +282 -22
  2. package/package.json +2 -3
package/dist/index.js CHANGED
@@ -44463,6 +44463,250 @@ var ExperimentalMcpServerTasks = class {
44463
44463
  }
44464
44464
  };
44465
44465
 
44466
+ // ../node_modules/zod/index.js
44467
+ var zod_exports = {};
44468
+ __export(zod_exports, {
44469
+ $brand: () => $brand,
44470
+ $input: () => $input,
44471
+ $output: () => $output,
44472
+ NEVER: () => NEVER,
44473
+ TimePrecision: () => TimePrecision,
44474
+ ZodAny: () => ZodAny2,
44475
+ ZodArray: () => ZodArray2,
44476
+ ZodBase64: () => ZodBase64,
44477
+ ZodBase64URL: () => ZodBase64URL,
44478
+ ZodBigInt: () => ZodBigInt2,
44479
+ ZodBigIntFormat: () => ZodBigIntFormat,
44480
+ ZodBoolean: () => ZodBoolean2,
44481
+ ZodCIDRv4: () => ZodCIDRv4,
44482
+ ZodCIDRv6: () => ZodCIDRv6,
44483
+ ZodCUID: () => ZodCUID,
44484
+ ZodCUID2: () => ZodCUID2,
44485
+ ZodCatch: () => ZodCatch2,
44486
+ ZodCodec: () => ZodCodec,
44487
+ ZodCustom: () => ZodCustom,
44488
+ ZodCustomStringFormat: () => ZodCustomStringFormat,
44489
+ ZodDate: () => ZodDate2,
44490
+ ZodDefault: () => ZodDefault2,
44491
+ ZodDiscriminatedUnion: () => ZodDiscriminatedUnion2,
44492
+ ZodE164: () => ZodE164,
44493
+ ZodEmail: () => ZodEmail,
44494
+ ZodEmoji: () => ZodEmoji,
44495
+ ZodEnum: () => ZodEnum2,
44496
+ ZodError: () => ZodError2,
44497
+ ZodExactOptional: () => ZodExactOptional,
44498
+ ZodFile: () => ZodFile,
44499
+ ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind2,
44500
+ ZodFunction: () => ZodFunction2,
44501
+ ZodGUID: () => ZodGUID,
44502
+ ZodIPv4: () => ZodIPv4,
44503
+ ZodIPv6: () => ZodIPv6,
44504
+ ZodISODate: () => ZodISODate,
44505
+ ZodISODateTime: () => ZodISODateTime,
44506
+ ZodISODuration: () => ZodISODuration,
44507
+ ZodISOTime: () => ZodISOTime,
44508
+ ZodIntersection: () => ZodIntersection2,
44509
+ ZodIssueCode: () => ZodIssueCode2,
44510
+ ZodJWT: () => ZodJWT,
44511
+ ZodKSUID: () => ZodKSUID,
44512
+ ZodLazy: () => ZodLazy2,
44513
+ ZodLiteral: () => ZodLiteral2,
44514
+ ZodMAC: () => ZodMAC,
44515
+ ZodMap: () => ZodMap2,
44516
+ ZodNaN: () => ZodNaN2,
44517
+ ZodNanoID: () => ZodNanoID,
44518
+ ZodNever: () => ZodNever2,
44519
+ ZodNonOptional: () => ZodNonOptional,
44520
+ ZodNull: () => ZodNull2,
44521
+ ZodNullable: () => ZodNullable2,
44522
+ ZodNumber: () => ZodNumber2,
44523
+ ZodNumberFormat: () => ZodNumberFormat,
44524
+ ZodObject: () => ZodObject2,
44525
+ ZodOptional: () => ZodOptional2,
44526
+ ZodPipe: () => ZodPipe,
44527
+ ZodPrefault: () => ZodPrefault,
44528
+ ZodPromise: () => ZodPromise2,
44529
+ ZodReadonly: () => ZodReadonly2,
44530
+ ZodRealError: () => ZodRealError,
44531
+ ZodRecord: () => ZodRecord2,
44532
+ ZodSet: () => ZodSet2,
44533
+ ZodString: () => ZodString2,
44534
+ ZodStringFormat: () => ZodStringFormat,
44535
+ ZodSuccess: () => ZodSuccess,
44536
+ ZodSymbol: () => ZodSymbol2,
44537
+ ZodTemplateLiteral: () => ZodTemplateLiteral,
44538
+ ZodTransform: () => ZodTransform,
44539
+ ZodTuple: () => ZodTuple2,
44540
+ ZodType: () => ZodType2,
44541
+ ZodULID: () => ZodULID,
44542
+ ZodURL: () => ZodURL,
44543
+ ZodUUID: () => ZodUUID,
44544
+ ZodUndefined: () => ZodUndefined2,
44545
+ ZodUnion: () => ZodUnion2,
44546
+ ZodUnknown: () => ZodUnknown2,
44547
+ ZodVoid: () => ZodVoid2,
44548
+ ZodXID: () => ZodXID,
44549
+ ZodXor: () => ZodXor,
44550
+ _ZodString: () => _ZodString,
44551
+ _default: () => _default2,
44552
+ _function: () => _function,
44553
+ any: () => any,
44554
+ array: () => array,
44555
+ base64: () => base642,
44556
+ base64url: () => base64url2,
44557
+ bigint: () => bigint2,
44558
+ boolean: () => boolean2,
44559
+ catch: () => _catch2,
44560
+ check: () => check,
44561
+ cidrv4: () => cidrv42,
44562
+ cidrv6: () => cidrv62,
44563
+ clone: () => clone,
44564
+ codec: () => codec,
44565
+ coerce: () => coerce_exports2,
44566
+ config: () => config,
44567
+ core: () => core_exports2,
44568
+ cuid: () => cuid3,
44569
+ cuid2: () => cuid22,
44570
+ custom: () => custom,
44571
+ date: () => date3,
44572
+ decode: () => decode2,
44573
+ decodeAsync: () => decodeAsync2,
44574
+ default: () => zod_default,
44575
+ describe: () => describe2,
44576
+ discriminatedUnion: () => discriminatedUnion,
44577
+ e164: () => e1642,
44578
+ email: () => email2,
44579
+ emoji: () => emoji2,
44580
+ encode: () => encode2,
44581
+ encodeAsync: () => encodeAsync2,
44582
+ endsWith: () => _endsWith,
44583
+ enum: () => _enum2,
44584
+ exactOptional: () => exactOptional,
44585
+ file: () => file,
44586
+ flattenError: () => flattenError,
44587
+ float32: () => float32,
44588
+ float64: () => float64,
44589
+ formatError: () => formatError,
44590
+ fromJSONSchema: () => fromJSONSchema,
44591
+ function: () => _function,
44592
+ getErrorMap: () => getErrorMap2,
44593
+ globalRegistry: () => globalRegistry,
44594
+ gt: () => _gt,
44595
+ gte: () => _gte,
44596
+ guid: () => guid2,
44597
+ hash: () => hash,
44598
+ hex: () => hex2,
44599
+ hostname: () => hostname2,
44600
+ httpUrl: () => httpUrl,
44601
+ includes: () => _includes,
44602
+ instanceof: () => _instanceof,
44603
+ int: () => int,
44604
+ int32: () => int32,
44605
+ int64: () => int64,
44606
+ intersection: () => intersection,
44607
+ ipv4: () => ipv42,
44608
+ ipv6: () => ipv62,
44609
+ iso: () => iso_exports2,
44610
+ json: () => json,
44611
+ jwt: () => jwt,
44612
+ keyof: () => keyof,
44613
+ ksuid: () => ksuid2,
44614
+ lazy: () => lazy,
44615
+ length: () => _length,
44616
+ literal: () => literal,
44617
+ locales: () => locales_exports,
44618
+ looseObject: () => looseObject,
44619
+ looseRecord: () => looseRecord,
44620
+ lowercase: () => _lowercase,
44621
+ lt: () => _lt,
44622
+ lte: () => _lte,
44623
+ mac: () => mac2,
44624
+ map: () => map,
44625
+ maxLength: () => _maxLength,
44626
+ maxSize: () => _maxSize,
44627
+ meta: () => meta2,
44628
+ mime: () => _mime,
44629
+ minLength: () => _minLength,
44630
+ minSize: () => _minSize,
44631
+ multipleOf: () => _multipleOf,
44632
+ nan: () => nan,
44633
+ nanoid: () => nanoid2,
44634
+ nativeEnum: () => nativeEnum,
44635
+ negative: () => _negative,
44636
+ never: () => never,
44637
+ nonnegative: () => _nonnegative,
44638
+ nonoptional: () => nonoptional,
44639
+ nonpositive: () => _nonpositive,
44640
+ normalize: () => _normalize,
44641
+ null: () => _null3,
44642
+ nullable: () => nullable,
44643
+ nullish: () => nullish2,
44644
+ number: () => number2,
44645
+ object: () => object2,
44646
+ optional: () => optional,
44647
+ overwrite: () => _overwrite,
44648
+ parse: () => parse2,
44649
+ parseAsync: () => parseAsync2,
44650
+ partialRecord: () => partialRecord,
44651
+ pipe: () => pipe,
44652
+ positive: () => _positive,
44653
+ prefault: () => prefault,
44654
+ preprocess: () => preprocess,
44655
+ prettifyError: () => prettifyError,
44656
+ promise: () => promise,
44657
+ property: () => _property,
44658
+ readonly: () => readonly,
44659
+ record: () => record,
44660
+ refine: () => refine,
44661
+ regex: () => _regex,
44662
+ regexes: () => regexes_exports,
44663
+ registry: () => registry,
44664
+ safeDecode: () => safeDecode2,
44665
+ safeDecodeAsync: () => safeDecodeAsync2,
44666
+ safeEncode: () => safeEncode2,
44667
+ safeEncodeAsync: () => safeEncodeAsync2,
44668
+ safeParse: () => safeParse3,
44669
+ safeParseAsync: () => safeParseAsync3,
44670
+ set: () => set,
44671
+ setErrorMap: () => setErrorMap,
44672
+ size: () => _size,
44673
+ slugify: () => _slugify,
44674
+ startsWith: () => _startsWith,
44675
+ strictObject: () => strictObject,
44676
+ string: () => string2,
44677
+ stringFormat: () => stringFormat,
44678
+ stringbool: () => stringbool,
44679
+ success: () => success,
44680
+ superRefine: () => superRefine,
44681
+ symbol: () => symbol,
44682
+ templateLiteral: () => templateLiteral,
44683
+ toJSONSchema: () => toJSONSchema,
44684
+ toLowerCase: () => _toLowerCase,
44685
+ toUpperCase: () => _toUpperCase,
44686
+ transform: () => transform,
44687
+ treeifyError: () => treeifyError,
44688
+ trim: () => _trim,
44689
+ tuple: () => tuple,
44690
+ uint32: () => uint32,
44691
+ uint64: () => uint64,
44692
+ ulid: () => ulid2,
44693
+ undefined: () => _undefined3,
44694
+ union: () => union,
44695
+ unknown: () => unknown,
44696
+ uppercase: () => _uppercase,
44697
+ url: () => url,
44698
+ util: () => util_exports,
44699
+ uuid: () => uuid2,
44700
+ uuidv4: () => uuidv4,
44701
+ uuidv6: () => uuidv6,
44702
+ uuidv7: () => uuidv7,
44703
+ void: () => _void2,
44704
+ xid: () => xid2,
44705
+ xor: () => xor,
44706
+ z: () => external_exports3
44707
+ });
44708
+ var zod_default = external_exports3;
44709
+
44466
44710
  // ../node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
44467
44711
  var McpServer = class {
44468
44712
  constructor(serverInfo, options) {
@@ -45341,6 +45585,21 @@ var StdioServerTransport = class {
45341
45585
  }
45342
45586
  };
45343
45587
 
45588
+ // ../packages/shared/dist/pagination.js
45589
+ var z2 = external_exports3 || zod_default || zod_exports;
45590
+ var paginationSchema = z2.object({
45591
+ limit: z2.number().int().min(1).max(100).default(20).describe("Maximum results to return (1\u2013100, default 20)"),
45592
+ offset: z2.number().int().min(0).default(0).describe("Number of results to skip for pagination (default 0)")
45593
+ });
45594
+
45595
+ // ../packages/shared/dist/package.js
45596
+ import { createRequire as createJsonRequire } from "node:module";
45597
+ function getPackageVersion(moduleUrl) {
45598
+ const require2 = createJsonRequire(moduleUrl);
45599
+ const packageJson = require2("../package.json");
45600
+ return packageJson.version ?? "0.0.0";
45601
+ }
45602
+
45344
45603
  // src/types.ts
45345
45604
  var CellTypeSchema = external_exports3.enum(["code", "markdown"]);
45346
45605
  var NotebookCellSchema = external_exports3.object({
@@ -49844,7 +50103,7 @@ async function executeCode(code, requestedKernelId) {
49844
50103
  }
49845
50104
 
49846
50105
  // src/api.ts
49847
- function createApiError(message, statusCode) {
50106
+ function createApiError2(message, statusCode) {
49848
50107
  let hint = statusCode === 404 ? "The requested resource was not found." : "Check your inputs and retry.";
49849
50108
  if (message.includes("Unable to start a local Jupyter server")) {
49850
50109
  hint = "Jupyter is not installed or not in your PATH. Please install it (e.g., pip install jupyterlab).";
@@ -49866,7 +50125,7 @@ function createApiError(message, statusCode) {
49866
50125
  ]
49867
50126
  };
49868
50127
  }
49869
- function createNotFoundError(resource) {
50128
+ function createNotFoundError2(resource) {
49870
50129
  return {
49871
50130
  isError: true,
49872
50131
  content: [
@@ -49885,14 +50144,14 @@ function isCallToolResultError(value) {
49885
50144
  async function jupyter_get_notebook(req) {
49886
50145
  if (IS_MOCK) return MOCK_FIXTURES.get_notebook;
49887
50146
  if (!existsSync(req.path)) {
49888
- throw createNotFoundError(`Notebook not found at ${req.path}`);
50147
+ throw createNotFoundError2(`Notebook not found at ${req.path}`);
49889
50148
  }
49890
50149
  try {
49891
50150
  const content = await fs.readFile(req.path, "utf8");
49892
50151
  return JSON.parse(content);
49893
50152
  } catch (error48) {
49894
50153
  const err = error48;
49895
- throw createApiError(`Failed to read notebook: ${err.message}`, 500);
50154
+ throw createApiError2(`Failed to read notebook: ${err.message}`, 500);
49896
50155
  }
49897
50156
  }
49898
50157
  async function jupyter_create_notebook(req) {
@@ -49914,7 +50173,7 @@ async function jupyter_create_notebook(req) {
49914
50173
  return { success: true, path: req.path };
49915
50174
  } catch (error48) {
49916
50175
  const err = error48;
49917
- throw createApiError(`Failed to create notebook: ${err.message}`, 500);
50176
+ throw createApiError2(`Failed to create notebook: ${err.message}`, 500);
49918
50177
  }
49919
50178
  }
49920
50179
  async function jupyter_add_cell(req) {
@@ -49938,14 +50197,14 @@ async function jupyter_add_cell(req) {
49938
50197
  return { success: true };
49939
50198
  } catch (error48) {
49940
50199
  const err = error48;
49941
- throw createApiError(`Failed to update notebook: ${err.message}`, 500);
50200
+ throw createApiError2(`Failed to update notebook: ${err.message}`, 500);
49942
50201
  }
49943
50202
  }
49944
50203
  async function jupyter_update_cell(req) {
49945
50204
  if (IS_MOCK) return { success: true };
49946
50205
  const notebook = await jupyter_get_notebook({ path: req.path });
49947
50206
  if (req.index < 0 || req.index >= notebook.cells.length) {
49948
- throw createApiError(`Cell index ${req.index} out of bounds`, 400);
50207
+ throw createApiError2(`Cell index ${req.index} out of bounds`, 400);
49949
50208
  }
49950
50209
  notebook.cells[req.index].source = req.source.split("\n").map((line) => `${line}
49951
50210
  `);
@@ -49954,7 +50213,7 @@ async function jupyter_update_cell(req) {
49954
50213
  return { success: true };
49955
50214
  } catch (error48) {
49956
50215
  const err = error48;
49957
- throw createApiError(`Failed to update notebook: ${err.message}`, 500);
50216
+ throw createApiError2(`Failed to update notebook: ${err.message}`, 500);
49958
50217
  }
49959
50218
  }
49960
50219
  async function jupyter_execute_code(req) {
@@ -49963,7 +50222,7 @@ async function jupyter_execute_code(req) {
49963
50222
  return await executeCode(req.code, req.kernel_id);
49964
50223
  } catch (error48) {
49965
50224
  const err = error48;
49966
- throw createApiError(`Failed to execute code: ${err.message}`, 500);
50225
+ throw createApiError2(`Failed to execute code: ${err.message}`, 500);
49967
50226
  }
49968
50227
  }
49969
50228
  async function jupyter_list_kernels() {
@@ -49972,25 +50231,25 @@ async function jupyter_list_kernels() {
49972
50231
  return await listJupyterKernels();
49973
50232
  } catch (error48) {
49974
50233
  const err = error48;
49975
- throw createApiError(`Failed to list kernels: ${err.message}`, 500);
50234
+ throw createApiError2(`Failed to list kernels: ${err.message}`, 500);
49976
50235
  }
49977
50236
  }
49978
50237
  async function jupyter_open_notebook(req) {
49979
50238
  if (IS_MOCK) return { success: true };
49980
50239
  if (!existsSync(req.path)) {
49981
- throw createNotFoundError(`Notebook not found at ${req.path}`);
50240
+ throw createNotFoundError2(`Notebook not found at ${req.path}`);
49982
50241
  }
49983
50242
  try {
49984
50243
  await openJupyterInBrowser(req.path, req.url);
49985
50244
  return { success: true };
49986
50245
  } catch (error48) {
49987
50246
  const err = error48;
49988
- throw createApiError(`Failed to open notebook: ${err.message}`, 500);
50247
+ throw createApiError2(`Failed to open notebook: ${err.message}`, 500);
49989
50248
  }
49990
50249
  }
49991
50250
 
49992
50251
  // src/index.ts
49993
- function createInternalError(error48) {
50252
+ function createInternalError2(error48) {
49994
50253
  const message = error48 instanceof Error ? error48.message : String(error48);
49995
50254
  return {
49996
50255
  isError: true,
@@ -50004,9 +50263,10 @@ Suggestion: If the problem persists, check server logs.`
50004
50263
  ]
50005
50264
  };
50006
50265
  }
50266
+ var PACKAGE_VERSION = getPackageVersion(import.meta.url);
50007
50267
  var server = new McpServer({
50008
50268
  name: "@fre4x/jupyter",
50009
- version: "1.0.0"
50269
+ version: PACKAGE_VERSION
50010
50270
  });
50011
50271
  server.tool(
50012
50272
  "jupyter_get_notebook",
@@ -50024,7 +50284,7 @@ server.tool(
50024
50284
  if (isCallToolResultError(error48)) {
50025
50285
  return error48;
50026
50286
  }
50027
- return createInternalError(error48);
50287
+ return createInternalError2(error48);
50028
50288
  }
50029
50289
  }
50030
50290
  );
@@ -50047,7 +50307,7 @@ server.tool(
50047
50307
  if (isCallToolResultError(error48)) {
50048
50308
  return error48;
50049
50309
  }
50050
- return createInternalError(error48);
50310
+ return createInternalError2(error48);
50051
50311
  }
50052
50312
  }
50053
50313
  );
@@ -50065,7 +50325,7 @@ server.tool(
50065
50325
  if (isCallToolResultError(error48)) {
50066
50326
  return error48;
50067
50327
  }
50068
- return createInternalError(error48);
50328
+ return createInternalError2(error48);
50069
50329
  }
50070
50330
  }
50071
50331
  );
@@ -50083,7 +50343,7 @@ server.tool(
50083
50343
  if (isCallToolResultError(error48)) {
50084
50344
  return error48;
50085
50345
  }
50086
- return createInternalError(error48);
50346
+ return createInternalError2(error48);
50087
50347
  }
50088
50348
  }
50089
50349
  );
@@ -50103,7 +50363,7 @@ server.tool(
50103
50363
  if (isCallToolResultError(error48)) {
50104
50364
  return error48;
50105
50365
  }
50106
- return createInternalError(error48);
50366
+ return createInternalError2(error48);
50107
50367
  }
50108
50368
  }
50109
50369
  );
@@ -50123,7 +50383,7 @@ server.tool(
50123
50383
  if (isCallToolResultError(error48)) {
50124
50384
  return error48;
50125
50385
  }
50126
- return createInternalError(error48);
50386
+ return createInternalError2(error48);
50127
50387
  }
50128
50388
  }
50129
50389
  );
@@ -50143,7 +50403,7 @@ server.tool(
50143
50403
  if (isCallToolResultError(error48)) {
50144
50404
  return error48;
50145
50405
  }
50146
- return createInternalError(error48);
50406
+ return createInternalError2(error48);
50147
50407
  }
50148
50408
  }
50149
50409
  );
@@ -50169,7 +50429,7 @@ if (process.env.NODE_ENV !== "test") {
50169
50429
  });
50170
50430
  }
50171
50431
  export {
50172
- createInternalError,
50432
+ createInternalError2 as createInternalError,
50173
50433
  server
50174
50434
  };
50175
50435
  /*! Bundled license information:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fre4x/jupyter",
3
- "version": "1.0.50",
3
+ "version": "1.0.53",
4
4
  "description": "Jupyter Notebook MCP server",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -11,7 +11,7 @@
11
11
  ],
12
12
  "type": "module",
13
13
  "scripts": {
14
- "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && npx esbuild src/index.ts --bundle --outfile=dist/index.js --platform=node --format=esm --banner:js=\"import{createRequire}from'module';const require=createRequire(import.meta.url);\" && node -e \"const fs=require('fs');const p='dist/index.js';const c=fs.readFileSync(p,'utf8');const next=c.startsWith('#!/usr/bin/env node')?c:'#!/usr/bin/env node\\n'+c;fs.writeFileSync(p,next);fs.chmodSync(p,0o755);\"",
14
+ "build": "node ../scripts/build-package.mjs",
15
15
  "dev": "tsx src/index.ts",
16
16
  "typecheck": "cross-env NODE_OPTIONS=--max-old-space-size=4096 tsc --noEmit",
17
17
  "prepublishOnly": "npm run typecheck && npm run build",
@@ -22,7 +22,6 @@
22
22
  "devDependencies": {
23
23
  "@types/node": "^25.3.5",
24
24
  "@types/ws": "^8.18.1",
25
- "esbuild": "^0.27.3",
26
25
  "tsx": "^4.21.0",
27
26
  "typescript": "^5.9.3",
28
27
  "vitest": "^4.0.18"