skedyul 1.2.18 → 1.2.21

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/dist/cli/index.js CHANGED
@@ -2891,10 +2891,11 @@ function padEnd(str, length) {
2891
2891
  }
2892
2892
  return str + " ".repeat(length - str.length);
2893
2893
  }
2894
- function printStartupLog(config, tools, webhookRegistry, port) {
2894
+ function printStartupLog(config, tools, port) {
2895
2895
  if (process.env.NODE_ENV === "test") {
2896
2896
  return;
2897
2897
  }
2898
+ const webhookRegistry = config.webhooks;
2898
2899
  const webhookCount = webhookRegistry ? Object.keys(webhookRegistry).length : 0;
2899
2900
  const webhookNames = webhookRegistry ? Object.keys(webhookRegistry) : [];
2900
2901
  const maxRequests = config.maxRequests ?? parseNumberEnv(process.env.MCP_MAX_REQUESTS) ?? null;
@@ -2907,9 +2908,9 @@ function printStartupLog(config, tools, webhookRegistry, port) {
2907
2908
  console.log(`\u2551 \u{1F680} Skedyul MCP Server Starting \u2551`);
2908
2909
  console.log(`\u2560${divider}\u2563`);
2909
2910
  console.log(`\u2551 \u2551`);
2910
- console.log(`\u2551 \u{1F4E6} Server: ${padEnd(config.metadata.name, 49)}\u2551`);
2911
- console.log(`\u2551 \u{1F3F7}\uFE0F Version: ${padEnd(config.metadata.version, 49)}\u2551`);
2912
- console.log(`\u2551 \u26A1 Compute: ${padEnd(config.computeLayer, 49)}\u2551`);
2911
+ console.log(`\u2551 \u{1F4E6} Server: ${padEnd(config.name, 49)}\u2551`);
2912
+ console.log(`\u2551 \u{1F3F7}\uFE0F Version: ${padEnd(config.version ?? "N/A", 49)}\u2551`);
2913
+ console.log(`\u2551 \u26A1 Compute: ${padEnd(config.computeLayer ?? "serverless", 49)}\u2551`);
2913
2914
  if (port) {
2914
2915
  console.log(`\u2551 \u{1F310} Port: ${padEnd(String(port), 49)}\u2551`);
2915
2916
  }
@@ -2951,67 +2952,40 @@ function printStartupLog(config, tools, webhookRegistry, port) {
2951
2952
  console.log("");
2952
2953
  }
2953
2954
 
2954
- // src/config/resolve.ts
2955
- async function resolveDynamicImport(value) {
2956
- if (value === void 0 || value === null) {
2957
- return void 0;
2958
- }
2959
- if (value instanceof Promise) {
2960
- const resolved = await value;
2961
- if (resolved && typeof resolved === "object" && "default" in resolved) {
2962
- return resolved.default;
2963
- }
2964
- return resolved;
2965
- }
2966
- return value;
2967
- }
2968
- function serializeTools(registry) {
2969
- return Object.entries(registry).map(([key, tool]) => ({
2970
- name: tool.name || key,
2971
- displayName: tool.label,
2972
- description: tool.description,
2973
- timeout: tool.timeout,
2974
- retries: tool.retries
2975
- }));
2976
- }
2977
- function serializeWebhooks(registry) {
2978
- return Object.values(registry).map((webhook) => ({
2979
- name: webhook.name,
2980
- description: webhook.description,
2981
- methods: webhook.methods ?? ["POST"],
2982
- type: webhook.type ?? "WEBHOOK"
2983
- }));
2984
- }
2985
- async function resolveConfig(config, registry, webhookRegistry) {
2986
- const provision = await resolveDynamicImport(
2987
- config.provision
2988
- );
2989
- const install = await resolveDynamicImport(
2990
- config.install
2991
- );
2992
- const tools = serializeTools(registry);
2993
- const webhooks = webhookRegistry ? serializeWebhooks(webhookRegistry) : [];
2955
+ // src/server/config-serializer.ts
2956
+ function serializeConfig(config) {
2957
+ const registry = config.tools;
2958
+ const webhookRegistry = config.webhooks;
2994
2959
  return {
2995
2960
  name: config.name,
2996
2961
  version: config.version,
2997
2962
  description: config.description,
2998
2963
  computeLayer: config.computeLayer,
2999
- tools,
3000
- webhooks,
3001
- provision,
2964
+ tools: registry ? Object.entries(registry).map(([key, tool]) => ({
2965
+ name: tool.name || key,
2966
+ description: tool.description,
2967
+ timeout: tool.timeout,
2968
+ retries: tool.retries
2969
+ })) : [],
2970
+ webhooks: webhookRegistry ? Object.values(webhookRegistry).map((w) => ({
2971
+ name: w.name,
2972
+ description: w.description,
2973
+ methods: w.methods ?? ["POST"],
2974
+ type: w.type ?? "WEBHOOK"
2975
+ })) : [],
2976
+ provision: isProvisionConfig(config.provision) ? config.provision : void 0,
3002
2977
  agents: config.agents
3003
2978
  };
3004
2979
  }
3005
- function createMinimalConfig(name, version) {
3006
- return {
3007
- name,
3008
- version
3009
- };
2980
+ function isProvisionConfig(value) {
2981
+ return value !== void 0 && value !== null && !(value instanceof Promise);
3010
2982
  }
3011
2983
 
3012
2984
  // src/server/dedicated.ts
3013
- function createDedicatedServerInstance(config, tools, callTool, state, mcpServer, registry, webhookRegistry) {
2985
+ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer) {
3014
2986
  const port = getListeningPort(config);
2987
+ const registry = config.tools;
2988
+ const webhookRegistry = config.webhooks;
3015
2989
  const httpServer = import_http2.default.createServer(
3016
2990
  async (req, res) => {
3017
2991
  function sendCoreResult(result) {
@@ -3028,12 +3002,7 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
3028
3002
  return;
3029
3003
  }
3030
3004
  if (pathname === "/config" && req.method === "GET") {
3031
- const appConfig = config.appConfig ?? createMinimalConfig(
3032
- config.metadata.name,
3033
- config.metadata.version
3034
- );
3035
- const serializedConfig = await resolveConfig(appConfig, registry, webhookRegistry);
3036
- sendJSON(res, 200, serializedConfig);
3005
+ sendJSON(res, 200, serializeConfig(config));
3037
3006
  return;
3038
3007
  }
3039
3008
  if (pathname.startsWith("/webhooks/") && webhookRegistry) {
@@ -3562,7 +3531,7 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
3562
3531
  const finalPort = listenPort ?? port;
3563
3532
  return new Promise((resolve8, reject) => {
3564
3533
  httpServer.listen(finalPort, () => {
3565
- printStartupLog(config, tools, webhookRegistry, finalPort);
3534
+ printStartupLog(config, tools, finalPort);
3566
3535
  resolve8();
3567
3536
  });
3568
3537
  httpServer.once("error", reject);
@@ -3573,13 +3542,15 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
3573
3542
  }
3574
3543
 
3575
3544
  // src/server/serverless.ts
3576
- function createServerlessInstance(config, tools, callTool, state, mcpServer, registry, webhookRegistry) {
3545
+ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
3577
3546
  const headers = getDefaultHeaders(config.cors);
3547
+ const registry = config.tools;
3548
+ const webhookRegistry = config.webhooks;
3578
3549
  let hasLoggedStartup = false;
3579
3550
  return {
3580
3551
  async handler(event) {
3581
3552
  if (!hasLoggedStartup) {
3582
- printStartupLog(config, tools, webhookRegistry);
3553
+ printStartupLog(config, tools);
3583
3554
  hasLoggedStartup = true;
3584
3555
  }
3585
3556
  try {
@@ -4124,12 +4095,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer, reg
4124
4095
  return createResponse(200, state.getHealthStatus(), headers);
4125
4096
  }
4126
4097
  if (path14 === "/config" && method === "GET") {
4127
- const appConfig = config.appConfig ?? createMinimalConfig(
4128
- config.metadata.name,
4129
- config.metadata.version
4130
- );
4131
- const serializedConfig = await resolveConfig(appConfig, registry, webhookRegistry);
4132
- return createResponse(200, serializedConfig, headers);
4098
+ return createResponse(200, serializeConfig(config), headers);
4133
4099
  }
4134
4100
  if (path14 === "/mcp" && method === "POST") {
4135
4101
  let body;
@@ -4347,9 +4313,11 @@ console.log("[skedyul-node/server] All imports complete");
4347
4313
  console.log("[skedyul-node/server] Installing context logger...");
4348
4314
  installContextLogger();
4349
4315
  console.log("[skedyul-node/server] Context logger installed");
4350
- function createSkedyulServer(config, registry, webhookRegistry) {
4316
+ function createSkedyulServer(config) {
4351
4317
  console.log("[createSkedyulServer] Step 1: mergeRuntimeEnv()");
4352
4318
  mergeRuntimeEnv();
4319
+ const registry = config.tools;
4320
+ const webhookRegistry = config.webhooks;
4353
4321
  console.log("[createSkedyulServer] Step 2: coreApi setup");
4354
4322
  if (config.coreApi?.service) {
4355
4323
  coreApiService.register(config.coreApi.service);
@@ -4361,7 +4329,7 @@ function createSkedyulServer(config, registry, webhookRegistry) {
4361
4329
  const tools = buildToolMetadata(registry);
4362
4330
  console.log("[createSkedyulServer] Step 3 done, tools:", tools.length);
4363
4331
  const toolNames = Object.values(registry).map((tool) => tool.name);
4364
- const runtimeLabel = config.computeLayer;
4332
+ const runtimeLabel = config.computeLayer ?? "serverless";
4365
4333
  const maxRequests = config.maxRequests ?? parseNumberEnv(process.env.MCP_MAX_REQUESTS) ?? null;
4366
4334
  const ttlExtendSeconds = config.ttlExtendSeconds ?? parseNumberEnv(process.env.MCP_TTL_EXTEND) ?? 3600;
4367
4335
  console.log("[createSkedyulServer] Step 4: createRequestState()");
@@ -4374,8 +4342,8 @@ function createSkedyulServer(config, registry, webhookRegistry) {
4374
4342
  console.log("[createSkedyulServer] Step 4 done");
4375
4343
  console.log("[createSkedyulServer] Step 5: new McpServer()");
4376
4344
  const mcpServer = new import_mcp.McpServer({
4377
- name: config.metadata.name,
4378
- version: config.metadata.version
4345
+ name: config.name,
4346
+ version: config.version ?? "0.0.0"
4379
4347
  });
4380
4348
  console.log("[createSkedyulServer] Step 5 done");
4381
4349
  const dedicatedShutdown = () => {
@@ -4503,13 +4471,11 @@ function createSkedyulServer(config, registry, webhookRegistry) {
4503
4471
  tools,
4504
4472
  callTool,
4505
4473
  state,
4506
- mcpServer,
4507
- registry,
4508
- webhookRegistry
4474
+ mcpServer
4509
4475
  );
4510
4476
  }
4511
4477
  console.log("[createSkedyulServer] Creating serverless instance");
4512
- const serverlessInstance = createServerlessInstance(config, tools, callTool, state, mcpServer, registry, webhookRegistry);
4478
+ const serverlessInstance = createServerlessInstance(config, tools, callTool, state, mcpServer);
4513
4479
  console.log("[createSkedyulServer] Serverless instance created successfully");
4514
4480
  return serverlessInstance;
4515
4481
  }
@@ -4908,18 +4874,14 @@ Built config for sync:`);
4908
4874
  } catch (error) {
4909
4875
  console.warn(`Could not load install handler: ${error instanceof Error ? error.message : String(error)}`);
4910
4876
  }
4911
- const server2 = createSkedyulServer(
4912
- {
4913
- computeLayer: "dedicated",
4914
- metadata: {
4915
- name: serverName,
4916
- version: serverVersion
4917
- },
4918
- defaultPort: port,
4919
- hooks: installHandler ? { install: installHandler } : void 0
4920
- },
4921
- registry
4922
- );
4877
+ const server2 = createSkedyulServer({
4878
+ name: serverName,
4879
+ version: serverVersion,
4880
+ computeLayer: "dedicated",
4881
+ defaultPort: port,
4882
+ tools: registry,
4883
+ hooks: installHandler ? { install: installHandler } : void 0
4884
+ });
4923
4885
  const dedicatedServer = server2;
4924
4886
  try {
4925
4887
  await dedicatedServer.listen(port);
@@ -4,6 +4,8 @@
4
4
  * This module defines the main configuration interfaces for Skedyul apps.
5
5
  */
6
6
  import type { ToolRegistry, WebhookRegistry, ToolMetadata, WebhookMetadata } from '../types';
7
+ import type { ServerHooks } from '../types/handlers';
8
+ import type { CoreApiConfig } from '../core/types';
7
9
  import type { EnvSchema, ComputeLayer, ModelDefinition, RelationshipDefinition, ChannelDefinition, WorkflowDefinition, PageDefinition, NavigationConfig, AgentDefinition } from './types';
8
10
  /**
9
11
  * Install configuration - defines per-install env vars and SHARED models.
@@ -44,8 +46,18 @@ export interface BuildConfig {
44
46
  /** External dependencies to exclude from bundling (e.g., ['twilio', 'stripe']) */
45
47
  external?: string[];
46
48
  }
49
+ /**
50
+ * CORS configuration options.
51
+ */
52
+ export interface CorsOptions {
53
+ allowOrigin?: string;
54
+ allowMethods?: string;
55
+ allowHeaders?: string;
56
+ }
47
57
  /**
48
58
  * Main Skedyul app configuration.
59
+ * This is the unified config type used for both declarative config (skedyul.config.ts)
60
+ * and runtime server creation (server.create()).
49
61
  */
50
62
  export interface SkedyulConfig {
51
63
  /** App name */
@@ -56,8 +68,16 @@ export interface SkedyulConfig {
56
68
  description?: string;
57
69
  /** Compute layer: 'serverless' (Lambda) or 'dedicated' (ECS/Docker) */
58
70
  computeLayer?: ComputeLayer;
59
- /** Build configuration for the integration */
60
- build?: BuildConfig;
71
+ /** Default port for dedicated mode HTTP server */
72
+ defaultPort?: number;
73
+ /** Maximum requests before shutdown (serverless mode) */
74
+ maxRequests?: number | null;
75
+ /** TTL extension in seconds */
76
+ ttlExtendSeconds?: number;
77
+ /** CORS configuration */
78
+ cors?: CorsOptions;
79
+ /** Core API configuration */
80
+ coreApi?: CoreApiConfig;
61
81
  /** Tool registry - direct object or dynamic import */
62
82
  tools?: ToolRegistry | Promise<{
63
83
  toolRegistry: ToolRegistry;
@@ -66,6 +86,8 @@ export interface SkedyulConfig {
66
86
  webhooks?: WebhookRegistry | Promise<{
67
87
  webhookRegistry: WebhookRegistry;
68
88
  }>;
89
+ /** Lifecycle hooks for install, provision, uninstall, and oauth_callback */
90
+ hooks?: ServerHooks;
69
91
  /** Provision configuration - direct object or dynamic import */
70
92
  provision?: ProvisionConfig | Promise<{
71
93
  default: ProvisionConfig;
@@ -76,6 +98,8 @@ export interface SkedyulConfig {
76
98
  }>;
77
99
  /** Agent definitions - multi-tenant agents with tool bindings */
78
100
  agents?: AgentDefinition[];
101
+ /** Build configuration for the integration */
102
+ build?: BuildConfig;
79
103
  }
80
104
  /**
81
105
  * Serializable config (for database storage).
@@ -9,9 +9,8 @@
9
9
  * - All definition types extend BaseDefinition
10
10
  */
11
11
  export * from './types';
12
- export type { InstallConfig, ProvisionConfig, BuildConfig, SkedyulConfig, SerializableSkedyulConfig, } from './app-config';
12
+ export type { InstallConfig, ProvisionConfig, BuildConfig, CorsOptions, SkedyulConfig, SerializableSkedyulConfig, } from './app-config';
13
13
  export { defineConfig } from './app-config';
14
14
  export { defineModel, defineChannel, definePage, defineWorkflow, defineAgent, defineEnv, defineNavigation, } from './define';
15
15
  export { CONFIG_FILE_NAMES, loadConfig, validateConfig } from './loader';
16
- export { resolveConfig, createMinimalConfig } from './resolve';
17
16
  export { getAllEnvKeys, getRequiredInstallEnvKeys } from './utils';
@@ -709,10 +709,11 @@ function padEnd(str, length) {
709
709
  }
710
710
  return str + " ".repeat(length - str.length);
711
711
  }
712
- function printStartupLog(config, tools, webhookRegistry, port) {
712
+ function printStartupLog(config, tools, port) {
713
713
  if (process.env.NODE_ENV === "test") {
714
714
  return;
715
715
  }
716
+ const webhookRegistry = config.webhooks;
716
717
  const webhookCount = webhookRegistry ? Object.keys(webhookRegistry).length : 0;
717
718
  const webhookNames = webhookRegistry ? Object.keys(webhookRegistry) : [];
718
719
  const maxRequests = config.maxRequests ?? parseNumberEnv(process.env.MCP_MAX_REQUESTS) ?? null;
@@ -725,9 +726,9 @@ function printStartupLog(config, tools, webhookRegistry, port) {
725
726
  console.log(`\u2551 \u{1F680} Skedyul MCP Server Starting \u2551`);
726
727
  console.log(`\u2560${divider}\u2563`);
727
728
  console.log(`\u2551 \u2551`);
728
- console.log(`\u2551 \u{1F4E6} Server: ${padEnd(config.metadata.name, 49)}\u2551`);
729
- console.log(`\u2551 \u{1F3F7}\uFE0F Version: ${padEnd(config.metadata.version, 49)}\u2551`);
730
- console.log(`\u2551 \u26A1 Compute: ${padEnd(config.computeLayer, 49)}\u2551`);
729
+ console.log(`\u2551 \u{1F4E6} Server: ${padEnd(config.name, 49)}\u2551`);
730
+ console.log(`\u2551 \u{1F3F7}\uFE0F Version: ${padEnd(config.version ?? "N/A", 49)}\u2551`);
731
+ console.log(`\u2551 \u26A1 Compute: ${padEnd(config.computeLayer ?? "serverless", 49)}\u2551`);
731
732
  if (port) {
732
733
  console.log(`\u2551 \u{1F310} Port: ${padEnd(String(port), 49)}\u2551`);
733
734
  }
@@ -769,67 +770,40 @@ function printStartupLog(config, tools, webhookRegistry, port) {
769
770
  console.log("");
770
771
  }
771
772
 
772
- // src/config/resolve.ts
773
- async function resolveDynamicImport(value) {
774
- if (value === void 0 || value === null) {
775
- return void 0;
776
- }
777
- if (value instanceof Promise) {
778
- const resolved = await value;
779
- if (resolved && typeof resolved === "object" && "default" in resolved) {
780
- return resolved.default;
781
- }
782
- return resolved;
783
- }
784
- return value;
785
- }
786
- function serializeTools(registry) {
787
- return Object.entries(registry).map(([key, tool]) => ({
788
- name: tool.name || key,
789
- displayName: tool.label,
790
- description: tool.description,
791
- timeout: tool.timeout,
792
- retries: tool.retries
793
- }));
794
- }
795
- function serializeWebhooks(registry) {
796
- return Object.values(registry).map((webhook) => ({
797
- name: webhook.name,
798
- description: webhook.description,
799
- methods: webhook.methods ?? ["POST"],
800
- type: webhook.type ?? "WEBHOOK"
801
- }));
802
- }
803
- async function resolveConfig(config, registry, webhookRegistry) {
804
- const provision = await resolveDynamicImport(
805
- config.provision
806
- );
807
- const install = await resolveDynamicImport(
808
- config.install
809
- );
810
- const tools = serializeTools(registry);
811
- const webhooks = webhookRegistry ? serializeWebhooks(webhookRegistry) : [];
773
+ // src/server/config-serializer.ts
774
+ function serializeConfig(config) {
775
+ const registry = config.tools;
776
+ const webhookRegistry = config.webhooks;
812
777
  return {
813
778
  name: config.name,
814
779
  version: config.version,
815
780
  description: config.description,
816
781
  computeLayer: config.computeLayer,
817
- tools,
818
- webhooks,
819
- provision,
782
+ tools: registry ? Object.entries(registry).map(([key, tool]) => ({
783
+ name: tool.name || key,
784
+ description: tool.description,
785
+ timeout: tool.timeout,
786
+ retries: tool.retries
787
+ })) : [],
788
+ webhooks: webhookRegistry ? Object.values(webhookRegistry).map((w) => ({
789
+ name: w.name,
790
+ description: w.description,
791
+ methods: w.methods ?? ["POST"],
792
+ type: w.type ?? "WEBHOOK"
793
+ })) : [],
794
+ provision: isProvisionConfig(config.provision) ? config.provision : void 0,
820
795
  agents: config.agents
821
796
  };
822
797
  }
823
- function createMinimalConfig(name, version) {
824
- return {
825
- name,
826
- version
827
- };
798
+ function isProvisionConfig(value) {
799
+ return value !== void 0 && value !== null && !(value instanceof Promise);
828
800
  }
829
801
 
830
802
  // src/server/dedicated.ts
831
- function createDedicatedServerInstance(config, tools, callTool, state, mcpServer, registry, webhookRegistry) {
803
+ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer) {
832
804
  const port = getListeningPort(config);
805
+ const registry = config.tools;
806
+ const webhookRegistry = config.webhooks;
833
807
  const httpServer = import_http2.default.createServer(
834
808
  async (req, res) => {
835
809
  function sendCoreResult(result) {
@@ -846,12 +820,7 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
846
820
  return;
847
821
  }
848
822
  if (pathname === "/config" && req.method === "GET") {
849
- const appConfig = config.appConfig ?? createMinimalConfig(
850
- config.metadata.name,
851
- config.metadata.version
852
- );
853
- const serializedConfig = await resolveConfig(appConfig, registry, webhookRegistry);
854
- sendJSON(res, 200, serializedConfig);
823
+ sendJSON(res, 200, serializeConfig(config));
855
824
  return;
856
825
  }
857
826
  if (pathname.startsWith("/webhooks/") && webhookRegistry) {
@@ -1380,7 +1349,7 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
1380
1349
  const finalPort = listenPort ?? port;
1381
1350
  return new Promise((resolve, reject) => {
1382
1351
  httpServer.listen(finalPort, () => {
1383
- printStartupLog(config, tools, webhookRegistry, finalPort);
1352
+ printStartupLog(config, tools, finalPort);
1384
1353
  resolve();
1385
1354
  });
1386
1355
  httpServer.once("error", reject);
@@ -1391,13 +1360,15 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
1391
1360
  }
1392
1361
 
1393
1362
  // src/server/serverless.ts
1394
- function createServerlessInstance(config, tools, callTool, state, mcpServer, registry, webhookRegistry) {
1363
+ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
1395
1364
  const headers = getDefaultHeaders(config.cors);
1365
+ const registry = config.tools;
1366
+ const webhookRegistry = config.webhooks;
1396
1367
  let hasLoggedStartup = false;
1397
1368
  return {
1398
1369
  async handler(event) {
1399
1370
  if (!hasLoggedStartup) {
1400
- printStartupLog(config, tools, webhookRegistry);
1371
+ printStartupLog(config, tools);
1401
1372
  hasLoggedStartup = true;
1402
1373
  }
1403
1374
  try {
@@ -1942,12 +1913,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer, reg
1942
1913
  return createResponse(200, state.getHealthStatus(), headers);
1943
1914
  }
1944
1915
  if (path === "/config" && method === "GET") {
1945
- const appConfig = config.appConfig ?? createMinimalConfig(
1946
- config.metadata.name,
1947
- config.metadata.version
1948
- );
1949
- const serializedConfig = await resolveConfig(appConfig, registry, webhookRegistry);
1950
- return createResponse(200, serializedConfig, headers);
1916
+ return createResponse(200, serializeConfig(config), headers);
1951
1917
  }
1952
1918
  if (path === "/mcp" && method === "POST") {
1953
1919
  let body;
@@ -2165,9 +2131,11 @@ console.log("[skedyul-node/server] All imports complete");
2165
2131
  console.log("[skedyul-node/server] Installing context logger...");
2166
2132
  installContextLogger();
2167
2133
  console.log("[skedyul-node/server] Context logger installed");
2168
- function createSkedyulServer(config, registry, webhookRegistry) {
2134
+ function createSkedyulServer(config) {
2169
2135
  console.log("[createSkedyulServer] Step 1: mergeRuntimeEnv()");
2170
2136
  mergeRuntimeEnv();
2137
+ const registry = config.tools;
2138
+ const webhookRegistry = config.webhooks;
2171
2139
  console.log("[createSkedyulServer] Step 2: coreApi setup");
2172
2140
  if (config.coreApi?.service) {
2173
2141
  coreApiService.register(config.coreApi.service);
@@ -2179,7 +2147,7 @@ function createSkedyulServer(config, registry, webhookRegistry) {
2179
2147
  const tools = buildToolMetadata(registry);
2180
2148
  console.log("[createSkedyulServer] Step 3 done, tools:", tools.length);
2181
2149
  const toolNames = Object.values(registry).map((tool) => tool.name);
2182
- const runtimeLabel = config.computeLayer;
2150
+ const runtimeLabel = config.computeLayer ?? "serverless";
2183
2151
  const maxRequests = config.maxRequests ?? parseNumberEnv(process.env.MCP_MAX_REQUESTS) ?? null;
2184
2152
  const ttlExtendSeconds = config.ttlExtendSeconds ?? parseNumberEnv(process.env.MCP_TTL_EXTEND) ?? 3600;
2185
2153
  console.log("[createSkedyulServer] Step 4: createRequestState()");
@@ -2192,8 +2160,8 @@ function createSkedyulServer(config, registry, webhookRegistry) {
2192
2160
  console.log("[createSkedyulServer] Step 4 done");
2193
2161
  console.log("[createSkedyulServer] Step 5: new McpServer()");
2194
2162
  const mcpServer = new import_mcp.McpServer({
2195
- name: config.metadata.name,
2196
- version: config.metadata.version
2163
+ name: config.name,
2164
+ version: config.version ?? "0.0.0"
2197
2165
  });
2198
2166
  console.log("[createSkedyulServer] Step 5 done");
2199
2167
  const dedicatedShutdown = () => {
@@ -2321,13 +2289,11 @@ function createSkedyulServer(config, registry, webhookRegistry) {
2321
2289
  tools,
2322
2290
  callTool,
2323
2291
  state,
2324
- mcpServer,
2325
- registry,
2326
- webhookRegistry
2292
+ mcpServer
2327
2293
  );
2328
2294
  }
2329
2295
  console.log("[createSkedyulServer] Creating serverless instance");
2330
- const serverlessInstance = createServerlessInstance(config, tools, callTool, state, mcpServer, registry, webhookRegistry);
2296
+ const serverlessInstance = createServerlessInstance(config, tools, callTool, state, mcpServer);
2331
2297
  console.log("[createSkedyulServer] Serverless instance created successfully");
2332
2298
  return serverlessInstance;
2333
2299
  }