@turbofy-ai/app-runtime 0.0.25 → 0.0.26

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/src/dsl.d.ts CHANGED
@@ -787,6 +787,17 @@ declare function blockTypeCopiesCode(): string;
787
787
  declare function blockConfigCode(blockTypeTableId: string): string;
788
788
  declare function blockNameCode(blockTypeTableId: string): string;
789
789
  declare function blockDynamicDataCode(blockTypeTableId: string): string;
790
+ declare const mcpServerDefinitionSchema: z.ZodObject<{
791
+ name: z.ZodString;
792
+ slug: z.ZodString;
793
+ description: z.ZodOptional<z.ZodString>;
794
+ handler: z.ZodObject<{
795
+ server: z.ZodObject<{
796
+ function: z.ZodString;
797
+ }, z.core.$strict>;
798
+ }, z.core.$strict>;
799
+ }, z.core.$strict>;
800
+ export type IMcpServerDefinition = z.infer<typeof mcpServerDefinitionSchema>;
790
801
  /** A JSON-serializable localization value. */
791
802
  export type LocalizationValue = string | number | boolean | null | LocalizationValue[] | {
792
803
  [key: string]: LocalizationValue;
@@ -2232,6 +2243,8 @@ declare const CLOUD_FUNCTION_REFERENCE_PREFIX = "cloud-function:";
2232
2243
  declare const validateCloudFunctionName: (name: string) => void;
2233
2244
  declare const buildFunction: (definition: ICloudFunctionDefinition) => ICloudFunctionDefinition;
2234
2245
  declare const ref: (name: string) => string;
2246
+ export type IMcpServerOptions = IMcpServerDefinition;
2247
+ declare const buildServer: (options: IMcpServerOptions) => IMcpServerDefinition;
2235
2248
  export interface IJsParam {
2236
2249
  readonly __flowParam: "js";
2237
2250
  readonly code: string;
@@ -2478,6 +2491,9 @@ declare namespace appBuilder {
2478
2491
  declare namespace cloudFunctionBuilder {
2479
2492
  export { CLOUD_FUNCTION_REFERENCE_PREFIX, CloudFunctionRuntime, ICloudFunctionDefinition, buildFunction, ref, validateCloudFunctionName };
2480
2493
  }
2494
+ declare namespace mcpServerBuilder {
2495
+ export { IMcpServerDefinition, IMcpServerOptions, buildServer };
2496
+ }
2481
2497
 
2482
2498
  export {
2483
2499
  appBuilder,
@@ -2485,6 +2501,7 @@ export {
2485
2501
  dataBuilder,
2486
2502
  flowBuilder,
2487
2503
  macros,
2504
+ mcpServerBuilder,
2488
2505
  };
2489
2506
 
2490
2507
  export {};
package/dist/src/dsl.js CHANGED
@@ -15055,6 +15055,59 @@ function build(schema) {
15055
15055
  return finalSchema;
15056
15056
  }
15057
15057
 
15058
+ // ../declarations/src/mcp-servers/definition.ts
15059
+ var MCP_SERVER_SLUG_PATTERN = /^[a-z][a-z0-9-]{2,39}$/;
15060
+ var MCP_SERVER_FUNCTION_NAME_PATTERN = /^[a-z][a-z0-9-]{0,47}$/;
15061
+ var RESERVED_MCP_SERVER_SLUGS = /* @__PURE__ */ new Set([
15062
+ "admin",
15063
+ "alpha",
15064
+ "api",
15065
+ "app",
15066
+ "auth",
15067
+ "beta",
15068
+ "cdn",
15069
+ "console",
15070
+ "dev",
15071
+ "docs",
15072
+ "help",
15073
+ "mail",
15074
+ "mcp",
15075
+ "prod",
15076
+ "staging",
15077
+ "status",
15078
+ "support",
15079
+ "turbofy",
15080
+ "www"
15081
+ ]);
15082
+ var slugSchema = external_exports.string().regex(
15083
+ MCP_SERVER_SLUG_PATTERN,
15084
+ "Slug must be 3 to 40 lowercase letters, digits or hyphens and start with a letter"
15085
+ ).refine((slug) => !slug.endsWith("-"), "Slug cannot end with a hyphen").refine(
15086
+ (slug) => !RESERVED_MCP_SERVER_SLUGS.has(slug),
15087
+ "This slug is reserved"
15088
+ );
15089
+ var serverHandlerSchema = external_exports.object({
15090
+ server: external_exports.object({
15091
+ function: external_exports.string().regex(
15092
+ MCP_SERVER_FUNCTION_NAME_PATTERN,
15093
+ "Function name must be lowercase letters, digits or hyphens and start with a letter"
15094
+ )
15095
+ }).strict()
15096
+ }).strict();
15097
+ var mcpServerDefinitionSchema = external_exports.object({
15098
+ name: external_exports.string().trim().min(1).max(80),
15099
+ slug: slugSchema,
15100
+ description: external_exports.string().max(500).optional(),
15101
+ handler: serverHandlerSchema
15102
+ }).strict();
15103
+ var validateMcpServerDefinition = (input) => {
15104
+ const result = mcpServerDefinitionSchema.safeParse(input);
15105
+ if (result.success) return [];
15106
+ return result.error.issues.map(
15107
+ (issue2) => issue2.path.length > 0 ? `${issue2.path.join(".")}: ${issue2.message}` : issue2.message
15108
+ );
15109
+ };
15110
+
15058
15111
  // ../declarations/src/flows/schemas/branch.schema.ts
15059
15112
  var branchSchema = {
15060
15113
  params: external_exports.object({
@@ -22671,6 +22724,22 @@ var ref2 = (name) => {
22671
22724
  return `${CLOUD_FUNCTION_REFERENCE_PREFIX}${name}`;
22672
22725
  };
22673
22726
 
22727
+ // ../dsl-builders/src/mcp-servers/mcp-server-builder.ts
22728
+ var mcp_server_builder_exports = {};
22729
+ __export(mcp_server_builder_exports, {
22730
+ buildServer: () => buildServer
22731
+ });
22732
+ var buildServer = (options) => {
22733
+ const errors = validateMcpServerDefinition(options);
22734
+ if (errors.length > 0) {
22735
+ throw new Error(
22736
+ `MCP server "${options.slug}" is invalid:
22737
+ - ${errors.join("\n- ")}`
22738
+ );
22739
+ }
22740
+ return mcpServerDefinitionSchema.parse(options);
22741
+ };
22742
+
22674
22743
  // ../dsl-builders/src/flows/flow-builder.ts
22675
22744
  var flow_builder_exports = {};
22676
22745
  __export(flow_builder_exports, {
@@ -23500,6 +23569,7 @@ export {
23500
23569
  dataSchemaDeclarationSchema,
23501
23570
  flow_builder_exports as flowBuilder,
23502
23571
  macros_exports as macros,
23572
+ mcp_server_builder_exports as mcpServerBuilder,
23503
23573
  validateFlow,
23504
23574
  validateFlowGraph,
23505
23575
  validateFlows
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turbofy-ai/app-runtime",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {