@enfyra/mcp-server 0.0.102 → 0.0.103

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@enfyra/mcp-server",
3
- "version": "0.0.102",
3
+ "version": "0.0.103",
4
4
  "description": "MCP server for Enfyra - manage Enfyra instances from MCP-compatible coding tools",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -493,9 +493,10 @@ async function resolveApiEndpointWorkflowState(apiUrl, opts) {
493
493
  const routeId = getId(route);
494
494
  const availableMethods = methodNamesFromRecords(route?.availableMethods || [], methodIdNameMap);
495
495
  const publicMethods = methodNamesFromRecords(route?.publicMethods || [], methodIdNameMap);
496
+ const methodAvailable = availableMethods.includes(methodName);
496
497
  const routeNeedsUpdate = !!route && (
497
498
  route.isEnabled === false
498
- || !availableMethods.includes(methodName)
499
+ || !methodAvailable
499
500
  || (access === 'public' && !publicMethods.includes(methodName))
500
501
  || (access === 'private' && publicMethods.includes(methodName))
501
502
  || (opts.description !== undefined && route.description !== opts.description)
@@ -549,8 +550,8 @@ async function resolveApiEndpointWorkflowState(apiUrl, opts) {
549
550
  handlerId: getId(handler),
550
551
  reason: handlerNeedsOverwrite && !opts.overwrite ? 'Existing handler differs. Re-run with overwrite=true to update it.' : undefined,
551
552
  })
552
- : step(route ? 'pending' : 'waiting', 'save_handler', 'Create route handler', {
553
- reason: route ? undefined : 'Route must exist first.',
553
+ : step(route && methodAvailable ? 'pending' : 'waiting', 'save_handler', 'Create route handler', {
554
+ reason: !route ? 'Route must exist first.' : methodAvailable ? undefined : 'Route method must be available first.',
554
555
  }),
555
556
  ];
556
557
 
@@ -725,25 +726,40 @@ async function applyApiEndpointWorkflowStep(apiUrl, state, opts, stepId) {
725
726
  async function runApiEndpointWorkflow(apiUrl, opts) {
726
727
  let state = await resolveApiEndpointWorkflowState(apiUrl, opts);
727
728
  const operations = [];
729
+ let completedEphemeralStepId = null;
728
730
  if (opts.apply || opts.applyAll) {
729
731
  const maxSteps = opts.applyAll ? 10 : 1;
730
732
  for (let i = 0; i < maxSteps; i += 1) {
731
733
  if (state.blocked || !state.firstRunnable) break;
732
734
  const operation = await applyApiEndpointWorkflowStep(apiUrl, state, opts, opts.stepId);
733
735
  operations.push(operation);
736
+ if (state.firstRunnable.id === 'smoke_test') {
737
+ completedEphemeralStepId = 'smoke_test';
738
+ break;
739
+ }
734
740
  if (!opts.applyAll) break;
735
741
  state = await resolveApiEndpointWorkflowState(apiUrl, opts);
736
742
  }
737
743
  }
738
744
  const latestState = operations.length ? await resolveApiEndpointWorkflowState(apiUrl, opts) : state;
745
+ const latestSteps = completedEphemeralStepId
746
+ ? latestState.steps.map((item) => (
747
+ item.id === completedEphemeralStepId
748
+ ? { ...item, status: 'completed', result: 'passed' }
749
+ : item
750
+ ))
751
+ : latestState.steps;
752
+ const nextSteps = completedEphemeralStepId
753
+ ? latestState.nextSteps.filter((item) => item.stepId !== completedEphemeralStepId)
754
+ : latestState.nextSteps;
739
755
  return {
740
756
  action: operations.length ? 'api_endpoint_workflow_advanced' : 'api_endpoint_workflow_planned',
741
757
  endpoint: latestState.endpoint,
742
758
  scriptValidation: latestState.scriptValidation,
743
- steps: latestState.steps,
759
+ steps: latestSteps,
744
760
  operations,
745
- complete: latestState.steps.every((item) => ['completed', 'skipped'].includes(item.status)),
746
- nextSteps: latestState.nextSteps,
761
+ complete: latestSteps.every((item) => ['completed', 'skipped'].includes(item.status)),
762
+ nextSteps,
747
763
  cleanupHints: latestState.endpoint.routeId
748
764
  ? [
749
765
  `Preview delete route handler with delete_record({ tableName: "enfyra_route_handler", id: ${JSON.stringify(latestState.endpoint.handlerId)} }) before cleanup.`,