@loopops/mcp-server 3.34.0 → 3.38.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.
@@ -136,8 +136,60 @@ export function registerConfigTools(server, allowed) {
136
136
  branch,
137
137
  })));
138
138
  }
139
+ if (allowed.has("create_scenario")) {
140
+ server.tool("create_scenario", [
141
+ "Ops only. Clone a base scenario into a new directory.",
142
+ "Web-callable equivalent of scripts/scenario-create.mjs — no",
143
+ "local clone or DATABASE_URL required. Reads every file in the",
144
+ "base scenario directory, regenerates scenario.yaml with the new",
145
+ "id + cloned_from, rewrites scenario_id rows in targets.yaml,",
146
+ "copies the rest verbatim (roster, target_productivity, plus any",
147
+ "optional canonical-input overrides the base carries), and writes",
148
+ "everything in ONE atomic GitHub commit. Default dryRun:true",
149
+ "shows the planned file list. After commit, edit the new scenario",
150
+ "via update_config (or your editor) and run promote_scenario",
151
+ "when ready.",
152
+ ].join(" "), {
153
+ id: z
154
+ .string()
155
+ .min(1)
156
+ .describe("New scenario id (slug: lowercase letters/digits/underscores/hyphens, max 64 chars). Becomes the directory name under config/design/scenarios/. Must not already exist."),
157
+ baseScenarioId: z
158
+ .string()
159
+ .min(1)
160
+ .describe("Existing scenario to clone from (e.g. 'base'). Must resolve cleanly."),
161
+ description: z
162
+ .string()
163
+ .optional()
164
+ .describe("Manifest description for the new scenario. Defaults to 'Cloned from <base> on <date>'."),
165
+ dryRun: z
166
+ .boolean()
167
+ .optional()
168
+ .describe("Default true. Pass false to commit. Dry-run lists the files that would be written."),
169
+ branch: z
170
+ .string()
171
+ .optional()
172
+ .describe("Git branch to read base from AND write the new scenario to. Default: main."),
173
+ }, safeTool(async (input) => trpcMutation("mcp.createScenario", input)));
174
+ }
139
175
  if (allowed.has("promote_scenario")) {
140
- server.tool("promote_scenario", "Promote a scenario to active by editing `active_scenario` in config/design/capacity_config.yaml. Fails hard if the scenario doesn't resolve (missing or dangling components) — won't promote a broken plan. Dry-run by default — returns the diff; pass dryRun:false to commit the change.", {
176
+ server.tool("promote_scenario", [
177
+ "Promote a scenario to active by editing `active_scenario` in",
178
+ "config/design/capacity_config.yaml. Fails hard if the scenario",
179
+ "doesn't resolve (missing or dangling components) — won't promote",
180
+ "a broken plan. Dry-run by default — returns the diff; pass",
181
+ "dryRun:false to commit.",
182
+ "Open-cycle conflict: when the org has an open planning cycle",
183
+ "bound to a different scenario, promote refuses by default — the",
184
+ "cycle's scenarioId needs to move with the active scenario or",
185
+ "commit_cycle promotes the wrong scenario at cutover. Re-run with",
186
+ "rebindOpenCycle:true to apply the rebind atomically — the open",
187
+ "cycle's scenarioId moves, every non-superseded proposal across",
188
+ "all three phases is superseded (re-run propose after rebind),",
189
+ "and the planning scope snapshot is cleared (re-run",
190
+ "snapshot_planning_scope). A cycle-level audit row of",
191
+ "action='rebind_scenario' captures the impact counts.",
192
+ ].join(" "), {
141
193
  scenarioId: z
142
194
  .string()
143
195
  .describe("Scenario id to promote (e.g. 'stretch'). Must exist in config/design/scenarios/ and be complete."),
@@ -145,11 +197,20 @@ export function registerConfigTools(server, allowed) {
145
197
  .boolean()
146
198
  .default(true)
147
199
  .describe("When true (default), return the diff without writing. Pass dryRun:false to commit."),
200
+ rebindOpenCycle: z
201
+ .boolean()
202
+ .default(false)
203
+ .describe("Required acknowledgement when an open cycle is bound to a different scenario. Default false → refuse with structured impact counts. Pass true to apply the rebind: update planning_cycle.scenarioId, supersede every non-superseded user / quota / account proposal in the cycle, delete planning_cycle_account_scope rows, then flip active_scenario in capacity_config.yaml. Atomic; audited as action='rebind_scenario'."),
148
204
  branch: z
149
205
  .string()
150
206
  .optional()
151
207
  .describe("Git branch to read from and write back to. Default: main. Writing to main = live promotion."),
152
- }, safeTool(async ({ scenarioId, dryRun, branch }) => trpcMutation("mcp.promoteScenario", { scenarioId, dryRun, branch })));
208
+ }, safeTool(async ({ scenarioId, dryRun, rebindOpenCycle, branch }) => trpcMutation("mcp.promoteScenario", {
209
+ scenarioId,
210
+ dryRun,
211
+ rebindOpenCycle,
212
+ branch,
213
+ })));
153
214
  }
154
215
  if (allowed.has("gap_analysis")) {
155
216
  server.tool("gap_analysis", "Use a Claude agent to find the smallest change set that closes a scenario's capacity gap on the target measure. The agent iterates simulate_capacity calls (mutating roster + target_productivity in memory, calling the existing /capacity endpoint) up to a budget cap, then submits a structured proposal. Output is exploratory by default — pass `writeFile: true` to materialize the proposal as a draft scenario at `config/design/scenarios/proposed-gap-{measure}-{ts}.yaml`, then use `compare_scenarios` to verify and `promote_scenario` to make it active.", {
@@ -594,19 +594,50 @@ export function registerDeployTools(server, allowed) {
594
594
  .describe("Why you're rolling back — required, min 20 chars. Captured in every per-proposal audit row."),
595
595
  }, safeTool(async (input) => trpcMutation("mcp.rollbackAccountCommit", input)));
596
596
  }
597
+ if (allowed.has("open_cycle")) {
598
+ server.tool("open_cycle", [
599
+ "Ops only. Open a new planning_cycle row bound to a Design",
600
+ "scenario. Refuses by default if another open cycle exists for",
601
+ "the org (most propose_* tools assume exactly one open cycle —",
602
+ "two parallel cycles silently produce ambiguous defaults). Pass",
603
+ "allowMultipleOpen:true to open a parallel sandbox. Validates",
604
+ "the target scenario resolves cleanly (same check as",
605
+ "promote_scenario) — never binds a cycle to a broken scenario.",
606
+ "scenarioId defaults to capacity_config.active_scenario when",
607
+ "omitted. Writes an audit row of action='open' on the",
608
+ "deploy.planning_cycle resource. Pairs with close_cycle +",
609
+ "commit_cycle to make the cycle lifecycle fully MCP-callable.",
610
+ ].join(" "), {
611
+ name: z
612
+ .string()
613
+ .min(1)
614
+ .describe("Human label for the cycle (e.g. 'FY27 H1 territory plan'). Shown in /control/cycles and every propose response."),
615
+ scenarioId: z
616
+ .string()
617
+ .optional()
618
+ .describe("Scenario to bind the cycle to. Defaults to capacity_config.active_scenario."),
619
+ allowMultipleOpen: z
620
+ .boolean()
621
+ .optional()
622
+ .describe("Default false → refuses if another open cycle exists. Pass true to open a parallel cycle anyway."),
623
+ branch: z
624
+ .string()
625
+ .optional()
626
+ .describe("Git branch to validate the scenario from. Default: main."),
627
+ }, safeTool(async (input) => trpcMutation("mcp.openCycle", input)));
628
+ }
597
629
  if (allowed.has("commit_cycle")) {
598
630
  server.tool("commit_cycle", [
599
- "Ops only. Phase 4.3 atomic cutover for directory-shape",
600
- "scenarios. Reads all approved rows across user / quota /",
601
- "account placement tables, promotes scenario inputs (territories,",
602
- "hierarchy, composition, account_placement) to canonical",
603
- "config/deploy/, writes assignments.yaml + quotas.yaml outputs,",
604
- "updates account.territory_slug for committed account placements,",
631
+ "Ops only. Atomic cutover for a planning cycle. Reads all",
632
+ "approved rows across user / quota / account placement tables,",
633
+ "promotes scenario inputs (territories, hierarchy, composition,",
634
+ "account_placement) to canonical config/deploy/, writes",
635
+ "assignments.yaml + quotas.yaml outputs, propagates",
636
+ "rep_input_override rows to the scenario roster, updates",
637
+ "account.territory_slug for committed account placements,",
605
638
  "transitions all rows to 'committed', closes the cycle. ONE",
606
639
  "GitHub commit + ONE DB transaction — either everything lands",
607
- "or nothing does. Force two-step (default dryRun:true). Refuses",
608
- "on legacy single-file scenarios; per-phase commits still work",
609
- "for those.",
640
+ "or nothing does. Force two-step (default dryRun:true).",
610
641
  ].join(" "), {
611
642
  planningCycleId: z.string().uuid().optional().describe("Planning cycle. Defaults to the org's currently-open cycle."),
612
643
  dryRun: z.boolean().optional().describe("Default true. Pass false to perform the atomic commit."),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loopops/mcp-server",
3
- "version": "3.34.0",
3
+ "version": "3.38.0",
4
4
  "description": "Loop Operations MCP Server — AI skills for RevOps",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",