@stigg/typescript-mcp 0.1.0-alpha.9 → 0.1.0-beta.2

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 (121) hide show
  1. package/code-tool-paths.cjs +8 -0
  2. package/code-tool-paths.cjs.map +1 -0
  3. package/code-tool-paths.d.cts +2 -0
  4. package/code-tool-paths.d.cts.map +1 -0
  5. package/code-tool-types.d.mts.map +1 -1
  6. package/code-tool-types.d.ts.map +1 -1
  7. package/code-tool-worker.d.mts +5 -0
  8. package/code-tool-worker.d.mts.map +1 -0
  9. package/code-tool-worker.d.ts +5 -0
  10. package/code-tool-worker.d.ts.map +1 -0
  11. package/code-tool-worker.js +357 -0
  12. package/code-tool-worker.js.map +1 -0
  13. package/code-tool-worker.mjs +319 -0
  14. package/code-tool-worker.mjs.map +1 -0
  15. package/code-tool.d.mts +8 -2
  16. package/code-tool.d.mts.map +1 -1
  17. package/code-tool.d.ts +8 -2
  18. package/code-tool.d.ts.map +1 -1
  19. package/code-tool.js +266 -37
  20. package/code-tool.js.map +1 -1
  21. package/code-tool.mjs +233 -37
  22. package/code-tool.mjs.map +1 -1
  23. package/docs-search-tool.d.mts +3 -1
  24. package/docs-search-tool.d.mts.map +1 -1
  25. package/docs-search-tool.d.ts +3 -1
  26. package/docs-search-tool.d.ts.map +1 -1
  27. package/docs-search-tool.js +53 -4
  28. package/docs-search-tool.js.map +1 -1
  29. package/docs-search-tool.mjs +52 -4
  30. package/docs-search-tool.mjs.map +1 -1
  31. package/http.d.mts +2 -4
  32. package/http.d.mts.map +1 -1
  33. package/http.d.ts +2 -4
  34. package/http.d.ts.map +1 -1
  35. package/http.js +123 -40
  36. package/http.js.map +1 -1
  37. package/http.mjs +123 -40
  38. package/http.mjs.map +1 -1
  39. package/index.js +13 -12
  40. package/index.js.map +1 -1
  41. package/index.mjs +13 -12
  42. package/index.mjs.map +1 -1
  43. package/instructions.d.mts +5 -0
  44. package/instructions.d.mts.map +1 -0
  45. package/instructions.d.ts +5 -0
  46. package/instructions.d.ts.map +1 -0
  47. package/instructions.js +61 -0
  48. package/instructions.js.map +1 -0
  49. package/instructions.mjs +55 -0
  50. package/instructions.mjs.map +1 -0
  51. package/local-docs-search.d.mts +28 -0
  52. package/local-docs-search.d.mts.map +1 -0
  53. package/local-docs-search.d.ts +28 -0
  54. package/local-docs-search.d.ts.map +1 -0
  55. package/local-docs-search.js +4774 -0
  56. package/local-docs-search.js.map +1 -0
  57. package/local-docs-search.mjs +4734 -0
  58. package/local-docs-search.mjs.map +1 -0
  59. package/logger.d.mts +7 -0
  60. package/logger.d.mts.map +1 -0
  61. package/logger.d.ts +7 -0
  62. package/logger.d.ts.map +1 -0
  63. package/logger.js +29 -0
  64. package/logger.js.map +1 -0
  65. package/logger.mjs +22 -0
  66. package/logger.mjs.map +1 -0
  67. package/methods.d.mts.map +1 -1
  68. package/methods.d.ts.map +1 -1
  69. package/methods.js +235 -43
  70. package/methods.js.map +1 -1
  71. package/methods.mjs +235 -43
  72. package/methods.mjs.map +1 -1
  73. package/options.d.mts +7 -0
  74. package/options.d.mts.map +1 -1
  75. package/options.d.ts +7 -0
  76. package/options.d.ts.map +1 -1
  77. package/options.js +42 -0
  78. package/options.js.map +1 -1
  79. package/options.mjs +42 -0
  80. package/options.mjs.map +1 -1
  81. package/package.json +58 -7
  82. package/server.d.mts +10 -1
  83. package/server.d.mts.map +1 -1
  84. package/server.d.ts +10 -1
  85. package/server.d.ts.map +1 -1
  86. package/server.js +72 -47
  87. package/server.js.map +1 -1
  88. package/server.mjs +72 -47
  89. package/server.mjs.map +1 -1
  90. package/src/code-tool-paths.cts +5 -0
  91. package/src/code-tool-types.ts +1 -0
  92. package/src/code-tool-worker.ts +370 -0
  93. package/src/code-tool.ts +302 -47
  94. package/src/docs-search-tool.ts +81 -11
  95. package/src/http.ts +131 -42
  96. package/src/index.ts +15 -13
  97. package/src/instructions.ts +83 -0
  98. package/src/local-docs-search.ts +5664 -0
  99. package/src/logger.ts +28 -0
  100. package/src/methods.ts +235 -43
  101. package/src/options.ts +56 -0
  102. package/src/server.ts +85 -58
  103. package/src/stdio.ts +6 -2
  104. package/src/types.ts +3 -0
  105. package/src/util.ts +2 -2
  106. package/stdio.d.mts.map +1 -1
  107. package/stdio.d.ts.map +1 -1
  108. package/stdio.js +6 -2
  109. package/stdio.js.map +1 -1
  110. package/stdio.mjs +6 -2
  111. package/stdio.mjs.map +1 -1
  112. package/types.d.mts +6 -0
  113. package/types.d.mts.map +1 -1
  114. package/types.d.ts +6 -0
  115. package/types.d.ts.map +1 -1
  116. package/types.js.map +1 -1
  117. package/types.mjs.map +1 -1
  118. package/util.js +2 -2
  119. package/util.js.map +1 -1
  120. package/util.mjs +2 -2
  121. package/util.mjs.map +1 -1
package/src/logger.ts ADDED
@@ -0,0 +1,28 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { pino, type Level, type Logger } from 'pino';
4
+ import pretty from 'pino-pretty';
5
+
6
+ let _logger: Logger | undefined;
7
+
8
+ export function configureLogger({ level, pretty: usePretty }: { level: Level; pretty: boolean }): void {
9
+ _logger = pino(
10
+ {
11
+ level,
12
+ timestamp: pino.stdTimeFunctions.isoTime,
13
+ formatters: {
14
+ level(label) {
15
+ return { level: label };
16
+ },
17
+ },
18
+ },
19
+ usePretty ? pretty({ colorize: true, levelFirst: true, destination: 2 }) : process.stderr,
20
+ );
21
+ }
22
+
23
+ export function getLogger(): Logger {
24
+ if (!_logger) {
25
+ throw new Error('Logger has not been configured. Call configureLogger() before using the logger.');
26
+ }
27
+ return _logger;
28
+ }
package/src/methods.ts CHANGED
@@ -34,6 +34,12 @@ export const sdkMethods: SdkMethod[] = [
34
34
  httpMethod: 'post',
35
35
  httpPath: '/api/v1/customers/{id}/archive',
36
36
  },
37
+ {
38
+ clientCallName: 'client.v1.customers.checkEntitlement',
39
+ fullyQualifiedName: 'v1.customers.checkEntitlement',
40
+ httpMethod: 'get',
41
+ httpPath: '/api/v1/customers/{id}/entitlements/check',
42
+ },
37
43
  {
38
44
  clientCallName: 'client.v1.customers.import',
39
45
  fullyQualifiedName: 'v1.customers.import',
@@ -52,6 +58,12 @@ export const sdkMethods: SdkMethod[] = [
52
58
  httpMethod: 'post',
53
59
  httpPath: '/api/v1/customers',
54
60
  },
61
+ {
62
+ clientCallName: 'client.v1.customers.retrieveEntitlements',
63
+ fullyQualifiedName: 'v1.customers.retrieveEntitlements',
64
+ httpMethod: 'get',
65
+ httpPath: '/api/v1/customers/{id}/entitlements',
66
+ },
55
67
  {
56
68
  clientCallName: 'client.v1.customers.unarchive',
57
69
  fullyQualifiedName: 'v1.customers.unarchive',
@@ -88,6 +100,36 @@ export const sdkMethods: SdkMethod[] = [
88
100
  httpMethod: 'delete',
89
101
  httpPath: '/api/v1/customers/{id}/promotional-entitlements/{featureId}',
90
102
  },
103
+ {
104
+ clientCallName: 'client.v1.customers.integrations.retrieve',
105
+ fullyQualifiedName: 'v1.customers.integrations.retrieve',
106
+ httpMethod: 'get',
107
+ httpPath: '/api/v1/customers/{id}/integrations/{integrationId}',
108
+ },
109
+ {
110
+ clientCallName: 'client.v1.customers.integrations.update',
111
+ fullyQualifiedName: 'v1.customers.integrations.update',
112
+ httpMethod: 'patch',
113
+ httpPath: '/api/v1/customers/{id}/integrations/{integrationId}',
114
+ },
115
+ {
116
+ clientCallName: 'client.v1.customers.integrations.list',
117
+ fullyQualifiedName: 'v1.customers.integrations.list',
118
+ httpMethod: 'get',
119
+ httpPath: '/api/v1/customers/{id}/integrations',
120
+ },
121
+ {
122
+ clientCallName: 'client.v1.customers.integrations.link',
123
+ fullyQualifiedName: 'v1.customers.integrations.link',
124
+ httpMethod: 'post',
125
+ httpPath: '/api/v1/customers/{id}/integrations',
126
+ },
127
+ {
128
+ clientCallName: 'client.v1.customers.integrations.unlink',
129
+ fullyQualifiedName: 'v1.customers.integrations.unlink',
130
+ httpMethod: 'delete',
131
+ httpPath: '/api/v1/customers/{id}/integrations/{integrationId}',
132
+ },
91
133
  {
92
134
  clientCallName: 'client.v1.subscriptions.retrieve',
93
135
  fullyQualifiedName: 'v1.subscriptions.retrieve',
@@ -215,107 +257,257 @@ export const sdkMethods: SdkMethod[] = [
215
257
  httpPath: '/api/v1/events',
216
258
  },
217
259
  {
218
- clientCallName: 'client.v1.events.features.archiveFeature',
219
- fullyQualifiedName: 'v1.events.features.archiveFeature',
260
+ clientCallName: 'client.v1.credits.getUsage',
261
+ fullyQualifiedName: 'v1.credits.getUsage',
262
+ httpMethod: 'get',
263
+ httpPath: '/api/v1/credits/usage',
264
+ },
265
+ {
266
+ clientCallName: 'client.v1.credits.listLedger',
267
+ fullyQualifiedName: 'v1.credits.listLedger',
268
+ httpMethod: 'get',
269
+ httpPath: '/api/v1/credits/ledger',
270
+ },
271
+ {
272
+ clientCallName: 'client.v1.credits.grants.create',
273
+ fullyQualifiedName: 'v1.credits.grants.create',
274
+ httpMethod: 'post',
275
+ httpPath: '/api/v1/credits/grants',
276
+ },
277
+ {
278
+ clientCallName: 'client.v1.credits.grants.list',
279
+ fullyQualifiedName: 'v1.credits.grants.list',
280
+ httpMethod: 'get',
281
+ httpPath: '/api/v1/credits/grants',
282
+ },
283
+ {
284
+ clientCallName: 'client.v1.credits.grants.void',
285
+ fullyQualifiedName: 'v1.credits.grants.void',
286
+ httpMethod: 'post',
287
+ httpPath: '/api/v1/credits/grants/{id}/void',
288
+ },
289
+ {
290
+ clientCallName: 'client.v1.credits.customCurrencies.create',
291
+ fullyQualifiedName: 'v1.credits.customCurrencies.create',
292
+ httpMethod: 'post',
293
+ httpPath: '/api/v1/credits/custom-currencies',
294
+ },
295
+ {
296
+ clientCallName: 'client.v1.credits.customCurrencies.update',
297
+ fullyQualifiedName: 'v1.credits.customCurrencies.update',
298
+ httpMethod: 'patch',
299
+ httpPath: '/api/v1/credits/custom-currencies/{currencyId}',
300
+ },
301
+ {
302
+ clientCallName: 'client.v1.credits.customCurrencies.list',
303
+ fullyQualifiedName: 'v1.credits.customCurrencies.list',
304
+ httpMethod: 'get',
305
+ httpPath: '/api/v1/credits/custom-currencies',
306
+ },
307
+ {
308
+ clientCallName: 'client.v1.credits.customCurrencies.archive',
309
+ fullyQualifiedName: 'v1.credits.customCurrencies.archive',
310
+ httpMethod: 'post',
311
+ httpPath: '/api/v1/credits/custom-currencies/{currencyId}/archive',
312
+ },
313
+ {
314
+ clientCallName: 'client.v1.credits.customCurrencies.listAssociatedEntities',
315
+ fullyQualifiedName: 'v1.credits.customCurrencies.listAssociatedEntities',
316
+ httpMethod: 'get',
317
+ httpPath: '/api/v1/credits/custom-currencies/{currencyId}/associated-entities',
318
+ },
319
+ {
320
+ clientCallName: 'client.v1.credits.customCurrencies.unarchive',
321
+ fullyQualifiedName: 'v1.credits.customCurrencies.unarchive',
322
+ httpMethod: 'post',
323
+ httpPath: '/api/v1/credits/custom-currencies/{currencyId}/unarchive',
324
+ },
325
+ {
326
+ clientCallName: 'client.v1.credits.autoRecharge.getAutoRecharge',
327
+ fullyQualifiedName: 'v1.credits.autoRecharge.getAutoRecharge',
328
+ httpMethod: 'get',
329
+ httpPath: '/api/v1/credits/auto-recharge',
330
+ },
331
+ {
332
+ clientCallName: 'client.v1.features.archiveFeature',
333
+ fullyQualifiedName: 'v1.features.archiveFeature',
220
334
  httpMethod: 'post',
221
335
  httpPath: '/api/v1/features/{id}/archive',
222
336
  },
223
337
  {
224
- clientCallName: 'client.v1.events.features.createFeature',
225
- fullyQualifiedName: 'v1.events.features.createFeature',
338
+ clientCallName: 'client.v1.features.createFeature',
339
+ fullyQualifiedName: 'v1.features.createFeature',
226
340
  httpMethod: 'post',
227
341
  httpPath: '/api/v1/features',
228
342
  },
229
343
  {
230
- clientCallName: 'client.v1.events.features.listFeatures',
231
- fullyQualifiedName: 'v1.events.features.listFeatures',
344
+ clientCallName: 'client.v1.features.listFeatures',
345
+ fullyQualifiedName: 'v1.features.listFeatures',
232
346
  httpMethod: 'get',
233
347
  httpPath: '/api/v1/features',
234
348
  },
235
349
  {
236
- clientCallName: 'client.v1.events.features.retrieveFeature',
237
- fullyQualifiedName: 'v1.events.features.retrieveFeature',
350
+ clientCallName: 'client.v1.features.retrieveFeature',
351
+ fullyQualifiedName: 'v1.features.retrieveFeature',
238
352
  httpMethod: 'get',
239
353
  httpPath: '/api/v1/features/{id}',
240
354
  },
241
355
  {
242
- clientCallName: 'client.v1.events.features.unarchiveFeature',
243
- fullyQualifiedName: 'v1.events.features.unarchiveFeature',
356
+ clientCallName: 'client.v1.features.unarchiveFeature',
357
+ fullyQualifiedName: 'v1.features.unarchiveFeature',
244
358
  httpMethod: 'post',
245
359
  httpPath: '/api/v1/features/{id}/unarchive',
246
360
  },
247
361
  {
248
- clientCallName: 'client.v1.events.features.updateFeature',
249
- fullyQualifiedName: 'v1.events.features.updateFeature',
362
+ clientCallName: 'client.v1.features.updateFeature',
363
+ fullyQualifiedName: 'v1.features.updateFeature',
250
364
  httpMethod: 'patch',
251
365
  httpPath: '/api/v1/features/{id}',
252
366
  },
253
367
  {
254
- clientCallName: 'client.v1.events.addons.archiveAddon',
255
- fullyQualifiedName: 'v1.events.addons.archiveAddon',
368
+ clientCallName: 'client.v1.addons.create',
369
+ fullyQualifiedName: 'v1.addons.create',
256
370
  httpMethod: 'post',
257
- httpPath: '/api/v1/addons/{id}/archive',
371
+ httpPath: '/api/v1/addons',
258
372
  },
259
373
  {
260
- clientCallName: 'client.v1.events.addons.createAddon',
261
- fullyQualifiedName: 'v1.events.addons.createAddon',
262
- httpMethod: 'post',
263
- httpPath: '/api/v1/addons',
374
+ clientCallName: 'client.v1.addons.retrieve',
375
+ fullyQualifiedName: 'v1.addons.retrieve',
376
+ httpMethod: 'get',
377
+ httpPath: '/api/v1/addons/{id}',
264
378
  },
265
379
  {
266
- clientCallName: 'client.v1.events.addons.listAddons',
267
- fullyQualifiedName: 'v1.events.addons.listAddons',
380
+ clientCallName: 'client.v1.addons.update',
381
+ fullyQualifiedName: 'v1.addons.update',
382
+ httpMethod: 'patch',
383
+ httpPath: '/api/v1/addons/{id}',
384
+ },
385
+ {
386
+ clientCallName: 'client.v1.addons.list',
387
+ fullyQualifiedName: 'v1.addons.list',
268
388
  httpMethod: 'get',
269
389
  httpPath: '/api/v1/addons',
270
390
  },
271
391
  {
272
- clientCallName: 'client.v1.events.addons.publishAddon',
273
- fullyQualifiedName: 'v1.events.addons.publishAddon',
392
+ clientCallName: 'client.v1.addons.archive',
393
+ fullyQualifiedName: 'v1.addons.archive',
394
+ httpMethod: 'post',
395
+ httpPath: '/api/v1/addons/{id}/archive',
396
+ },
397
+ {
398
+ clientCallName: 'client.v1.addons.createDraft',
399
+ fullyQualifiedName: 'v1.addons.createDraft',
400
+ httpMethod: 'post',
401
+ httpPath: '/api/v1/addons/{id}/draft',
402
+ },
403
+ {
404
+ clientCallName: 'client.v1.addons.publish',
405
+ fullyQualifiedName: 'v1.addons.publish',
274
406
  httpMethod: 'post',
275
407
  httpPath: '/api/v1/addons/{id}/publish',
276
408
  },
277
409
  {
278
- clientCallName: 'client.v1.events.addons.retrieveAddon',
279
- fullyQualifiedName: 'v1.events.addons.retrieveAddon',
280
- httpMethod: 'get',
281
- httpPath: '/api/v1/addons/{id}',
410
+ clientCallName: 'client.v1.addons.removeDraft',
411
+ fullyQualifiedName: 'v1.addons.removeDraft',
412
+ httpMethod: 'delete',
413
+ httpPath: '/api/v1/addons/{id}/draft',
414
+ },
415
+ {
416
+ clientCallName: 'client.v1.addons.entitlements.create',
417
+ fullyQualifiedName: 'v1.addons.entitlements.create',
418
+ httpMethod: 'post',
419
+ httpPath: '/api/v1/addons/{addonId}/entitlements',
282
420
  },
283
421
  {
284
- clientCallName: 'client.v1.events.addons.updateAddon',
285
- fullyQualifiedName: 'v1.events.addons.updateAddon',
422
+ clientCallName: 'client.v1.addons.entitlements.update',
423
+ fullyQualifiedName: 'v1.addons.entitlements.update',
286
424
  httpMethod: 'patch',
287
- httpPath: '/api/v1/addons/{id}',
425
+ httpPath: '/api/v1/addons/{addonId}/entitlements/{id}',
288
426
  },
289
427
  {
290
- clientCallName: 'client.v1.events.addons.draft.createAddonDraft',
291
- fullyQualifiedName: 'v1.events.addons.draft.createAddonDraft',
292
- httpMethod: 'post',
293
- httpPath: '/api/v1/addons/{id}/draft',
428
+ clientCallName: 'client.v1.addons.entitlements.list',
429
+ fullyQualifiedName: 'v1.addons.entitlements.list',
430
+ httpMethod: 'get',
431
+ httpPath: '/api/v1/addons/{addonId}/entitlements',
294
432
  },
295
433
  {
296
- clientCallName: 'client.v1.events.addons.draft.removeAddonDraft',
297
- fullyQualifiedName: 'v1.events.addons.draft.removeAddonDraft',
434
+ clientCallName: 'client.v1.addons.entitlements.delete',
435
+ fullyQualifiedName: 'v1.addons.entitlements.delete',
298
436
  httpMethod: 'delete',
299
- httpPath: '/api/v1/addons/{id}/draft',
437
+ httpPath: '/api/v1/addons/{addonId}/entitlements/{id}',
300
438
  },
301
439
  {
302
- clientCallName: 'client.v1.events.plans.create',
303
- fullyQualifiedName: 'v1.events.plans.create',
440
+ clientCallName: 'client.v1.plans.create',
441
+ fullyQualifiedName: 'v1.plans.create',
304
442
  httpMethod: 'post',
305
443
  httpPath: '/api/v1/plans',
306
444
  },
307
445
  {
308
- clientCallName: 'client.v1.events.plans.retrieve',
309
- fullyQualifiedName: 'v1.events.plans.retrieve',
446
+ clientCallName: 'client.v1.plans.retrieve',
447
+ fullyQualifiedName: 'v1.plans.retrieve',
310
448
  httpMethod: 'get',
311
449
  httpPath: '/api/v1/plans/{id}',
312
450
  },
313
451
  {
314
- clientCallName: 'client.v1.events.plans.list',
315
- fullyQualifiedName: 'v1.events.plans.list',
452
+ clientCallName: 'client.v1.plans.update',
453
+ fullyQualifiedName: 'v1.plans.update',
454
+ httpMethod: 'patch',
455
+ httpPath: '/api/v1/plans/{id}',
456
+ },
457
+ {
458
+ clientCallName: 'client.v1.plans.list',
459
+ fullyQualifiedName: 'v1.plans.list',
316
460
  httpMethod: 'get',
317
461
  httpPath: '/api/v1/plans',
318
462
  },
463
+ {
464
+ clientCallName: 'client.v1.plans.archive',
465
+ fullyQualifiedName: 'v1.plans.archive',
466
+ httpMethod: 'post',
467
+ httpPath: '/api/v1/plans/{id}/archive',
468
+ },
469
+ {
470
+ clientCallName: 'client.v1.plans.createDraft',
471
+ fullyQualifiedName: 'v1.plans.createDraft',
472
+ httpMethod: 'post',
473
+ httpPath: '/api/v1/plans/{id}/draft',
474
+ },
475
+ {
476
+ clientCallName: 'client.v1.plans.publish',
477
+ fullyQualifiedName: 'v1.plans.publish',
478
+ httpMethod: 'post',
479
+ httpPath: '/api/v1/plans/{id}/publish',
480
+ },
481
+ {
482
+ clientCallName: 'client.v1.plans.removeDraft',
483
+ fullyQualifiedName: 'v1.plans.removeDraft',
484
+ httpMethod: 'delete',
485
+ httpPath: '/api/v1/plans/{id}/draft',
486
+ },
487
+ {
488
+ clientCallName: 'client.v1.plans.entitlements.create',
489
+ fullyQualifiedName: 'v1.plans.entitlements.create',
490
+ httpMethod: 'post',
491
+ httpPath: '/api/v1/plans/{planId}/entitlements',
492
+ },
493
+ {
494
+ clientCallName: 'client.v1.plans.entitlements.update',
495
+ fullyQualifiedName: 'v1.plans.entitlements.update',
496
+ httpMethod: 'patch',
497
+ httpPath: '/api/v1/plans/{planId}/entitlements/{id}',
498
+ },
499
+ {
500
+ clientCallName: 'client.v1.plans.entitlements.list',
501
+ fullyQualifiedName: 'v1.plans.entitlements.list',
502
+ httpMethod: 'get',
503
+ httpPath: '/api/v1/plans/{planId}/entitlements',
504
+ },
505
+ {
506
+ clientCallName: 'client.v1.plans.entitlements.delete',
507
+ fullyQualifiedName: 'v1.plans.entitlements.delete',
508
+ httpMethod: 'delete',
509
+ httpPath: '/api/v1/plans/{planId}/entitlements/{id}',
510
+ },
319
511
  {
320
512
  clientCallName: 'client.v1.usage.history',
321
513
  fullyQualifiedName: 'v1.usage.history',
package/src/options.ts CHANGED
@@ -8,19 +8,27 @@ import { readEnv } from './util';
8
8
 
9
9
  export type CLIOptions = McpOptions & {
10
10
  debug: boolean;
11
+ logFormat: 'json' | 'pretty';
11
12
  transport: 'stdio' | 'http';
12
13
  port: number | undefined;
13
14
  socket: string | undefined;
14
15
  };
15
16
 
16
17
  export type McpOptions = {
18
+ includeCodeTool?: boolean | undefined;
17
19
  includeDocsTools?: boolean | undefined;
18
20
  stainlessApiKey?: string | undefined;
21
+ docsSearchMode?: 'stainless-api' | 'local' | undefined;
22
+ docsDir?: string | undefined;
19
23
  codeAllowHttpGets?: boolean | undefined;
20
24
  codeAllowedMethods?: string[] | undefined;
21
25
  codeBlockedMethods?: string[] | undefined;
26
+ codeExecutionMode: McpCodeExecutionMode;
27
+ customInstructionsPath?: string | undefined;
22
28
  };
23
29
 
30
+ export type McpCodeExecutionMode = 'stainless-sandbox' | 'local';
31
+
24
32
  export function parseCLIOptions(): CLIOptions {
25
33
  const opts = yargs(hideBin(process.argv))
26
34
  .option('code-allow-http-gets', {
@@ -40,7 +48,35 @@ export function parseCLIOptions(): CLIOptions {
40
48
  description:
41
49
  'Methods to explicitly block for code tool. Evaluated as regular expressions against method fully qualified names. If all code-allow-* flags are unset, then everything is allowed.',
42
50
  })
51
+ .option('code-execution-mode', {
52
+ type: 'string',
53
+ choices: ['stainless-sandbox', 'local'],
54
+ default: 'stainless-sandbox',
55
+ description:
56
+ "Where to run code execution in code tool; 'stainless-sandbox' will execute code in Stainless-hosted sandboxes whereas 'local' will execute code locally on the MCP server machine.",
57
+ })
58
+ .option('custom-instructions-path', {
59
+ type: 'string',
60
+ description: 'Path to custom instructions for the MCP server',
61
+ })
43
62
  .option('debug', { type: 'boolean', description: 'Enable debug logging' })
63
+ .option('docs-dir', {
64
+ type: 'string',
65
+ description:
66
+ 'Path to a directory of local documentation files (markdown/JSON) to include in local docs search.',
67
+ })
68
+ .option('docs-search-mode', {
69
+ type: 'string',
70
+ choices: ['stainless-api', 'local'],
71
+ default: 'stainless-api',
72
+ description:
73
+ "Where to search documentation; 'stainless-api' uses the Stainless-hosted search API whereas 'local' uses an in-memory search index built from embedded SDK method data and optional local docs files.",
74
+ })
75
+ .option('log-format', {
76
+ type: 'string',
77
+ choices: ['json', 'pretty'],
78
+ description: 'Format for log output; defaults to json unless tty is detected',
79
+ })
44
80
  .option('no-tools', {
45
81
  type: 'string',
46
82
  array: true,
@@ -82,18 +118,29 @@ export function parseCLIOptions(): CLIOptions {
82
118
  : argv.tools?.includes(toolType) ? true
83
119
  : undefined;
84
120
 
121
+ const includeCodeTool = shouldIncludeToolType('code');
85
122
  const includeDocsTools = shouldIncludeToolType('docs');
86
123
 
87
124
  const transport = argv.transport as 'stdio' | 'http';
125
+ const logFormat =
126
+ argv.logFormat ? (argv.logFormat as 'json' | 'pretty')
127
+ : process.stderr.isTTY ? 'pretty'
128
+ : 'json';
88
129
 
89
130
  return {
131
+ ...(includeCodeTool !== undefined && { includeCodeTool }),
90
132
  ...(includeDocsTools !== undefined && { includeDocsTools }),
91
133
  debug: !!argv.debug,
92
134
  stainlessApiKey: argv.stainlessApiKey,
135
+ docsSearchMode: argv.docsSearchMode as 'stainless-api' | 'local' | undefined,
136
+ docsDir: argv.docsDir,
93
137
  codeAllowHttpGets: argv.codeAllowHttpGets,
94
138
  codeAllowedMethods: argv.codeAllowedMethods,
95
139
  codeBlockedMethods: argv.codeBlockedMethods,
140
+ codeExecutionMode: argv.codeExecutionMode as McpCodeExecutionMode,
141
+ customInstructionsPath: argv.customInstructionsPath,
96
142
  transport,
143
+ logFormat,
97
144
  port: argv.port,
98
145
  socket: argv.socket,
99
146
  };
@@ -118,12 +165,21 @@ export function parseQueryOptions(defaultOptions: McpOptions, query: unknown): M
118
165
  const queryObject = typeof query === 'string' ? qs.parse(query) : query;
119
166
  const queryOptions = QueryOptions.parse(queryObject);
120
167
 
168
+ let codeTool: boolean | undefined =
169
+ queryOptions.no_tools && queryOptions.no_tools?.includes('code') ? false
170
+ : queryOptions.tools?.includes('code') ? true
171
+ : defaultOptions.includeCodeTool;
172
+
121
173
  let docsTools: boolean | undefined =
122
174
  queryOptions.no_tools && queryOptions.no_tools?.includes('docs') ? false
123
175
  : queryOptions.tools?.includes('docs') ? true
124
176
  : defaultOptions.includeDocsTools;
125
177
 
126
178
  return {
179
+ ...(codeTool !== undefined && { includeCodeTool: codeTool }),
127
180
  ...(docsTools !== undefined && { includeDocsTools: docsTools }),
181
+ codeExecutionMode: defaultOptions.codeExecutionMode,
182
+ docsSearchMode: defaultOptions.docsSearchMode,
183
+ docsDir: defaultOptions.docsDir,
128
184
  };
129
185
  }