@growthbook/mcp 1.4.3 → 1.4.5

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@growthbook/mcp",
3
3
  "mcpName": "io.github.growthbook/growthbook-mcp",
4
- "version": "1.4.3",
4
+ "version": "1.4.5",
5
5
  "description": "MCP Server for interacting with GrowthBook",
6
6
  "access": "public",
7
7
  "homepage": "https://github.com/growthbook/growthbook-mcp",
@@ -12,9 +12,10 @@
12
12
  "scripts": {
13
13
  "build": "tsc",
14
14
  "dev": "tsc --watch",
15
- "bump:patch": "npm version patch --no-git-tag-version",
16
- "bump:minor": "npm version minor --no-git-tag-version",
17
- "bump:major": "npm version major --no-git-tag-version",
15
+ "sync-version": "node scripts/sync-version.js",
16
+ "bump:patch": "npm version patch --no-git-tag-version && npm run sync-version",
17
+ "bump:minor": "npm version minor --no-git-tag-version && npm run sync-version",
18
+ "bump:major": "npm version major --no-git-tag-version && npm run sync-version",
18
19
  "mcpb:build": "npx -y @anthropic-ai/mcpb -- pack"
19
20
  },
20
21
  "bin": {
@@ -267,6 +267,9 @@ export function registerExperimentTools({ server, baseApiUrl, apiKey, appOrigin,
267
267
  .string()
268
268
  .optional()
269
269
  .describe("Experiment hypothesis. Base hypothesis off the examples from get_defaults. If none are available, use a falsifiable statement about what will happen if the experiment succeeds or fails."),
270
+ valueType: z
271
+ .enum(["string", "number", "boolean", "json"])
272
+ .describe("The value type for all experiment variations"),
270
273
  variations: z
271
274
  .array(z.object({
272
275
  name: z
@@ -279,7 +282,7 @@ export function registerExperimentTools({ server, baseApiUrl, apiKey, appOrigin,
279
282
  z.boolean(),
280
283
  z.record(z.string(), z.any()),
281
284
  ])
282
- .describe("The value of the control and each of the variations. The value should be a string, number, boolean, or object. If it's an object, it should be a valid JSON object."),
285
+ .describe("The value of this variation. Must match the specified valueType: provide actual booleans (true/false) not strings, actual numbers, strings, or valid JSON objects."),
283
286
  }))
284
287
  .describe("Experiment variations. The key should be the variation name and the value should be the variation value. Look to variations included in preview experiments for guidance on generation. The default or control variation should always be first."),
285
288
  project: z
@@ -295,7 +298,7 @@ export function registerExperimentTools({ server, baseApiUrl, apiKey, appOrigin,
295
298
  }, {
296
299
  readOnlyHint: false,
297
300
  destructiveHint: false,
298
- }, async ({ description, hypothesis, name, variations, fileExtension, confirmedDefaultsReviewed, project, }) => {
301
+ }, async ({ description, hypothesis, name, valueType, variations, fileExtension, confirmedDefaultsReviewed, project, }) => {
299
302
  if (!confirmedDefaultsReviewed) {
300
303
  return {
301
304
  content: [
@@ -308,6 +311,7 @@ export function registerExperimentTools({ server, baseApiUrl, apiKey, appOrigin,
308
311
  }
309
312
  // Fetch experiment defaults first and surface to user
310
313
  let experimentDefaults = await getDefaults(apiKey, baseApiUrl);
314
+ const stringifyValue = (value) => typeof value === "object" ? JSON.stringify(value) : String(value);
311
315
  const experimentPayload = {
312
316
  name,
313
317
  description,
@@ -338,12 +342,8 @@ export function registerExperimentTools({ server, baseApiUrl, apiKey, appOrigin,
338
342
  const flagPayload = {
339
343
  id: flagId,
340
344
  owner: user,
341
- defaultValue: variations[0].value,
342
- valueType: typeof variations[0].value === "string"
343
- ? "string"
344
- : typeof variations[0].value === "number"
345
- ? "number"
346
- : "boolean",
345
+ defaultValue: stringifyValue(variations[0].value),
346
+ valueType,
347
347
  description,
348
348
  environments: {
349
349
  ...experimentDefaults.environments.reduce((acc, env) => {
@@ -354,7 +354,7 @@ export function registerExperimentTools({ server, baseApiUrl, apiKey, appOrigin,
354
354
  type: "experiment-ref",
355
355
  experimentId: experimentData.experiment.id,
356
356
  variations: experimentData.experiment.variations.map((expVariation, idx) => ({
357
- value: variations[idx].value,
357
+ value: stringifyValue(variations[idx].value),
358
358
  variationId: expVariation.variationId,
359
359
  })),
360
360
  },