@featureflip/mcp 0.8.0 → 0.9.0

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/README.md CHANGED
@@ -47,7 +47,8 @@ CRUD: `list_projects`, `list_environments`, `list_flags`, `get_flag`, `create_fl
47
47
  `delete_flag`, `archive_flag`, `restore_flag`, `set_flag_expiry`, `set_flag_owner`, `set_flag_permanent`,
48
48
  `toggle_flag`, `update_flag_environment_config`, `copy_flag_config`, `get_targeting`, `update_targeting`,
49
49
  `manage_targeting_rule`, `manage_variation`, `list_segments`, `get_segment`, `manage_segment`,
50
- `manage_project`, `set_default_flag_lifetime`, `manage_environment`, `list_sdk_keys`, `manage_sdk_key`
50
+ `manage_project`, `set_default_flag_lifetime`, `manage_environment`, `list_sdk_keys`, `manage_sdk_key`,
51
+ `list_flag_triggers`, `manage_flag_trigger`
51
52
 
52
53
  Webhooks (Admin token required): `list_webhooks`, `list_webhook_deliveries`, `manage_webhook`, `deliver_webhook`
53
54
 
package/dist/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as e, i as t, n, o as r, s as i, t as a } from "./org-40S7JIbw.js";
1
+ import { a as e, i as t, n, o as r, s as i, t as a } from "./org-BDExAaDn.js";
2
2
  import { serveStdio as o } from "@modelcontextprotocol/server/stdio";
3
3
  // src/unconfigured.ts
4
4
  var s = class extends i {
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { o as ApiError, s as FeatureflipApi, c as PKG_VERSION, a as createServer, r as loadConfig, t as resolveOrg } from "./org-40S7JIbw.js";
1
+ export { o as ApiError, s as FeatureflipApi, c as PKG_VERSION, a as createServer, r as loadConfig, t as resolveOrg } from "./org-BDExAaDn.js";
@@ -3,7 +3,7 @@ import * as n from "zod/v4";
3
3
  // src/version.ts
4
4
  var r = {
5
5
  name: "@featureflip/mcp",
6
- version: "0.8.0",
6
+ version: "0.9.0",
7
7
  mcpName: "io.github.canopy-labs/featureflip",
8
8
  description: "MCP server for managing Featureflip feature flags from AI agents and editors",
9
9
  keywords: [
@@ -285,7 +285,7 @@ var D = n.string().describe("Project key"), O = n.string().describe("Flag key or
285
285
  cursor: n.string().optional().describe("next_cursor from a previous response")
286
286
  };
287
287
  // src/tools/projects.ts
288
- function M(e, t) {
288
+ function ee(e, t) {
289
289
  e.registerTool("list_projects", {
290
290
  title: "List projects",
291
291
  description: "List projects in the Featureflip organization. Paginated: pass cursor from next_cursor to continue.",
@@ -376,7 +376,7 @@ function M(e, t) {
376
376
  }));
377
377
  }
378
378
  // src/tools/environments.ts
379
- function N(e, t) {
379
+ function te(e, t) {
380
380
  e.registerTool("list_environments", {
381
381
  title: "List environments",
382
382
  description: "List the environments of a project (e.g. development, staging, production).",
@@ -448,8 +448,8 @@ function N(e, t) {
448
448
  }));
449
449
  }
450
450
  // src/tools/sdk-keys.ts
451
- var P = "This is the only time the full key is returned; it cannot be shown again. Store it in a secret or an untracked .env file, never in source control or a chat log.";
452
- function ee(e, t) {
451
+ var M = "This is the only time the full key is returned; it cannot be shown again. Store it in a secret or an untracked .env file, never in source control or a chat log.";
452
+ function ne(e, t) {
453
453
  let r = (e, n) => `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/environments/${o(n)}/sdk-keys`;
454
454
  e.registerTool("list_sdk_keys", {
455
455
  title: "List SDK keys",
@@ -503,7 +503,7 @@ function ee(e, t) {
503
503
  } });
504
504
  return d({
505
505
  ...e,
506
- warning: e.warning ? `${e.warning} ${P}` : P
506
+ warning: e.warning ? `${e.warning} ${M}` : M
507
507
  });
508
508
  }
509
509
  if (!a) return f(/* @__PURE__ */ Error(`action=${e} requires sdkKey (see list_sdk_keys)`));
@@ -523,24 +523,24 @@ function ee(e, t) {
523
523
  }));
524
524
  }
525
525
  // src/tools/etag.ts
526
- var F = {
526
+ var N = {
527
527
  type: "string",
528
528
  description: "ETag of what was read. Pass it as ifMatch on the matching update so the write is refused (412) instead of overwriting a change made since."
529
- }, I = {
529
+ }, P = {
530
530
  type: "string",
531
531
  description: "ETag of what this write left behind. Pass it as ifMatch on the next update to chain writes without re-reading. Absent when the API sent none; read the resource again before the next conditional write."
532
532
  };
533
- function L(e) {
533
+ function F(e) {
534
534
  return n.string().optional().describe(`etag from ${e}. The write is refused with 412 if the resource changed since that read; re-read and re-apply. Omit to write unconditionally.`);
535
535
  }
536
- function R({ data: e, etag: t }) {
536
+ function I({ data: e, etag: t }) {
537
537
  return t ? {
538
538
  ...e,
539
539
  etag: t
540
540
  } : e;
541
541
  }
542
542
  // src/tools/segments.ts
543
- function te(e, t) {
543
+ function re(e, t) {
544
544
  e.registerTool("list_segments", {
545
545
  title: "List user segments",
546
546
  description: "List reusable user segments in a project. Segments are referenced from targeting rules via userSegmentId.",
@@ -560,9 +560,9 @@ function te(e, t) {
560
560
  project: n.string().describe("Project key"),
561
561
  segment: n.string().describe("Segment key or id")
562
562
  }),
563
- outputSchema: C("GET /api/v1/orgs/{org}/projects/{project}/segments/{segment}", { etag: F }),
563
+ outputSchema: C("GET /api/v1/orgs/{org}/projects/{project}/segments/{segment}", { etag: N }),
564
564
  annotations: { readOnlyHint: !0 }
565
- }, async ({ project: e, segment: n }) => p(async () => d(R(await t.api.requestWithEtag("GET", `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/segments/${o(n)}`)))));
565
+ }, async ({ project: e, segment: n }) => p(async () => d(I(await t.api.requestWithEtag("GET", `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/segments/${o(n)}`)))));
566
566
  let r = n.object({
567
567
  attribute: n.string().describe("Context attribute name, e.g. plan, country, user_id"),
568
568
  operator: n.string().describe("Case-sensitive: Equals, NotEquals, Contains, NotContains, GreaterThan, LessThan, GreaterThanOrEqual, LessThanOrEqual, In, NotIn, MatchesRegex, StartsWith, EndsWith, Before, After, SemverEquals, SemverGreaterThan, SemverGreaterThanOrEqual, SemverLessThan, SemverLessThanOrEqual"),
@@ -589,7 +589,7 @@ function te(e, t) {
589
589
  name: n.string().optional().describe("Display name; required for create"),
590
590
  description: n.string().optional().describe("What the segment means; \"\" clears it"),
591
591
  conditions: n.array(r).optional().describe("Conditions a user must match to be in the segment; on update, replaces the whole list"),
592
- ifMatch: L("get_segment"),
592
+ ifMatch: F("get_segment"),
593
593
  reason: A
594
594
  }),
595
595
  outputSchema: T(y("POST /api/v1/orgs/{org}/projects/{project}/segments"), E({
@@ -601,7 +601,7 @@ function te(e, t) {
601
601
  type: ["array", "null"],
602
602
  items: { type: "object" }
603
603
  },
604
- etag: I
604
+ etag: P
605
605
  }, ["segment", "updated"]), E({ deleted: { type: "string" } }, ["deleted"])),
606
606
  annotations: { destructiveHint: !0 }
607
607
  }, async ({ action: e, project: n, segment: r, key: a, name: s, description: c, conditions: l, ifMatch: u, reason: m }) => p(async () => {
@@ -628,7 +628,7 @@ function te(e, t) {
628
628
  ifMatch: u ?? n,
629
629
  reason: m
630
630
  });
631
- return d(R({
631
+ return d(I({
632
632
  data: {
633
633
  segment: r,
634
634
  updated: !0,
@@ -641,8 +641,8 @@ function te(e, t) {
641
641
  }));
642
642
  }
643
643
  // src/tools/owner.ts
644
- var z = n.string().optional().describe("Only flags with this owner: an email, \"me\" for the token's own user, or \"none\" for unowned flags");
645
- async function B(e, t) {
644
+ var L = n.string().optional().describe("Only flags with this owner: an email, \"me\" for the token's own user, or \"none\" for unowned flags");
645
+ async function R(e, t) {
646
646
  let n = t?.trim();
647
647
  if (!n) return;
648
648
  if (n.toLowerCase() !== "me") return n;
@@ -651,13 +651,13 @@ async function B(e, t) {
651
651
  return r.email;
652
652
  }
653
653
  // src/tools/flags.ts
654
- var V = n.enum([
654
+ var z = n.enum([
655
655
  "Boolean",
656
656
  "String",
657
657
  "Number",
658
658
  "Json"
659
659
  ]);
660
- function H(e, t) {
660
+ function ie(e, t) {
661
661
  let r = (e) => `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/flags`;
662
662
  e.registerTool("list_flags", {
663
663
  title: "List feature flags",
@@ -666,16 +666,16 @@ function H(e, t) {
666
666
  project: D,
667
667
  search: n.string().optional().describe("Substring of the flag key or name"),
668
668
  tag: n.string().optional().describe("Only flags carrying this tag"),
669
- type: V.optional().describe("Only flags of this type"),
669
+ type: z.optional().describe("Only flags of this type"),
670
670
  archived: n.boolean().optional().describe("true = only archived, false = only active"),
671
- owner: z,
671
+ owner: L,
672
672
  ...j
673
673
  }),
674
674
  outputSchema: S("GET /api/v1/orgs/{org}/projects/{project}/flags"),
675
675
  annotations: { readOnlyHint: !0 }
676
676
  }, async ({ project: e, owner: n, ...i }) => p(async () => d(await t.api.request("GET", r(e), { query: {
677
677
  ...i,
678
- owner: await B(t, n)
678
+ owner: await R(t, n)
679
679
  } })))), e.registerTool("get_flag", {
680
680
  title: "Get feature flag",
681
681
  description: "Get one feature flag with its variations and metadata, including its owner (null when unowned). Address by flag key or id.",
@@ -683,16 +683,16 @@ function H(e, t) {
683
683
  project: D,
684
684
  flag: O
685
685
  }),
686
- outputSchema: C("GET /api/v1/orgs/{org}/projects/{project}/flags/{flag}", { etag: F }),
686
+ outputSchema: C("GET /api/v1/orgs/{org}/projects/{project}/flags/{flag}", { etag: N }),
687
687
  annotations: { readOnlyHint: !0 }
688
- }, async ({ project: e, flag: n }) => p(async () => d(R(await t.api.requestWithEtag("GET", `${r(e)}/${o(n)}`))))), e.registerTool("create_flag", {
688
+ }, async ({ project: e, flag: n }) => p(async () => d(I(await t.api.requestWithEtag("GET", `${r(e)}/${o(n)}`))))), e.registerTool("create_flag", {
689
689
  title: "Create feature flag",
690
690
  description: "Create a feature flag. type is one of Boolean|String|Number|Json. Boolean flags get true/false variations automatically; for other types pass initialVariations. The flag is created in every environment of the project (disabled).",
691
691
  inputSchema: n.object({
692
692
  project: D,
693
693
  key: n.string().describe("Unique flag key, e.g. checkout-v2"),
694
694
  name: n.string().describe("Display name"),
695
- type: V.describe("Value type; Boolean gets true/false variations automatically"),
695
+ type: z.describe("Value type; Boolean gets true/false variations automatically"),
696
696
  description: n.string().optional().describe("What the flag controls"),
697
697
  tags: n.array(n.string()).optional().describe("Tags for filtering, e.g. team or area"),
698
698
  clientSideVisible: n.boolean().optional().describe("Expose to client-side SDKs (browser/mobile)"),
@@ -722,14 +722,14 @@ function H(e, t) {
722
722
  description: n.string().optional().describe("New description; \"\" clears it"),
723
723
  tags: n.array(n.string()).optional().describe("Replaces the whole tag list"),
724
724
  clientSideVisible: n.boolean().optional().describe("Expose to client-side SDKs (browser/mobile); false hides the flag from them entirely"),
725
- ifMatch: L("get_flag"),
725
+ ifMatch: F("get_flag"),
726
726
  reason: A
727
727
  }),
728
728
  outputSchema: w({
729
729
  project: { type: "string" },
730
730
  flag: { type: "string" },
731
731
  updated: { type: "boolean" },
732
- etag: I
732
+ etag: P
733
733
  }, [
734
734
  "project",
735
735
  "flag",
@@ -747,7 +747,7 @@ function H(e, t) {
747
747
  ifMatch: l ?? p?.etag,
748
748
  reason: u
749
749
  });
750
- return d(R({
750
+ return d(I({
751
751
  data: {
752
752
  project: e,
753
753
  flag: n,
@@ -836,7 +836,7 @@ function H(e, t) {
836
836
  idempotentHint: !0
837
837
  }
838
838
  }, async ({ project: e, flag: n, owner: i }) => p(async () => {
839
- let a = `${r(e)}/${o(n)}/owner`, s = i?.trim().toLowerCase() === "none" ? void 0 : await B(t, i ?? void 0);
839
+ let a = `${r(e)}/${o(n)}/owner`, s = i?.trim().toLowerCase() === "none" ? void 0 : await R(t, i ?? void 0);
840
840
  return s === void 0 ? await t.api.request("DELETE", a) : await t.api.request("PUT", a, { body: { email: s } }), d({
841
841
  project: e,
842
842
  flag: n,
@@ -891,12 +891,12 @@ function H(e, t) {
891
891
  }))));
892
892
  }
893
893
  // src/tools/flag-environments.ts
894
- var ne = n.enum([
894
+ var ae = n.enum([
895
895
  "SingleVariation",
896
896
  "PercentageRollout",
897
897
  "TargetedRollout"
898
898
  ]);
899
- function re(e, t) {
899
+ function oe(e, t) {
900
900
  let r = (e, n) => `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/flags/${o(n)}`;
901
901
  e.registerTool("toggle_flag", {
902
902
  title: "Toggle flag in environment",
@@ -936,7 +936,7 @@ function re(e, t) {
936
936
  flag: O,
937
937
  environment: k,
938
938
  defaultVariationId: n.string().describe("Variation id to serve on fallthrough — required by the API"),
939
- strategy: ne.optional().describe("Serving strategy; only SingleVariation is currently supported here"),
939
+ strategy: ae.optional().describe("Serving strategy; only SingleVariation is currently supported here"),
940
940
  prerequisites: n.array(n.object({
941
941
  prerequisiteFlagKey: n.string(),
942
942
  expectedVariationKey: n.string()
@@ -1039,8 +1039,103 @@ function re(e, t) {
1039
1039
  annotations: { readOnlyHint: !0 }
1040
1040
  }, async ({ project: e, flag: n, environment: i, days: a }) => p(async () => d(await t.api.request("GET", `${r(e, n)}/environments/${o(i)}/evaluations`, { query: { days: a ?? 7 } }))));
1041
1041
  }
1042
+ // src/tools/flag-triggers.ts
1043
+ var B = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, V = "GET /api/v1/orgs/{org}/projects/{project}/flags/{flag}/environments/{env}/triggers", se = "Relay the url (or endpoint + secret) to the user verbatim so they can paste it into their monitoring tool, where it should be stored as a secret. Never write it to source control or a chat log. If it leaks, rotate it.", ce = "The old URL stopped working the moment this returned: update the monitoring tool now.", le = [["PLAN_FEATURE_UNAVAILABLE", "Flag triggers need the Team plan or above. On a lower plan you can still list, rename, disable and delete existing triggers, but not create, re-enable or rotate one. An organization Owner can upgrade in Billing."], ["FEATURE_NOT_ENABLED", "Flag triggers are not enabled for this organization yet. Nothing in the request is wrong, and retrying will not help until they are."]];
1044
+ function ue(e) {
1045
+ if (!(e instanceof i)) return;
1046
+ let t = [e.envelope.message, ...Object.values(e.envelope.fields ?? {}).flat()].join("\n");
1047
+ return le.find(([e]) => t.includes(e))?.[1];
1048
+ }
1049
+ async function H(e) {
1050
+ try {
1051
+ return await e();
1052
+ } catch (e) {
1053
+ let t = f(e), n = ue(e);
1054
+ return n && (t.content[0].text += `\n${n}`), t;
1055
+ }
1056
+ }
1057
+ var U = (e) => f(/* @__PURE__ */ Error(`trigger must be a trigger id, not "${e}": triggers have no key. See list_flag_triggers.`));
1058
+ function de(e, t) {
1059
+ let r = (e, n, r) => `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/flags/${o(n)}/environments/${o(r)}/triggers`;
1060
+ e.registerTool("list_flag_triggers", {
1061
+ title: "List flag triggers",
1062
+ description: "List a flag's triggers in one environment, or get one by passing trigger: id, name, action (Enable or Disable), whether each is enabled, the last four characters of its secret, and when it last fired. A trigger is a secret URL that a monitoring tool (a Grafana alert, a Datadog monitor) calls to turn the flag on or off. The URL is never listed; it is shown once, when manage_flag_trigger creates or rotates it.",
1063
+ inputSchema: n.object({
1064
+ project: D,
1065
+ flag: O,
1066
+ environment: k,
1067
+ trigger: n.string().optional().describe("Trigger id: get just that trigger instead of listing"),
1068
+ ...j
1069
+ }),
1070
+ outputSchema: T(y(V), y(`${V}/{trigger}`)),
1071
+ annotations: { readOnlyHint: !0 }
1072
+ }, async ({ project: e, flag: n, environment: i, trigger: a, limit: s, cursor: c }) => H(async () => {
1073
+ let l = r(e, n, i);
1074
+ return a === void 0 ? d(await t.api.request("GET", l, { query: {
1075
+ limit: s,
1076
+ cursor: c
1077
+ } })) : B.test(a) ? d(await t.api.request("GET", `${l}/${o(a)}`)) : U(a);
1078
+ })), e.registerTool("manage_flag_trigger", {
1079
+ title: "Create, update, rotate, or delete a flag trigger",
1080
+ description: "Manage a flag's triggers in one environment. A trigger is a secret URL a monitoring tool POSTs to (no body) to turn the flag on (Enable) or off (Disable); calling it when the flag is already in that state changes nothing. action=create needs name + triggerAction and returns the URL ONCE. action=update needs trigger and changes only the fields you pass (name, description, enabled; enabled=false stops the URL working until re-enabled). action=rotate needs trigger: the old URL stops working at once and the new one is returned ONCE. action=delete needs trigger. The action (Enable/Disable) is fixed at creation. Creating, re-enabling and rotating need the Team plan or above; every write needs a Member token; at most 10 per flag per environment. To change the flag yourself, use toggle_flag instead.",
1081
+ inputSchema: n.object({
1082
+ action: n.enum([
1083
+ "create",
1084
+ "update",
1085
+ "rotate",
1086
+ "delete"
1087
+ ]).describe("create needs name + triggerAction; update, rotate and delete need trigger"),
1088
+ project: D,
1089
+ flag: O,
1090
+ environment: k,
1091
+ trigger: n.string().optional().describe("Trigger id (see list_flag_triggers); required for update, rotate and delete"),
1092
+ name: n.string().optional().describe("Trigger name, e.g. \"Grafana: checkout error rate\"; required for create"),
1093
+ triggerAction: n.enum(["Enable", "Disable"]).optional().describe("Required for create: Disable turns the flag off (a kill switch), Enable turns it on"),
1094
+ description: n.string().optional().describe("What calls the trigger and why; \"\" clears it"),
1095
+ enabled: n.boolean().optional().describe("update only: false stops the URL working, true turns it back on"),
1096
+ reason: A,
1097
+ idempotency_key: n.string().optional().describe("Idempotency-Key header for create")
1098
+ }),
1099
+ outputSchema: T(y("POST /api/v1/orgs/{org}/projects/{project}/flags/{flag}/environments/{env}/triggers"), y("PUT /api/v1/orgs/{org}/projects/{project}/flags/{flag}/environments/{env}/triggers/{trigger}"), E({ deleted: { type: "string" } }, ["deleted"])),
1100
+ annotations: { destructiveHint: !0 }
1101
+ }, async ({ action: e, project: n, flag: i, environment: a, trigger: s, name: c, triggerAction: l, description: u, enabled: p, reason: m, idempotency_key: h }) => H(async () => {
1102
+ let g = r(n, i, a), _ = (e, ...t) => d({
1103
+ ...e,
1104
+ warning: [
1105
+ ...t,
1106
+ e.warning,
1107
+ se
1108
+ ].filter(Boolean).join(" ")
1109
+ });
1110
+ if (e === "create") return !c || !l ? f(/* @__PURE__ */ Error("action=create requires name and triggerAction")) : _(await t.api.request("POST", g, {
1111
+ body: {
1112
+ name: c,
1113
+ action: l,
1114
+ description: u
1115
+ },
1116
+ idempotencyKey: h,
1117
+ reason: m
1118
+ }));
1119
+ if (!s) return f(/* @__PURE__ */ Error(`action=${e} requires trigger (see list_flag_triggers)`));
1120
+ if (!B.test(s)) return U(s);
1121
+ let v = `${g}/${o(s)}`;
1122
+ if (e === "update") {
1123
+ if (c === void 0 && u === void 0 && p === void 0) return f(/* @__PURE__ */ Error("action=update needs at least one of name, description or enabled"));
1124
+ let e = await t.api.request("GET", v), n = {
1125
+ name: c ?? e.name,
1126
+ description: u === "" ? null : u ?? e.description ?? null,
1127
+ enabled: p ?? e.enabled
1128
+ };
1129
+ return d(await t.api.request("PUT", v, {
1130
+ body: n,
1131
+ reason: m
1132
+ }));
1133
+ }
1134
+ return e === "rotate" ? _(await t.api.request("POST", `${v}/rotate`, { reason: m }), ce) : (await t.api.request("DELETE", v, { reason: m }), d({ deleted: s }));
1135
+ }));
1136
+ }
1042
1137
  // src/tools/environment-comparison.ts
1043
- function ie(e, t) {
1138
+ function fe(e, t) {
1044
1139
  let r = (e) => `/api/v1/orgs/${o(t.org)}/projects/${o(e)}`;
1045
1140
  e.registerTool("compare_environments", {
1046
1141
  title: "Compare environments",
@@ -1105,12 +1200,12 @@ function ie(e, t) {
1105
1200
  });
1106
1201
  }
1107
1202
  // src/tools/targeting.ts
1108
- var ae = n.object({
1203
+ var pe = n.object({
1109
1204
  attribute: n.string().describe("Context attribute name, e.g. plan, country, user_id"),
1110
1205
  operator: n.string().describe("OperatorType member name, case-sensitive — e.g. Equals, NotEquals, Contains, In, GreaterThan"),
1111
1206
  values: n.array(n.string()),
1112
1207
  negate: n.boolean().optional().default(!1)
1113
- }), U = n.object({
1208
+ }), W = n.object({
1114
1209
  description: n.string().optional(),
1115
1210
  variationId: n.string().optional().describe("Variation served when the rule matches"),
1116
1211
  rolloutPercentage: n.number().int().min(0).max(100).optional().describe("Percentage rollout for this rule"),
@@ -1118,13 +1213,13 @@ var ae = n.object({
1118
1213
  userSegmentId: n.string().optional().describe("Match users in this segment (see list_segments)"),
1119
1214
  conditionGroups: n.array(n.object({
1120
1215
  operator: n.enum(["And", "Or"]).describe("How conditions inside this group combine"),
1121
- conditions: n.array(ae)
1216
+ conditions: n.array(pe)
1122
1217
  })).optional().describe("Groups are ANDed together; conditions inside a group use the group operator")
1123
- }), W = (e) => ({
1218
+ }), G = (e) => ({
1124
1219
  ...e,
1125
1220
  conditionGroups: e.conditionGroups ?? []
1126
1221
  });
1127
- function oe(e, t) {
1222
+ function me(e, t) {
1128
1223
  let r = (e, n, r) => `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/flags/${o(n)}/environments/${o(r)}/targeting`;
1129
1224
  e.registerTool("get_targeting", {
1130
1225
  title: "Get targeting rules",
@@ -1134,17 +1229,17 @@ function oe(e, t) {
1134
1229
  flag: O,
1135
1230
  environment: k
1136
1231
  }),
1137
- outputSchema: C("GET /api/v1/orgs/{org}/projects/{project}/flags/{flag}/environments/{env}/targeting", { etag: F }),
1232
+ outputSchema: C("GET /api/v1/orgs/{org}/projects/{project}/flags/{flag}/environments/{env}/targeting", { etag: N }),
1138
1233
  annotations: { readOnlyHint: !0 }
1139
- }, async ({ project: e, flag: n, environment: i }) => p(async () => d(R(await t.api.requestWithEtag("GET", r(e, n, i)))))), e.registerTool("update_targeting", {
1234
+ }, async ({ project: e, flag: n, environment: i }) => p(async () => d(I(await t.api.requestWithEtag("GET", r(e, n, i)))))), e.registerTool("update_targeting", {
1140
1235
  title: "Replace targeting rules",
1141
1236
  description: "REPLACE all targeting rules of a flag in one environment (full PUT — rules not included are removed). Rules are evaluated in order. Get the current rules first with get_targeting. Pass ifMatch (the etag from get_targeting) so rules someone else changed meanwhile are not overwritten.",
1142
1237
  inputSchema: n.object({
1143
1238
  project: D,
1144
1239
  flag: O,
1145
1240
  environment: k,
1146
- rules: n.array(U).describe("The complete ordered rule list; rules left out are deleted"),
1147
- ifMatch: L("get_targeting"),
1241
+ rules: n.array(W).describe("The complete ordered rule list; rules left out are deleted"),
1242
+ ifMatch: F("get_targeting"),
1148
1243
  reason: A
1149
1244
  }),
1150
1245
  outputSchema: w({
@@ -1152,7 +1247,7 @@ function oe(e, t) {
1152
1247
  flag: { type: "string" },
1153
1248
  environment: { type: "string" },
1154
1249
  rulesReplaced: { type: "integer" },
1155
- etag: I
1250
+ etag: P
1156
1251
  }, [
1157
1252
  "project",
1158
1253
  "flag",
@@ -1162,11 +1257,11 @@ function oe(e, t) {
1162
1257
  annotations: { destructiveHint: !0 }
1163
1258
  }, async ({ project: e, flag: n, environment: i, rules: a, ifMatch: o, reason: s }) => p(async () => {
1164
1259
  let { etag: c } = await t.api.requestWithEtag("PUT", r(e, n, i), {
1165
- body: { rules: a.map(W) },
1260
+ body: { rules: a.map(G) },
1166
1261
  ifMatch: o,
1167
1262
  reason: s
1168
1263
  });
1169
- return d(R({
1264
+ return d(I({
1170
1265
  data: {
1171
1266
  project: e,
1172
1267
  flag: n,
@@ -1189,7 +1284,7 @@ function oe(e, t) {
1189
1284
  flag: O,
1190
1285
  environment: k,
1191
1286
  ruleId: n.string().optional().describe("Rule id from get_targeting; required for update and remove"),
1192
- rule: U.optional().describe("Rule fields; required for add and update"),
1287
+ rule: W.optional().describe("Rule fields; required for add and update"),
1193
1288
  ruleIds: n.array(n.string()).optional().describe("Every rule id exactly once, in evaluation order; required for reorder"),
1194
1289
  reason: A
1195
1290
  }),
@@ -1204,7 +1299,7 @@ function oe(e, t) {
1204
1299
  }, async ({ action: e, project: n, flag: r, environment: i, ruleId: a, rule: s, ruleIds: c, reason: l }) => p(async () => {
1205
1300
  let u = `/api/v1/orgs/${o(t.org)}/projects/${o(n)}/flags/${o(r)}/environments/${o(i)}/rules`;
1206
1301
  if (e === "add") return s ? d(await t.api.request("POST", u, {
1207
- body: W(s),
1302
+ body: G(s),
1208
1303
  reason: l
1209
1304
  })) : f(/* @__PURE__ */ Error("action=add requires rule"));
1210
1305
  if (e === "reorder") return c ? (await t.api.request("PUT", `${u}/reorder`, {
@@ -1244,7 +1339,7 @@ function oe(e, t) {
1244
1339
  }));
1245
1340
  }
1246
1341
  // src/tools/variations.ts
1247
- function se(e, t) {
1342
+ function he(e, t) {
1248
1343
  e.registerTool("manage_variation", {
1249
1344
  title: "Add, update, or remove a variation",
1250
1345
  description: "Manage a flag's variations. action=add requires key + value; action=update/remove require variationId (get ids via get_flag). Removing a variation fails with VARIATION_HAS_DEPENDENTS if other flags depend on it.",
@@ -1292,8 +1387,8 @@ function se(e, t) {
1292
1387
  }));
1293
1388
  }
1294
1389
  // src/tools/webhooks.ts
1295
- var G = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, K = "Requires an Admin token. A 404 on every webhook call means webhooks are not enabled for the organization.";
1296
- function q(e) {
1390
+ var K = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, q = "Requires an Admin token. A 404 on every webhook call means webhooks are not enabled for the organization.";
1391
+ function J(e) {
1297
1392
  let t;
1298
1393
  try {
1299
1394
  t = new URL(e);
@@ -1302,13 +1397,13 @@ function q(e) {
1302
1397
  }
1303
1398
  return t.protocol === "https:" && t.port === "" && !t.username && !t.password && t.hostname === "hooks.slack.com" && t.pathname.startsWith("/services/");
1304
1399
  }
1305
- var J = "url is a Slack incoming webhook URL. Slack rejects the generic JSON payload, so every delivery would fail. Create the subscription with provider: \"Slack\" instead.";
1306
- function ce(e, t) {
1400
+ var Y = "url is a Slack incoming webhook URL. Slack rejects the generic JSON payload, so every delivery would fail. Create the subscription with provider: \"Slack\" instead.";
1401
+ function ge(e, t) {
1307
1402
  let r = `/api/v1/orgs/${o(t.org)}/webhooks`, i = (e) => `${r}/${o(e)}`;
1308
1403
  async function a(e) {
1309
1404
  let n = [];
1310
1405
  for (let r of e) {
1311
- if (G.test(r)) {
1406
+ if (K.test(r)) {
1312
1407
  n.push(r);
1313
1408
  continue;
1314
1409
  }
@@ -1320,7 +1415,7 @@ function ce(e, t) {
1320
1415
  }
1321
1416
  async function s(e) {
1322
1417
  let n = e.map((e) => {
1323
- if (G.test(e)) return { id: e };
1418
+ if (K.test(e)) return { id: e };
1324
1419
  let t = e.indexOf("/"), n = e.slice(0, t), r = e.slice(t + 1);
1325
1420
  if (t < 0 || !n || !r) throw Error(`Environment "${e}" needs its project: pass "<project>/<environment>", e.g. "web/production", or the environment's id.`);
1326
1421
  return {
@@ -1341,7 +1436,7 @@ function ce(e, t) {
1341
1436
  }
1342
1437
  e.registerTool("list_webhooks", {
1343
1438
  title: "List webhook subscriptions",
1344
- description: "List the organization's outbound webhook subscriptions (url, event/project/environment filters, enabled state, failure count, signing secret ids — never secret values), plus availableEventTypes: the event types a subscription can filter on. Empty filter lists mean \"all\". Paginated via cursor. " + K,
1439
+ description: "List the organization's outbound webhook subscriptions (url, event/project/environment filters, enabled state, failure count, signing secret ids — never secret values), plus availableEventTypes: the event types a subscription can filter on. Empty filter lists mean \"all\". Paginated via cursor. " + q,
1345
1440
  inputSchema: n.object({ ...j }),
1346
1441
  outputSchema: C("GET /api/v1/orgs/{org}/webhooks", { availableEventTypes: {
1347
1442
  type: "array",
@@ -1360,7 +1455,7 @@ function ce(e, t) {
1360
1455
  });
1361
1456
  })), e.registerTool("list_webhook_deliveries", {
1362
1457
  title: "List webhook deliveries",
1363
- description: "List one subscription's delivery attempts, most recent first. status is Pending (awaiting an attempt, backing off, or in flight), Succeeded or DeadLettered; lastResponseStatusCode and lastError explain a failure. Paginated via cursor. " + K,
1458
+ description: "List one subscription's delivery attempts, most recent first. status is Pending (awaiting an attempt, backing off, or in flight), Succeeded or DeadLettered; lastResponseStatusCode and lastError explain a failure. Paginated via cursor. " + q,
1364
1459
  inputSchema: n.object({
1365
1460
  id: n.string().describe("Subscription id (from list_webhooks)"),
1366
1461
  ...j
@@ -1372,7 +1467,7 @@ function ce(e, t) {
1372
1467
  cursor: r
1373
1468
  } })))), e.registerTool("manage_webhook", {
1374
1469
  title: "Create, update, or delete a webhook subscription, or rotate its secret",
1375
- description: "action=create requires name + url and returns the signing secret. action=update/delete/rotate_secret/retire_secret require id. provider (create only, default GenericHttp) is the destination type: a Slack incoming webhook URL (https://hooks.slack.com/services/...) needs provider: \"Slack\", which posts readable channel messages; provider: \"Datadog\" sends Events API change events (url is your site's https://event-management-intake.<site>/api/v2/events) and provider: \"Grafana\" creates annotations (url is https://<your grafana>/api/annotations). Datadog and Grafana require credential (a Datadog API key, or a Grafana service account token that can create annotations, e.g. Editor); GenericHttp and Slack refuse it. credential is write-only: stored encrypted, never returned, and never echoed in this tool's output. A subscription's provider can never change. update changes only the fields you pass and keeps the rest; pass an empty list to widen that filter back to \"all\". projects take project keys or ids; environments take \"<project>/<environment>\" keys (e.g. \"web/production\") or ids. eventTypes come from list_webhooks → availableEventTypes. create and rotate_secret return a secret that is NEVER shown again: relay it to the user verbatim so they can store it (for a GenericHttp subscription only: Slack, Datadog and Grafana never check it, so skip it there). Slack doesn't verify signatures, so a Slack subscription's secret is unused and rotate_secret is refused for one, and so are Datadog and Grafana ones, which authenticate with credential instead. On update, omit credential to keep the stored one; changing the url of a Datadog or Grafana subscription requires sending credential again. rotate_secret adds a new active secret while the old one keeps signing; retire_secret (secretId from list_webhooks) removes one and is refused for the last active secret. A project-restricted service token must list at least one project, all in its scope. " + K,
1470
+ description: "action=create requires name + url and returns the signing secret. action=update/delete/rotate_secret/retire_secret require id. provider (create only, default GenericHttp) is the destination type: a Slack incoming webhook URL (https://hooks.slack.com/services/...) needs provider: \"Slack\", which posts readable channel messages; provider: \"Datadog\" sends Events API change events (url is your site's https://event-management-intake.<site>/api/v2/events) and provider: \"Grafana\" creates annotations (url is https://<your grafana>/api/annotations). Datadog and Grafana require credential (a Datadog API key, or a Grafana service account token that can create annotations, e.g. Editor); GenericHttp and Slack refuse it. credential is write-only: stored encrypted, never returned, and never echoed in this tool's output. A subscription's provider can never change. update changes only the fields you pass and keeps the rest; pass an empty list to widen that filter back to \"all\". projects take project keys or ids; environments take \"<project>/<environment>\" keys (e.g. \"web/production\") or ids. eventTypes come from list_webhooks → availableEventTypes. create and rotate_secret return a secret that is NEVER shown again: relay it to the user verbatim so they can store it (for a GenericHttp subscription only: Slack, Datadog and Grafana never check it, so skip it there). Slack doesn't verify signatures, so a Slack subscription's secret is unused and rotate_secret is refused for one, and so are Datadog and Grafana ones, which authenticate with credential instead. On update, omit credential to keep the stored one; changing the url of a Datadog or Grafana subscription requires sending credential again. rotate_secret adds a new active secret while the old one keeps signing; retire_secret (secretId from list_webhooks) removes one and is refused for the last active secret. A project-restricted service token must list at least one project, all in its scope. " + q,
1376
1471
  inputSchema: n.object({
1377
1472
  action: n.enum([
1378
1473
  "create",
@@ -1426,7 +1521,7 @@ function ce(e, t) {
1426
1521
  if (e === "create") {
1427
1522
  if (!c || !l) return f(/* @__PURE__ */ Error("action=create requires name and url"));
1428
1523
  let e = u ?? "GenericHttp";
1429
- if (e === "GenericHttp" && q(l)) return f(/* @__PURE__ */ Error(J));
1524
+ if (e === "GenericHttp" && J(l)) return f(/* @__PURE__ */ Error(Y));
1430
1525
  let n = _ && await s(_), i = g && await a(g);
1431
1526
  return d(await t.api.request("POST", r, {
1432
1527
  body: {
@@ -1444,7 +1539,7 @@ function ce(e, t) {
1444
1539
  if (!n) return f(/* @__PURE__ */ Error(`action=${e} requires id (see list_webhooks)`));
1445
1540
  if (e === "update") {
1446
1541
  let e = _ && await s(_), r = g && await a(g), { data: o, etag: u } = await t.api.requestWithEtag("GET", i(n));
1447
- if (l && o.provider === "GenericHttp" && q(l)) return f(/* @__PURE__ */ Error(`${J} This subscription is GenericHttp, and a provider can't change.`));
1542
+ if (l && o.provider === "GenericHttp" && J(l)) return f(/* @__PURE__ */ Error(`${Y} This subscription is GenericHttp, and a provider can't change.`));
1448
1543
  let p = {
1449
1544
  name: c ?? o.name,
1450
1545
  url: l ?? o.url,
@@ -1476,7 +1571,7 @@ function ce(e, t) {
1476
1571
  })) : f(/* @__PURE__ */ Error("action=retire_secret requires secretId (see list_webhooks)"));
1477
1572
  })), e.registerTool("deliver_webhook", {
1478
1573
  title: "Send a test event or redeliver",
1479
- description: "action=test queues one synthetic flag.toggled event to this subscription alone; action=redeliver (deliveryId from list_webhook_deliveries) re-sends a finished delivery, restarting its retry schedule. Delivery is asynchronous: read list_webhook_deliveries for the outcome. Both are refused for a disabled subscription, and redeliver for a delivery that is still Pending. " + K,
1574
+ description: "action=test queues one synthetic flag.toggled event to this subscription alone; action=redeliver (deliveryId from list_webhook_deliveries) re-sends a finished delivery, restarting its retry schedule. Delivery is asynchronous: read list_webhook_deliveries for the outcome. Both are refused for a disabled subscription, and redeliver for a delivery that is still Pending. " + q,
1480
1575
  inputSchema: n.object({
1481
1576
  action: n.enum(["test", "redeliver"]).describe("test sends a synthetic event; redeliver re-sends deliveryId"),
1482
1577
  id: n.string().describe("Subscription id (from list_webhooks)"),
@@ -1496,15 +1591,15 @@ function ce(e, t) {
1496
1591
  })) : f(/* @__PURE__ */ Error("action=redeliver requires deliveryId (see list_webhook_deliveries)"))));
1497
1592
  }
1498
1593
  // src/tools/workflows/stale-flags.ts
1499
- var le = n.enum(["dead", "stale"]), Y = 50;
1500
- function ue(e, t) {
1594
+ var _e = n.enum(["dead", "stale"]), X = 50;
1595
+ function ve(e, t) {
1501
1596
  e.registerTool("find_stale_flags", {
1502
1597
  title: "Find stale flags",
1503
- description: `Find flags that look ready for code cleanup: not updated in N days AND either enabled in every environment (verify rollout is complete before removing — per-rule percentage ramps are not inspected) or disabled in every environment (dead — remove flag and code path). A flag whose expiry date (set_flag_expiry) has passed is always a candidate, however recently it was edited; if it is on in some environments and off in others its reason is past-expiry, meaning the owner has to decide which way to fold it. A project can give its temporary flags a default lifetime, so a flag with no date of its own can still be past expiry. Every result carries expiresAtUtc (the date set on the flag), effectiveExpiresAtUtc (the date in effect, from the flag or its project default), expirySource (explicit, project-default, or null), expired and owner (null when unowned). Flags marked permanent (kill switches, ops toggles) are never listed. Pass owner to see one person's stale flags ("me" for your own) or "none" for the unowned ones. Every result also carries blockedBy: the live flags that still list it as a prerequisite, which have to be removed and archived before it ([] when none). blockedBy is null when the server did not classify the flag as a removal candidate, which means unknown, not unblocked. A flag that other live flags list as a prerequisite has to be removed LAST, dependents first: archiving it while a dependent still names it makes that dependent fail its prerequisite check and serve its off variation, so archive_flag refuses it with FLAG_HAS_DEPENDENTS. Checks at most ${Y} candidates per call, expired flags first.`,
1598
+ description: `Find flags that look ready for code cleanup: not updated in N days AND either enabled in every environment (verify rollout is complete before removing — per-rule percentage ramps are not inspected) or disabled in every environment (dead — remove flag and code path). A flag whose expiry date (set_flag_expiry) has passed is always a candidate, however recently it was edited; if it is on in some environments and off in others its reason is past-expiry, meaning the owner has to decide which way to fold it. A project can give its temporary flags a default lifetime, so a flag with no date of its own can still be past expiry. Every result carries expiresAtUtc (the date set on the flag), effectiveExpiresAtUtc (the date in effect, from the flag or its project default), expirySource (explicit, project-default, or null), expired and owner (null when unowned). Flags marked permanent (kill switches, ops toggles) are never listed. Pass owner to see one person's stale flags ("me" for your own) or "none" for the unowned ones. Every result also carries blockedBy: the live flags that still list it as a prerequisite, which have to be removed and archived before it ([] when none). blockedBy is null when the server did not classify the flag as a removal candidate, which means unknown, not unblocked. A flag that other live flags list as a prerequisite has to be removed LAST, dependents first: archiving it while a dependent still names it makes that dependent fail its prerequisite check and serve its off variation, so archive_flag refuses it with FLAG_HAS_DEPENDENTS. Checks at most ${X} candidates per call, expired flags first.`,
1504
1599
  inputSchema: n.object({
1505
1600
  project: D,
1506
1601
  days: n.number().int().min(1).optional().default(30).describe("Minimum age in days since last update"),
1507
- owner: z
1602
+ owner: L
1508
1603
  }),
1509
1604
  outputSchema: w({
1510
1605
  project: { type: "string" },
@@ -1549,7 +1644,7 @@ function ue(e, t) {
1549
1644
  ]),
1550
1645
  annotations: { readOnlyHint: !0 }
1551
1646
  }, async ({ project: e, days: n, owner: r }) => p(async () => {
1552
- let a = await B(t, r), s = `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/flags`, c = Date.now(), l = c - n * 24 * 60 * 60 * 1e3, u = (e) => e.effectiveExpiresAtUtc ?? e.expiresAtUtc ?? null, f = (e) => e.expirySource ?? (e.expiresAtUtc ? "explicit" : null), p = (e) => {
1647
+ let a = await R(t, r), s = `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/flags`, c = Date.now(), l = c - n * 24 * 60 * 60 * 1e3, u = (e) => e.effectiveExpiresAtUtc ?? e.expiresAtUtc ?? null, f = (e) => e.expirySource ?? (e.expiresAtUtc ? "explicit" : null), p = (e) => {
1553
1648
  let t = u(e);
1554
1649
  return !!t && new Date(t).getTime() <= c;
1555
1650
  }, m = [], h;
@@ -1564,7 +1659,7 @@ function ue(e, t) {
1564
1659
  m.push(...(e.items ?? []).filter((e) => !!e.key && !!e.name && !!e.updatedAt && (new Date(e.updatedAt).getTime() < l || p(e)))), h = e.next_cursor ?? void 0;
1565
1660
  } while (h);
1566
1661
  m.sort((e, t) => Number(p(t)) - Number(p(e)));
1567
- let g = m.length > Y, _ = m.slice(0, Y), v = [];
1662
+ let g = m.length > X, _ = m.slice(0, X), v = [];
1568
1663
  for (let e of _) {
1569
1664
  let n = await t.api.request("GET", `${s}/${o(e.key)}/environments`);
1570
1665
  if (n.length === 0) continue;
@@ -1606,7 +1701,7 @@ function ue(e, t) {
1606
1701
  ...a ? { owner: a } : {},
1607
1702
  checked: _.length,
1608
1703
  truncated: g,
1609
- ...g ? { note: `Only the first ${Y} of ${m.length} candidates were checked.` } : {},
1704
+ ...g ? { note: `Only the first ${X} of ${m.length} candidates were checked.` } : {},
1610
1705
  ...y ? { blockedByNote: y } : {},
1611
1706
  stale: v
1612
1707
  });
@@ -1615,7 +1710,7 @@ function ue(e, t) {
1615
1710
  description: "List the flags the server is confident can be removed from code, the same list the Featureflip flag cleanup GitHub Action works from. Each item has key, reason, status (Dead or Stale), treatment (true = keep the on-branch, false = keep the off-branch) and blockedBy: the live flags that still list it as a prerequisite. Only remove a flag whose blockedBy is empty. A flag that other live flags list as a prerequisite has to be removed LAST, dependents first: archiving it while a dependent still names it makes that dependent fail its prerequisite check and serve its off variation, so archive_flag refuses it with FLAG_HAS_DEPENDENTS. staleness \"dead\" (the default) returns only dead flags, \"stale\" adds stale ones. Paginated via cursor.",
1616
1711
  inputSchema: n.object({
1617
1712
  project: D,
1618
- staleness: le.optional().describe("Minimum staleness tier: dead (default) or stale"),
1713
+ staleness: _e.optional().describe("Minimum staleness tier: dead (default) or stale"),
1619
1714
  ...j
1620
1715
  }),
1621
1716
  outputSchema: S("GET /api/v1/orgs/{org}/projects/{project}/flags/removal-candidates"),
@@ -1623,7 +1718,7 @@ function ue(e, t) {
1623
1718
  }, async ({ project: e, ...n }) => p(async () => d(await t.api.request("GET", `/api/v1/orgs/${o(t.org)}/projects/${o(e)}/flags/removal-candidates`, { query: n }))));
1624
1719
  }
1625
1720
  // src/tools/workflows/snippets.ts
1626
- var de = [
1721
+ var ye = [
1627
1722
  "js",
1628
1723
  "node",
1629
1724
  "browser",
@@ -1635,16 +1730,16 @@ var de = [
1635
1730
  "php",
1636
1731
  "ruby",
1637
1732
  "swift"
1638
- ], fe = [
1733
+ ], be = [
1639
1734
  "browser",
1640
1735
  "react",
1641
1736
  "swift"
1642
1737
  ];
1643
- function pe(e) {
1644
- return fe.includes(e);
1738
+ function xe(e) {
1739
+ return be.includes(e);
1645
1740
  }
1646
- var X = "Uses a SERVER-side SDK key (Featureflip dashboard → environment → SDK keys).", Z = "Uses a CLIENT-side SDK key (safe to ship to browsers/apps).";
1647
- function me(e, t) {
1741
+ var Z = "Uses a SERVER-side SDK key (Featureflip dashboard → environment → SDK keys).", Q = "Uses a CLIENT-side SDK key (safe to ship to browsers/apps).";
1742
+ function Se(e, t) {
1648
1743
  switch (e) {
1649
1744
  case "js": return {
1650
1745
  install: "npm install @featureflip/js",
@@ -1659,7 +1754,7 @@ const enabled = client.boolVariation('${t}', { user_id: userId }, false);
1659
1754
  if (enabled) {
1660
1755
  // new code path
1661
1756
  }`,
1662
- notes: X
1757
+ notes: Z
1663
1758
  };
1664
1759
  case "node": return {
1665
1760
  install: "npm install @featureflip/node",
@@ -1670,7 +1765,7 @@ const enabled = client.boolVariation('${t}', { user_id: userId }, false);
1670
1765
  if (enabled) {
1671
1766
  // new code path
1672
1767
  }`,
1673
- notes: X
1768
+ notes: Z
1674
1769
  };
1675
1770
  case "browser": return {
1676
1771
  install: "npm install @featureflip/browser",
@@ -1682,7 +1777,7 @@ const enabled = client.boolVariation('${t}', false);
1682
1777
  if (enabled) {
1683
1778
  // new code path
1684
1779
  }`,
1685
- notes: Z
1780
+ notes: Q
1686
1781
  };
1687
1782
  case "react": return {
1688
1783
  install: "npm install @featureflip/react @featureflip/browser",
@@ -1695,7 +1790,7 @@ function MyComponent() {
1695
1790
  const enabled = useFeatureFlag('${t}', false);
1696
1791
  return enabled ? <NewExperience /> : <CurrentExperience />;
1697
1792
  }`,
1698
- notes: Z
1793
+ notes: Q
1699
1794
  };
1700
1795
  case "python": return {
1701
1796
  install: "pip install featureflip",
@@ -1706,7 +1801,7 @@ enabled = client.variation("${t}", {"user_id": user_id}, default=False)
1706
1801
  if enabled:
1707
1802
  # new code path
1708
1803
  ...`,
1709
- notes: X
1804
+ notes: Z
1710
1805
  };
1711
1806
  case "csharp": return {
1712
1807
  install: "dotnet add package Featureflip.Client",
@@ -1719,7 +1814,7 @@ if (enabled)
1719
1814
  {
1720
1815
  // new code path
1721
1816
  }`,
1722
- notes: X
1817
+ notes: Z
1723
1818
  };
1724
1819
  case "java": return {
1725
1820
  install: "implementation 'io.featureflip:featureflip-java:2.0.0'",
@@ -1733,7 +1828,7 @@ boolean enabled = client.boolVariation("${t}",
1733
1828
  if (enabled) {
1734
1829
  // new code path
1735
1830
  }`,
1736
- notes: X
1831
+ notes: Z
1737
1832
  };
1738
1833
  case "go": return {
1739
1834
  install: "go get github.com/canopy-labs/featureflip-go/v2",
@@ -1749,7 +1844,7 @@ ctx := featureflip.EvaluationContext{UserID: userID}
1749
1844
  if client.BoolVariation("${t}", ctx, false) {
1750
1845
  // new code path
1751
1846
  }`,
1752
- notes: X
1847
+ notes: Z
1753
1848
  };
1754
1849
  case "php": return {
1755
1850
  install: "composer require featureflip/featureflip-php",
@@ -1764,7 +1859,7 @@ $enabled = $client->boolVariation('${t}', ['user_id' => $userId], false);
1764
1859
  if ($enabled) {
1765
1860
  // new code path
1766
1861
  }`,
1767
- notes: X + " Requires PSR-16 cache and PSR-18 HTTP implementations."
1862
+ notes: Z + " Requires PSR-16 cache and PSR-18 HTTP implementations."
1768
1863
  };
1769
1864
  case "ruby": return {
1770
1865
  install: "gem \"featureflip\"",
@@ -1775,7 +1870,7 @@ enabled = client.bool_variation("${t}", { "user_id" => user_id }, false)
1775
1870
  if enabled
1776
1871
  # new code path
1777
1872
  end`,
1778
- notes: X
1873
+ notes: Z
1779
1874
  };
1780
1875
  case "swift": return {
1781
1876
  install: ".package(url: \"https://github.com/canopy-labs/featureflip-swift\", from: \"2.0.0\")",
@@ -1788,12 +1883,12 @@ let enabled = client.boolVariation("${t}", default: false)
1788
1883
  if enabled {
1789
1884
  // new code path
1790
1885
  }`,
1791
- notes: Z
1886
+ notes: Q
1792
1887
  };
1793
1888
  }
1794
1889
  }
1795
1890
  // src/tools/workflows/wrap-feature.ts
1796
- function he(e, t) {
1891
+ function Ce(e, t) {
1797
1892
  e.registerTool("wrap_feature", {
1798
1893
  title: "Wrap a feature in a new flag",
1799
1894
  description: "Create a Boolean feature flag and get back the SDK code snippet to guard the new code path with it. Returns the snippet only — apply the edit yourself. The flag starts DISABLED in every environment; enable it with toggle_flag when ready.",
@@ -1803,7 +1898,7 @@ function he(e, t) {
1803
1898
  name: n.string().optional().describe("Display name; defaults to the key"),
1804
1899
  description: n.string().optional().describe("What this flag guards"),
1805
1900
  tags: n.array(n.string()).optional().describe("Tags for filtering, e.g. team or area"),
1806
- language: n.enum(de).describe("SDK language of the codebase being edited"),
1901
+ language: n.enum(ye).describe("SDK language of the codebase being edited"),
1807
1902
  idempotency_key: n.string().optional().describe("Idempotency-Key header for safe retries")
1808
1903
  }),
1809
1904
  outputSchema: w({
@@ -1832,10 +1927,10 @@ function he(e, t) {
1832
1927
  type: "Boolean",
1833
1928
  description: i,
1834
1929
  tags: a,
1835
- ...pe(s) ? { clientSideVisible: !0 } : {}
1930
+ ...xe(s) ? { clientSideVisible: !0 } : {}
1836
1931
  },
1837
1932
  idempotencyKey: c
1838
- }), u = me(s, n);
1933
+ }), u = Se(s, n);
1839
1934
  return d({
1840
1935
  flag: l,
1841
1936
  integration: {
@@ -1853,16 +1948,16 @@ function he(e, t) {
1853
1948
  }));
1854
1949
  }
1855
1950
  // src/server.ts
1856
- function ge(t) {
1951
+ function we(t) {
1857
1952
  let n = new e({
1858
1953
  name: "featureflip",
1859
1954
  version: r
1860
1955
  });
1861
- return M(n, t), N(n, t), ee(n, t), te(n, t), H(n, t), re(n, t), ie(n, t), oe(n, t), se(n, t), ce(n, t), ue(n, t), he(n, t), n;
1956
+ return ee(n, t), te(n, t), ne(n, t), re(n, t), ie(n, t), oe(n, t), de(n, t), fe(n, t), me(n, t), he(n, t), ge(n, t), ve(n, t), Ce(n, t), n;
1862
1957
  }
1863
1958
  // src/config.ts
1864
- var Q = "FEATUREFLIP_TOKEN is required. Create one in the Featureflip dashboard — Settings → API Tokens (personal token, ffp_...) or Organization Settings → Service Tokens (ffs_...) — and set it in your MCP client config.";
1865
- function $(e = process.env) {
1959
+ var $ = "FEATUREFLIP_TOKEN is required. Create one in the Featureflip dashboard — Settings → API Tokens (personal token, ffp_...) or Organization Settings → Service Tokens (ffs_...) — and set it in your MCP client config.";
1960
+ function Te(e = process.env) {
1866
1961
  let t = e.FEATUREFLIP_TOKEN?.trim();
1867
1962
  return t ? {
1868
1963
  token: t,
@@ -1870,13 +1965,13 @@ function $(e = process.env) {
1870
1965
  org: e.FEATUREFLIP_ORG?.trim() || void 0
1871
1966
  } : null;
1872
1967
  }
1873
- function _e(e = process.env) {
1874
- let t = $(e);
1875
- if (!t) throw Error(Q);
1968
+ function Ee(e = process.env) {
1969
+ let t = Te(e);
1970
+ if (!t) throw Error($);
1876
1971
  return t;
1877
1972
  }
1878
1973
  // src/org.ts
1879
- async function ve(e, t) {
1974
+ async function De(e, t) {
1880
1975
  if (t) return t;
1881
1976
  let n = (await e.request("GET", "/api/v1/orgs", { query: { limit: 100 } })).items ?? [];
1882
1977
  if (n.length === 1) {
@@ -1886,4 +1981,4 @@ async function ve(e, t) {
1886
1981
  }
1887
1982
  throw n.length === 0 ? Error("The token can see no organizations. Check the token in the Featureflip dashboard.") : Error(`The token can see ${n.length} organizations — set FEATUREFLIP_ORG to one of: ` + n.map((e) => e.slug ?? "?").join(", "));
1888
1983
  }
1889
- export { ge as a, r as c, $ as i, Q as n, i as o, _e as r, u as s, ve as t };
1984
+ export { we as a, r as c, Te as i, $ as n, i as o, Ee as r, u as s, De as t };
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AActD,wBAAgB,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,SAAS,CAexD"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAetD,wBAAgB,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,SAAS,CAgBxD"}
@@ -0,0 +1,4 @@
1
+ import { McpServer } from '@modelcontextprotocol/server';
2
+ import { ToolContext } from './context.js';
3
+ export declare function registerFlagTriggerTools(server: McpServer, ctx: ToolContext): void;
4
+ //# sourceMappingURL=flag-triggers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flag-triggers.d.ts","sourceRoot":"","sources":["../../src/tools/flag-triggers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAI9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA2DhD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI,CA6GlF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@featureflip/mcp",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "mcpName": "io.github.canopy-labs/featureflip",
5
5
  "description": "MCP server for managing Featureflip feature flags from AI agents and editors",
6
6
  "keywords": [