@stigg/typescript-mcp 0.1.0-alpha.10 → 0.1.0-alpha.12

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.
@@ -138,23 +138,38 @@ const fuse = new Fuse(
138
138
  'client.v1.coupons.retrieve',
139
139
  'client.v1.coupons.updateCoupon',
140
140
  'client.v1.events.report',
141
- 'client.v1.events.features.archiveFeature',
142
- 'client.v1.events.features.createFeature',
143
- 'client.v1.events.features.listFeatures',
144
- 'client.v1.events.features.retrieveFeature',
145
- 'client.v1.events.features.unarchiveFeature',
146
- 'client.v1.events.features.updateFeature',
147
- 'client.v1.events.addons.archiveAddon',
148
- 'client.v1.events.addons.createAddon',
149
- 'client.v1.events.addons.listAddons',
150
- 'client.v1.events.addons.publishAddon',
151
- 'client.v1.events.addons.retrieveAddon',
152
- 'client.v1.events.addons.updateAddon',
153
- 'client.v1.events.addons.draft.createAddonDraft',
154
- 'client.v1.events.addons.draft.removeAddonDraft',
155
- 'client.v1.events.plans.create',
156
- 'client.v1.events.plans.list',
157
- 'client.v1.events.plans.retrieve',
141
+ 'client.v1.features.archiveFeature',
142
+ 'client.v1.features.createFeature',
143
+ 'client.v1.features.listFeatures',
144
+ 'client.v1.features.retrieveFeature',
145
+ 'client.v1.features.unarchiveFeature',
146
+ 'client.v1.features.updateFeature',
147
+ 'client.v1.addons.archive',
148
+ 'client.v1.addons.create',
149
+ 'client.v1.addons.createDraft',
150
+ 'client.v1.addons.list',
151
+ 'client.v1.addons.publish',
152
+ 'client.v1.addons.removeDraft',
153
+ 'client.v1.addons.retrieve',
154
+ 'client.v1.addons.setPricing',
155
+ 'client.v1.addons.update',
156
+ 'client.v1.addons.entitlements.create',
157
+ 'client.v1.addons.entitlements.delete',
158
+ 'client.v1.addons.entitlements.list',
159
+ 'client.v1.addons.entitlements.update',
160
+ 'client.v1.plans.archive',
161
+ 'client.v1.plans.create',
162
+ 'client.v1.plans.createDraft',
163
+ 'client.v1.plans.list',
164
+ 'client.v1.plans.publish',
165
+ 'client.v1.plans.removeDraft',
166
+ 'client.v1.plans.retrieve',
167
+ 'client.v1.plans.setPricing',
168
+ 'client.v1.plans.update',
169
+ 'client.v1.plans.entitlements.create',
170
+ 'client.v1.plans.entitlements.delete',
171
+ 'client.v1.plans.entitlements.list',
172
+ 'client.v1.plans.entitlements.update',
158
173
  'client.v1.usage.history',
159
174
  'client.v1.usage.report',
160
175
  'client.v1.products.archiveProduct',
package/src/code-tool.ts CHANGED
@@ -23,7 +23,7 @@ import { ClientOptions } from '@stigg/typescript';
23
23
 
24
24
  const prompt = `Runs JavaScript code to interact with the Stigg API.
25
25
 
26
- You are a skilled programmer writing code to interface with the service.
26
+ You are a skilled TypeScript programmer writing code to interface with the service.
27
27
  Define an async function named "run" that takes a single parameter of an initialized SDK client and it will be run.
28
28
  For example:
29
29
 
@@ -39,7 +39,9 @@ You will be returned anything that your function returns, plus the results of an
39
39
  Do not add try-catch blocks for single API calls. The tool will handle errors for you.
40
40
  Do not add comments unless necessary for generating better code.
41
41
  Code will run in a container, and cannot interact with the network outside of the given SDK client.
42
- Variables will not persist between calls, so make sure to return or log any data you might need later.`;
42
+ Variables will not persist between calls, so make sure to return or log any data you might need later.
43
+ Remember that you are writing TypeScript code, so you need to be careful with your types.
44
+ Always type dynamic key-value stores explicitly as Record<string, YourValueType> instead of {}.`;
43
45
 
44
46
  /**
45
47
  * A tool that runs code against a copy of the SDK.
package/src/methods.ts CHANGED
@@ -215,107 +215,197 @@ export const sdkMethods: SdkMethod[] = [
215
215
  httpPath: '/api/v1/events',
216
216
  },
217
217
  {
218
- clientCallName: 'client.v1.events.features.archiveFeature',
219
- fullyQualifiedName: 'v1.events.features.archiveFeature',
218
+ clientCallName: 'client.v1.features.archiveFeature',
219
+ fullyQualifiedName: 'v1.features.archiveFeature',
220
220
  httpMethod: 'post',
221
221
  httpPath: '/api/v1/features/{id}/archive',
222
222
  },
223
223
  {
224
- clientCallName: 'client.v1.events.features.createFeature',
225
- fullyQualifiedName: 'v1.events.features.createFeature',
224
+ clientCallName: 'client.v1.features.createFeature',
225
+ fullyQualifiedName: 'v1.features.createFeature',
226
226
  httpMethod: 'post',
227
227
  httpPath: '/api/v1/features',
228
228
  },
229
229
  {
230
- clientCallName: 'client.v1.events.features.listFeatures',
231
- fullyQualifiedName: 'v1.events.features.listFeatures',
230
+ clientCallName: 'client.v1.features.listFeatures',
231
+ fullyQualifiedName: 'v1.features.listFeatures',
232
232
  httpMethod: 'get',
233
233
  httpPath: '/api/v1/features',
234
234
  },
235
235
  {
236
- clientCallName: 'client.v1.events.features.retrieveFeature',
237
- fullyQualifiedName: 'v1.events.features.retrieveFeature',
236
+ clientCallName: 'client.v1.features.retrieveFeature',
237
+ fullyQualifiedName: 'v1.features.retrieveFeature',
238
238
  httpMethod: 'get',
239
239
  httpPath: '/api/v1/features/{id}',
240
240
  },
241
241
  {
242
- clientCallName: 'client.v1.events.features.unarchiveFeature',
243
- fullyQualifiedName: 'v1.events.features.unarchiveFeature',
242
+ clientCallName: 'client.v1.features.unarchiveFeature',
243
+ fullyQualifiedName: 'v1.features.unarchiveFeature',
244
244
  httpMethod: 'post',
245
245
  httpPath: '/api/v1/features/{id}/unarchive',
246
246
  },
247
247
  {
248
- clientCallName: 'client.v1.events.features.updateFeature',
249
- fullyQualifiedName: 'v1.events.features.updateFeature',
248
+ clientCallName: 'client.v1.features.updateFeature',
249
+ fullyQualifiedName: 'v1.features.updateFeature',
250
250
  httpMethod: 'patch',
251
251
  httpPath: '/api/v1/features/{id}',
252
252
  },
253
253
  {
254
- clientCallName: 'client.v1.events.addons.archiveAddon',
255
- fullyQualifiedName: 'v1.events.addons.archiveAddon',
254
+ clientCallName: 'client.v1.addons.create',
255
+ fullyQualifiedName: 'v1.addons.create',
256
256
  httpMethod: 'post',
257
- httpPath: '/api/v1/addons/{id}/archive',
257
+ httpPath: '/api/v1/addons',
258
258
  },
259
259
  {
260
- clientCallName: 'client.v1.events.addons.createAddon',
261
- fullyQualifiedName: 'v1.events.addons.createAddon',
262
- httpMethod: 'post',
263
- httpPath: '/api/v1/addons',
260
+ clientCallName: 'client.v1.addons.retrieve',
261
+ fullyQualifiedName: 'v1.addons.retrieve',
262
+ httpMethod: 'get',
263
+ httpPath: '/api/v1/addons/{id}',
264
+ },
265
+ {
266
+ clientCallName: 'client.v1.addons.update',
267
+ fullyQualifiedName: 'v1.addons.update',
268
+ httpMethod: 'patch',
269
+ httpPath: '/api/v1/addons/{id}',
264
270
  },
265
271
  {
266
- clientCallName: 'client.v1.events.addons.listAddons',
267
- fullyQualifiedName: 'v1.events.addons.listAddons',
272
+ clientCallName: 'client.v1.addons.list',
273
+ fullyQualifiedName: 'v1.addons.list',
268
274
  httpMethod: 'get',
269
275
  httpPath: '/api/v1/addons',
270
276
  },
271
277
  {
272
- clientCallName: 'client.v1.events.addons.publishAddon',
273
- fullyQualifiedName: 'v1.events.addons.publishAddon',
278
+ clientCallName: 'client.v1.addons.archive',
279
+ fullyQualifiedName: 'v1.addons.archive',
280
+ httpMethod: 'post',
281
+ httpPath: '/api/v1/addons/{id}/archive',
282
+ },
283
+ {
284
+ clientCallName: 'client.v1.addons.createDraft',
285
+ fullyQualifiedName: 'v1.addons.createDraft',
286
+ httpMethod: 'post',
287
+ httpPath: '/api/v1/addons/{id}/draft',
288
+ },
289
+ {
290
+ clientCallName: 'client.v1.addons.publish',
291
+ fullyQualifiedName: 'v1.addons.publish',
274
292
  httpMethod: 'post',
275
293
  httpPath: '/api/v1/addons/{id}/publish',
276
294
  },
277
295
  {
278
- clientCallName: 'client.v1.events.addons.retrieveAddon',
279
- fullyQualifiedName: 'v1.events.addons.retrieveAddon',
280
- httpMethod: 'get',
281
- httpPath: '/api/v1/addons/{id}',
296
+ clientCallName: 'client.v1.addons.removeDraft',
297
+ fullyQualifiedName: 'v1.addons.removeDraft',
298
+ httpMethod: 'delete',
299
+ httpPath: '/api/v1/addons/{id}/draft',
282
300
  },
283
301
  {
284
- clientCallName: 'client.v1.events.addons.updateAddon',
285
- fullyQualifiedName: 'v1.events.addons.updateAddon',
286
- httpMethod: 'patch',
287
- httpPath: '/api/v1/addons/{id}',
302
+ clientCallName: 'client.v1.addons.setPricing',
303
+ fullyQualifiedName: 'v1.addons.setPricing',
304
+ httpMethod: 'put',
305
+ httpPath: '/api/v1/addons/{id}/charges',
288
306
  },
289
307
  {
290
- clientCallName: 'client.v1.events.addons.draft.createAddonDraft',
291
- fullyQualifiedName: 'v1.events.addons.draft.createAddonDraft',
308
+ clientCallName: 'client.v1.addons.entitlements.create',
309
+ fullyQualifiedName: 'v1.addons.entitlements.create',
292
310
  httpMethod: 'post',
293
- httpPath: '/api/v1/addons/{id}/draft',
311
+ httpPath: '/api/v1/addons/{addonId}/entitlements',
312
+ },
313
+ {
314
+ clientCallName: 'client.v1.addons.entitlements.update',
315
+ fullyQualifiedName: 'v1.addons.entitlements.update',
316
+ httpMethod: 'patch',
317
+ httpPath: '/api/v1/addons/{addonId}/entitlements/{id}',
318
+ },
319
+ {
320
+ clientCallName: 'client.v1.addons.entitlements.list',
321
+ fullyQualifiedName: 'v1.addons.entitlements.list',
322
+ httpMethod: 'get',
323
+ httpPath: '/api/v1/addons/{addonId}/entitlements',
294
324
  },
295
325
  {
296
- clientCallName: 'client.v1.events.addons.draft.removeAddonDraft',
297
- fullyQualifiedName: 'v1.events.addons.draft.removeAddonDraft',
326
+ clientCallName: 'client.v1.addons.entitlements.delete',
327
+ fullyQualifiedName: 'v1.addons.entitlements.delete',
298
328
  httpMethod: 'delete',
299
- httpPath: '/api/v1/addons/{id}/draft',
329
+ httpPath: '/api/v1/addons/{addonId}/entitlements/{id}',
300
330
  },
301
331
  {
302
- clientCallName: 'client.v1.events.plans.create',
303
- fullyQualifiedName: 'v1.events.plans.create',
332
+ clientCallName: 'client.v1.plans.create',
333
+ fullyQualifiedName: 'v1.plans.create',
304
334
  httpMethod: 'post',
305
335
  httpPath: '/api/v1/plans',
306
336
  },
307
337
  {
308
- clientCallName: 'client.v1.events.plans.retrieve',
309
- fullyQualifiedName: 'v1.events.plans.retrieve',
338
+ clientCallName: 'client.v1.plans.retrieve',
339
+ fullyQualifiedName: 'v1.plans.retrieve',
310
340
  httpMethod: 'get',
311
341
  httpPath: '/api/v1/plans/{id}',
312
342
  },
313
343
  {
314
- clientCallName: 'client.v1.events.plans.list',
315
- fullyQualifiedName: 'v1.events.plans.list',
344
+ clientCallName: 'client.v1.plans.update',
345
+ fullyQualifiedName: 'v1.plans.update',
346
+ httpMethod: 'patch',
347
+ httpPath: '/api/v1/plans/{id}',
348
+ },
349
+ {
350
+ clientCallName: 'client.v1.plans.list',
351
+ fullyQualifiedName: 'v1.plans.list',
316
352
  httpMethod: 'get',
317
353
  httpPath: '/api/v1/plans',
318
354
  },
355
+ {
356
+ clientCallName: 'client.v1.plans.archive',
357
+ fullyQualifiedName: 'v1.plans.archive',
358
+ httpMethod: 'post',
359
+ httpPath: '/api/v1/plans/{id}/archive',
360
+ },
361
+ {
362
+ clientCallName: 'client.v1.plans.createDraft',
363
+ fullyQualifiedName: 'v1.plans.createDraft',
364
+ httpMethod: 'post',
365
+ httpPath: '/api/v1/plans/{id}/draft',
366
+ },
367
+ {
368
+ clientCallName: 'client.v1.plans.publish',
369
+ fullyQualifiedName: 'v1.plans.publish',
370
+ httpMethod: 'post',
371
+ httpPath: '/api/v1/plans/{id}/publish',
372
+ },
373
+ {
374
+ clientCallName: 'client.v1.plans.removeDraft',
375
+ fullyQualifiedName: 'v1.plans.removeDraft',
376
+ httpMethod: 'delete',
377
+ httpPath: '/api/v1/plans/{id}/draft',
378
+ },
379
+ {
380
+ clientCallName: 'client.v1.plans.setPricing',
381
+ fullyQualifiedName: 'v1.plans.setPricing',
382
+ httpMethod: 'put',
383
+ httpPath: '/api/v1/plans/{id}/charges',
384
+ },
385
+ {
386
+ clientCallName: 'client.v1.plans.entitlements.create',
387
+ fullyQualifiedName: 'v1.plans.entitlements.create',
388
+ httpMethod: 'post',
389
+ httpPath: '/api/v1/plans/{planId}/entitlements',
390
+ },
391
+ {
392
+ clientCallName: 'client.v1.plans.entitlements.update',
393
+ fullyQualifiedName: 'v1.plans.entitlements.update',
394
+ httpMethod: 'patch',
395
+ httpPath: '/api/v1/plans/{planId}/entitlements/{id}',
396
+ },
397
+ {
398
+ clientCallName: 'client.v1.plans.entitlements.list',
399
+ fullyQualifiedName: 'v1.plans.entitlements.list',
400
+ httpMethod: 'get',
401
+ httpPath: '/api/v1/plans/{planId}/entitlements',
402
+ },
403
+ {
404
+ clientCallName: 'client.v1.plans.entitlements.delete',
405
+ fullyQualifiedName: 'v1.plans.entitlements.delete',
406
+ httpMethod: 'delete',
407
+ httpPath: '/api/v1/plans/{planId}/entitlements/{id}',
408
+ },
319
409
  {
320
410
  clientCallName: 'client.v1.usage.history',
321
411
  fullyQualifiedName: 'v1.usage.history',
package/src/options.ts CHANGED
@@ -14,6 +14,7 @@ export type CLIOptions = McpOptions & {
14
14
  };
15
15
 
16
16
  export type McpOptions = {
17
+ includeCodeTool?: boolean | undefined;
17
18
  includeDocsTools?: boolean | undefined;
18
19
  stainlessApiKey?: string | undefined;
19
20
  codeAllowHttpGets?: boolean | undefined;
@@ -92,11 +93,13 @@ export function parseCLIOptions(): CLIOptions {
92
93
  : argv.tools?.includes(toolType) ? true
93
94
  : undefined;
94
95
 
96
+ const includeCodeTool = shouldIncludeToolType('code');
95
97
  const includeDocsTools = shouldIncludeToolType('docs');
96
98
 
97
99
  const transport = argv.transport as 'stdio' | 'http';
98
100
 
99
101
  return {
102
+ ...(includeCodeTool !== undefined && { includeCodeTool }),
100
103
  ...(includeDocsTools !== undefined && { includeDocsTools }),
101
104
  debug: !!argv.debug,
102
105
  stainlessApiKey: argv.stainlessApiKey,
@@ -129,13 +132,19 @@ export function parseQueryOptions(defaultOptions: McpOptions, query: unknown): M
129
132
  const queryObject = typeof query === 'string' ? qs.parse(query) : query;
130
133
  const queryOptions = QueryOptions.parse(queryObject);
131
134
 
135
+ let codeTool: boolean | undefined =
136
+ queryOptions.no_tools && queryOptions.no_tools?.includes('code') ? false
137
+ : queryOptions.tools?.includes('code') ? true
138
+ : defaultOptions.includeCodeTool;
139
+
132
140
  let docsTools: boolean | undefined =
133
141
  queryOptions.no_tools && queryOptions.no_tools?.includes('docs') ? false
134
142
  : queryOptions.tools?.includes('docs') ? true
135
143
  : defaultOptions.includeDocsTools;
136
144
 
137
145
  return {
138
- codeExecutionMode: defaultOptions.codeExecutionMode,
146
+ ...(codeTool !== undefined && { includeCodeTool: codeTool }),
139
147
  ...(docsTools !== undefined && { includeDocsTools: docsTools }),
148
+ codeExecutionMode: defaultOptions.codeExecutionMode,
140
149
  };
141
150
  }
package/src/server.ts CHANGED
@@ -20,7 +20,7 @@ export const newMcpServer = async (stainlessApiKey: string | undefined) =>
20
20
  new McpServer(
21
21
  {
22
22
  name: 'stigg_typescript_api',
23
- version: '0.1.0-alpha.10',
23
+ version: '0.1.0-alpha.12',
24
24
  },
25
25
  {
26
26
  instructions: await getInstructions(stainlessApiKey),
@@ -156,12 +156,16 @@ export async function initMcpServer(params: {
156
156
  * Selects the tools to include in the MCP Server based on the provided options.
157
157
  */
158
158
  export function selectTools(options?: McpOptions): McpTool[] {
159
- const includedTools = [
160
- codeTool({
161
- blockedMethods: blockedMethodsForCodeTool(options),
162
- codeExecutionMode: options?.codeExecutionMode ?? 'stainless-sandbox',
163
- }),
164
- ];
159
+ const includedTools = [];
160
+
161
+ if (options?.includeCodeTool ?? true) {
162
+ includedTools.push(
163
+ codeTool({
164
+ blockedMethods: blockedMethodsForCodeTool(options),
165
+ codeExecutionMode: options?.codeExecutionMode ?? 'stainless-sandbox',
166
+ }),
167
+ );
168
+ }
165
169
  if (options?.includeDocsTools ?? true) {
166
170
  includedTools.push(docsSearchTool);
167
171
  }