@alpic-ai/api 0.0.0-staging.08d1720 → 0.0.0-staging.09784ec

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.
Files changed (3) hide show
  1. package/dist/index.d.mts +674 -21
  2. package/dist/index.mjs +739 -17
  3. package/package.json +24 -10
package/dist/index.mjs CHANGED
@@ -1,6 +1,296 @@
1
- import { oc } from "@orpc/contract";
2
1
  import { z } from "zod";
2
+ import { oc } from "@orpc/contract";
3
+ import ms from "ms";
4
+ const platformSchema = z.enum(["chatgpt", "claudeai"]);
5
+ const PLATFORM_LABELS = {
6
+ chatgpt: "ChatGPT",
7
+ claudeai: "Claude.ai"
8
+ };
9
+ const auditStatusSchema = z.enum([
10
+ "pending",
11
+ "partial",
12
+ "completed",
13
+ "failed"
14
+ ]);
15
+ const checkSeveritySchema = z.enum([
16
+ "error",
17
+ "warning",
18
+ "info"
19
+ ]);
20
+ const checkCategorySchema = z.enum([
21
+ "connectivity",
22
+ "tool-metadata",
23
+ "resource-metadata",
24
+ "performance",
25
+ "e2e"
26
+ ]);
27
+ const checkScopeSchema = z.enum(["server", "view"]);
28
+ const checkDetailSchema = z.object({
29
+ label: z.string(),
30
+ value: z.string().optional()
31
+ });
32
+ const checkResultSchema = z.object({
33
+ checkId: z.string(),
34
+ checkName: z.string(),
35
+ description: z.string(),
36
+ status: z.enum([
37
+ "pass",
38
+ "fail",
39
+ "skip",
40
+ "pending"
41
+ ]),
42
+ message: z.string(),
43
+ skipReason: z.string().optional(),
44
+ severity: checkSeveritySchema,
45
+ category: checkCategorySchema,
46
+ scope: checkScopeSchema,
47
+ platforms: z.array(platformSchema).readonly().optional(),
48
+ durationMs: z.number(),
49
+ details: z.array(checkDetailSchema).optional(),
50
+ hint: z.object({ text: z.string() }).optional()
51
+ });
52
+ const auditReportSchema = z.object({
53
+ schemaVersion: z.string(),
54
+ auditId: z.string(),
55
+ targetUrl: z.string(),
56
+ startedAt: z.string(),
57
+ completedAt: z.string(),
58
+ durationMs: z.number(),
59
+ results: z.array(checkResultSchema),
60
+ requiresAuth: z.boolean(),
61
+ hasViewSupport: z.boolean(),
62
+ viewPlatforms: z.array(platformSchema).readonly().optional(),
63
+ isReadyForPlatform: z.record(platformSchema, z.boolean()),
64
+ widgetScreenshotKeys: z.object({
65
+ chatgpt: z.string().optional(),
66
+ claudeai: z.string().optional()
67
+ })
68
+ });
69
+ const widgetScreenshotSchema = z.object({ url: z.string() });
70
+ const auditReportWithScreenshotsSchema = auditReportSchema.extend({ widgetScreenshots: z.object({
71
+ chatgpt: widgetScreenshotSchema.optional(),
72
+ claudeai: widgetScreenshotSchema.optional()
73
+ }) });
74
+ z.object({
75
+ id: z.string(),
76
+ createdAt: z.coerce.date(),
77
+ environmentId: z.string(),
78
+ content: z.string(),
79
+ source: z.enum(["model", "user"])
80
+ });
81
+ z.object({
82
+ content: z.string(),
83
+ source: z.enum(["model", "user"])
84
+ });
85
+ const toolDefinitionSchema = z.object({
86
+ name: z.string(),
87
+ title: z.string().optional(),
88
+ description: z.string().optional(),
89
+ annotations: z.object({
90
+ readOnlyHint: z.boolean().optional(),
91
+ destructiveHint: z.boolean().optional(),
92
+ openWorldHint: z.boolean().optional(),
93
+ idempotentHint: z.boolean().optional()
94
+ }).optional()
95
+ });
96
+ const positiveTestCaseSchema = z.object({
97
+ scenario: z.string(),
98
+ userPrompt: z.string(),
99
+ toolTriggered: z.string().optional(),
100
+ expectedOutput: z.string().optional()
101
+ }).partial().describe("Each case: Scenario, User prompt, Tool triggered, Expected output.");
102
+ /** Accepts either a valid email or URL. */
103
+ const supportChannelSchema = z.string().refine((value) => z.email().safeParse(value).success || z.url().safeParse(value).success, { error: "Must be a valid email or URL" });
104
+ const chatgptCategorySchema = z.enum([
105
+ "BUSINESS",
106
+ "COLLABORATION",
107
+ "DESIGN",
108
+ "DEVELOPER_TOOLS",
109
+ "EDUCATION",
110
+ "ENTERTAINMENT",
111
+ "FINANCE",
112
+ "FOOD",
113
+ "LIFESTYLE",
114
+ "NEWS",
115
+ "PRODUCTIVITY",
116
+ "SHOPPING",
117
+ "TRAVEL"
118
+ ]);
119
+ const chatgptAuthenticationSchema = z.enum(["No auth needed", "OAuth 2.0"]);
120
+ const chatgptAllowedCountriesSchema = z.enum(["Allow all", "Restrict to specific countries"]);
121
+ const negativeTestCaseSchema = z.object({
122
+ scenario: z.string(),
123
+ userPrompt: z.string()
124
+ }).partial().describe("Each case: Scenario + User prompt (the app should NOT trigger).");
125
+ const chatgptToolJustificationSchema = z.object({
126
+ toolName: z.string(),
127
+ readOnlyJustification: z.string(),
128
+ openWorldJustification: z.string(),
129
+ destructiveJustification: z.string()
130
+ }).describe("Per-tool justification of each MCP annotation value (one sentence per hint).");
131
+ const chatgptTranslationSchema = z.object({
132
+ locale: z.string(),
133
+ tagline: z.string().optional(),
134
+ description: z.string().optional()
135
+ }).describe("Locale-scoped override for tagline + description. English (US) is the default.");
136
+ /**
137
+ * Field order mirrors the ChatGPT (OpenAI) submission spreadsheet, grouped by section.
138
+ * When adding/removing/reordering fields, keep this in sync with the sheet.
139
+ */
140
+ const chatgptSubmissionFormDataSchema = z.object({
141
+ logoLight: z.string().describe("Logo icon for light mode. Square PNG, no borders or rounded corners (clients apply circular cropping)."),
142
+ logoDark: z.string().describe("Logo icon for dark mode. Square PNG. Same specs as the light icon."),
143
+ appName: z.string().describe("The name users will see in ChatGPT and in the Apps Directory."),
144
+ tagline: z.string().max(30).describe("Plain-language phrase focused on function and user value. 30 chars max."),
145
+ description: z.string().describe("Clear, engaging description highlighting what the app does and why people will love it. Appears publicly on the directory page."),
146
+ category: chatgptCategorySchema.describe("Category from the OpenAI taxonomy."),
147
+ developerName: z.string().describe("Developer name shown publicly on the app's directory page."),
148
+ companyUrl: z.url().describe("Your company's main website URL."),
149
+ supportChannel: supportChannelSchema.describe("Customer support URL or email address."),
150
+ privacyPolicyUrl: z.url().describe("URL to your privacy policy."),
151
+ termsOfServiceUrl: z.url().describe("URL to the app's terms of service."),
152
+ demoRecordingUrl: z.url().describe("URL to a video demonstrating the app, recorded via OpenAI Developer Mode. Cover all main use cases on web, iOS, and Android."),
153
+ appCommerceAndPurchasing: z.boolean().describe("Checkbox: 'My app links or directs users out of ChatGPT to make purchases.' Defaults to false. Verify the app does not offer digital goods."),
154
+ serverUrl: z.url().describe("URL of the MCP server."),
155
+ authentication: chatgptAuthenticationSchema.describe("OAuth 2.0 or No auth. OAuth configuration is auto-discovered from the MCP server's metadata."),
156
+ tools: z.array(toolDefinitionSchema).describe("List of tools exposed by the MCP server (auto-populated from the production server's manifest)."),
157
+ toolJustifications: z.array(chatgptToolJustificationSchema).describe("Per-tool justification of `readOnlyHint`, `openWorldHint`, and `destructiveHint` annotation values."),
158
+ testCases: z.array(positiveTestCaseSchema).describe("At least 5 positive test cases. Each: Scenario, User prompt, Tool triggered, Expected output. Coverage over all major use cases."),
159
+ negativeTestCases: z.array(negativeTestCaseSchema).describe("3 negative test cases — prompts where the app should NOT trigger but the model might think it's relevant."),
160
+ screenshots: z.array(z.url()).describe("URLs of in-app screenshots. Widget apps must show the widget UI; non-widget apps show the model response. Min 1, max 4. First three are public."),
161
+ translations: z.array(chatgptTranslationSchema).describe("Per-locale translation of tagline + description. English (US) is the default."),
162
+ allowedCountries: chatgptAllowedCountriesSchema.describe("'Allow all' or restrict to a specific list. See OpenAI's supported countries list."),
163
+ releaseNotes: z.string().describe("Publicly displayed on the app details page.")
164
+ });
165
+ chatgptSubmissionFormDataSchema.pick({
166
+ appName: true,
167
+ developerName: true,
168
+ serverUrl: true,
169
+ tools: true,
170
+ authentication: true
171
+ }).partial();
172
+ const claudeCategorySchema = z.enum([
173
+ "Business & Productivity",
174
+ "Communication",
175
+ "Data & Analytics",
176
+ "Development tools",
177
+ "Financial Services",
178
+ "Consumer Health",
179
+ "Health & Life Sciences",
180
+ "Media & Entertainment",
181
+ "Commerce & Shopping"
182
+ ]);
183
+ z.enum([
184
+ "No auth needed",
185
+ "OAuth 2.0",
186
+ "Custom URL"
187
+ ]);
188
+ const claudeMcpUrlTypeSchema = z.enum(["Universal URL", "Custom MCP URLs"]);
189
+ z.enum(["Static OAuth Client", "Dynamic OAuth Client (DCR / CIMD)"]);
190
+ const claudeReadWriteCapabilitiesSchema = z.enum([
191
+ "Read only",
192
+ "Write only",
193
+ "Read + write"
194
+ ]);
195
+ const claudeTransportSchema = z.enum(["Streamable HTTP", "SSE"]);
196
+ const claudeThirdPartySchema = z.enum([
197
+ "Web access (open web fetch / scraping / arbitrary URLs)",
198
+ "Third-party AI model integration",
199
+ "Third-party data retrieval (via workflow / aggregator)",
200
+ "Third-party data modification (via workflow / aggregator)",
201
+ "N/A"
202
+ ]);
203
+ const claudeDataHandlingSchema = z.enum([
204
+ "Server only accesses data explicitly requested by user",
205
+ "No data is stored beyond session requirements",
206
+ "Data transmission is encrypted (HTTPS / TLS)",
207
+ "GDPR compliant (if applicable)"
208
+ ]);
209
+ const claudeSponsoredContentSchema = z.enum([
210
+ "No, there is no sponsored content or advertisements",
211
+ "Yes, there are banner ads or other paid visual elements",
212
+ "Yes, returned content or ranking is impacted by sponsorship or ad placement"
213
+ ]);
214
+ /**
215
+ * Field order mirrors the Claude (Anthropic) submission spreadsheet, grouped by section.
216
+ * When adding/removing/reordering fields, keep this in sync with the sheet.
217
+ */
218
+ const claudeSubmissionFormDataSchema = z.object({
219
+ companyName: z.string().describe("Enter your company's legal name or the name under which your product is publicly known. This is used for internal tracking and may appear in directory listings."),
220
+ companyUrl: z.url().describe("Your company's main website URL, e.g. https://mycompany.com. Must be a valid URL with https://. This should be the root domain of the company behind this MCP server."),
221
+ primaryContactName: z.string().describe("Full name of the person Anthropic should contact about this submission. This person will receive review feedback, approval notices, and any follow-up questions."),
222
+ primaryContactEmail: z.email().describe("Business email for the primary contact. Must be a valid email address. Anthropic uses this to communicate about your submission status, required changes, and post-listing issues. Avoid using personal email addresses."),
223
+ primaryContactRole: z.string().optional().describe("The job title or role of the primary contact (e.g. 'CTO', 'Developer Relations Lead', 'Founder'). Optional but helps Anthropic route questions to the right person."),
224
+ anthropicPointOfContact: z.string().optional().describe("If you have a direct contact at Anthropic (e.g. from a partnership or sales conversation), enter their name here. This is optional but can greatly help expedite the review process. Leave blank if you don't have one."),
225
+ appName: z.string().describe(`The public display name for your connector as it will appear in the Connectors Directory.
3
226
 
227
+ Rules:
228
+ (1) Do NOT include the words 'MCP' or 'Server' — these are auto-rejected.
229
+ (2) Use your brand/product name, e.g. 'Notion', 'Linear', 'Slack'.
230
+ (3) You must own or have the right to use this brand name. For example, don't call it 'Google Drive Helper' if you're not Google.`),
231
+ mcpUrlType: claudeMcpUrlTypeSchema.describe("Universal URL = one URL serves all users. Custom MCP URLs = signup URL + regex matching per-user URLs."),
232
+ serverUrl: z.url().describe("Production MCP server URL (https). Derived from the project's production environment by default."),
233
+ tagline: z.string().max(55).describe("Short blurb shown below the server name. 55 chars max."),
234
+ description: z.string().describe("50–100 words describing what the server does and its key capabilities. Lives on the directory listing."),
235
+ testCases: z.array(positiveTestCaseSchema).describe("At least 3 use cases with example prompts showing the value of the connector."),
236
+ connectionRequirements: z.string().describe(`Prerequisites before connecting:
237
+ • Free/premium account
238
+ • Admin seat
239
+ • Geographic availability
240
+ • Custom instance URL
241
+
242
+ State 'No special requirements.' if none.`),
243
+ readWriteCapabilities: claudeReadWriteCapabilitiesSchema.describe("Inferred from the `readOnlyHint` annotations on the MCP tools."),
244
+ isMcpApp: z.boolean().describe("True if the server exposes interactive UI elements (widgets). Inferred from the MCP connection."),
245
+ thirdPartyConnectionsAndWebAccess: z.array(claudeThirdPartySchema).describe("Multi-select of what the server reaches out to (web, third-party AI, data aggregators)."),
246
+ dataHandling: z.array(claudeDataHandlingSchema).describe("Multi-select of data-handling practices that accurately describe the server. Cannot be inferred — user must self-declare."),
247
+ personalDataHealthAccess: z.boolean().describe("True only if the connector gives users access to their own personal health data (medical records, lab results, health metrics)."),
248
+ categories: z.array(claudeCategorySchema).describe("Multi-select of categories that best describe the server in the directory."),
249
+ sponsoredContentsOrAdvertisement: claudeSponsoredContentSchema.describe("Disclose paid promotion or sponsored content. Cannot be filled by Alpic — user must self-declare."),
250
+ transportSupport: z.array(claudeTransportSchema).describe("Multi-select of transport protocols the server supports. Anthropic recommends Streamable HTTP (SSE may be deprecated later this year)."),
251
+ serverDocumentationLink: z.url().describe("Public docs URL covering what the MCP does, setup, debugging, and self-serve support. The Alpic playground may be used."),
252
+ privacyPolicyUrl: z.url().describe("URL to your privacy policy. Mandatory and displayed alongside the directory listing."),
253
+ supportChannel: supportChannelSchema.describe("Link or email for user support (help center, GitHub issues, docs, support@…). Displayed alongside the directory listing."),
254
+ testingCredentials: z.string().describe("Credentials for reviewers to verify functionality. Required if the server uses OAuth. No 2FA. Use mcp-review@anthropic.com if an accessible email is needed."),
255
+ tools: z.array(toolDefinitionSchema).describe("List of tools exposed by the MCP server (auto-populated from the production server's manifest)."),
256
+ toolTitlesAnnotationsConfirmed: z.boolean().describe("Confirmation that all tools have user-friendly titles and accurate annotations (readOnlyHint, destructiveHint, …)."),
257
+ logoLight: z.string().describe("Server/app logo for light mode. Square 1:1 aspect ratio. SVG preferred for Claude."),
258
+ screenshots: z.array(z.url()).describe("URLs of screenshots of the connector on Claude.ai or promo material. 3–5 ideal. ≥1000px width preferred, PNG, cropped to the app response. Videos welcome.")
259
+ });
260
+ claudeSubmissionFormDataSchema.pick({
261
+ companyName: true,
262
+ appName: true,
263
+ mcpUrlType: true,
264
+ serverUrl: true,
265
+ tools: true,
266
+ readWriteCapabilities: true,
267
+ transportSupport: true,
268
+ primaryContactEmail: true,
269
+ primaryContactName: true
270
+ }).partial();
271
+ const submissionMetaFieldsSchema = z.object({
272
+ id: z.string(),
273
+ environmentId: z.string(),
274
+ createdAt: z.coerce.date(),
275
+ updatedAt: z.coerce.date()
276
+ });
277
+ const claudeSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
278
+ platform: z.literal("claudeai"),
279
+ formData: claudeSubmissionFormDataSchema.partial()
280
+ });
281
+ const chatgptSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
282
+ platform: z.literal("chatgpt"),
283
+ formData: chatgptSubmissionFormDataSchema.partial()
284
+ });
285
+ z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
286
+ z.union([claudeSubmissionFormDataSchema.partial(), chatgptSubmissionFormDataSchema.partial()]);
287
+ const subscriptionPlanSchema = z.enum([
288
+ "pro",
289
+ "business",
290
+ "enterprise"
291
+ ]);
292
+ z.object({ plan: subscriptionPlanSchema.nullable() });
293
+ //#endregion
4
294
  //#region src/schemas.ts
5
295
  const RESERVED_KEYS = [
6
296
  "_HANDLER",
@@ -13,7 +303,11 @@ const RESERVED_KEYS = [
13
303
  "AWS_LAMBDA_FUNCTION_VERSION",
14
304
  "AWS_LAMBDA_INITIALIZATION_TYPE",
15
305
  "AWS_LAMBDA_LOG_GROUP_NAME",
306
+ "AWS_LAMBDA_LOG_STREAM_NAME",
16
307
  "AWS_ACCESS_KEY",
308
+ "AWS_ACCESS_KEY_ID",
309
+ "AWS_SECRET_ACCESS_KEY",
310
+ "AWS_SESSION_TOKEN",
17
311
  "AWS_LAMBDA_RUNTIME_API",
18
312
  "LAMBDA_TASK_ROOT",
19
313
  "LAMBDA_RUNTIME_DIR",
@@ -30,7 +324,9 @@ const RESERVED_KEYS = [
30
324
  "BUILD_ARG_BUILD_COMMAND",
31
325
  "BUILD_ARG_BUILD_OUTPUT_DIR",
32
326
  "BUILD_ARG_START_COMMAND",
33
- "ALPIC_HOST"
327
+ "ALPIC_HOST",
328
+ "ALPIC_CUSTOM_DOMAINS",
329
+ "ALPIC_INTENT_META_KEY"
34
330
  ];
35
331
  const environmentVariableSchema = z.object({
36
332
  key: z.string().min(2, "Key must be at least 2 characters").regex(/^[a-zA-Z]([a-zA-Z0-9_])+$/, "Key must start with a letter and contain only letters, numbers, and underscores").refine((key) => !RESERVED_KEYS.includes(key), "This key is reserved and cannot be used as an environment variable key"),
@@ -38,6 +334,10 @@ const environmentVariableSchema = z.object({
38
334
  isSecret: z.boolean().default(false)
39
335
  });
40
336
  const environmentVariablesSchema = z.array(environmentVariableSchema);
337
+ const updateEnvironmentVariableSchema = environmentVariableSchema.partial({
338
+ value: true,
339
+ isSecret: true
340
+ });
41
341
  const buildSettingsSchema = z.object({
42
342
  installCommand: z.string().optional(),
43
343
  buildCommand: z.string().optional(),
@@ -55,7 +355,39 @@ const transportSchema = z.enum([
55
355
  "sse",
56
356
  "streamablehttp"
57
357
  ]);
58
-
358
+ const playgroundHeaderSchema = z.object({
359
+ name: z.string().min(1).max(100),
360
+ description: z.string().max(200),
361
+ isRequired: z.boolean().default(false),
362
+ isSecret: z.boolean().default(false)
363
+ });
364
+ const playgroundExamplePromptSchema = z.object({
365
+ title: z.string().min(1).max(100),
366
+ prompt: z.string().min(1).max(500)
367
+ });
368
+ const serverFieldsSchema = z.object({
369
+ $schema: z.string(),
370
+ name: z.string(),
371
+ description: z.string(),
372
+ version: z.string().optional(),
373
+ title: z.string().optional(),
374
+ websiteUrl: z.url().optional(),
375
+ icons: z.array(z.object({
376
+ src: z.url(),
377
+ mimeType: z.string().optional(),
378
+ sizes: z.array(z.string()).optional()
379
+ })).optional(),
380
+ remotes: z.array(z.object({
381
+ type: z.string(),
382
+ url: z.url().optional(),
383
+ headers: z.array(z.object({
384
+ name: z.string(),
385
+ description: z.string(),
386
+ isRequired: z.boolean().optional(),
387
+ isSecret: z.boolean().optional()
388
+ })).optional()
389
+ })).optional()
390
+ });
59
391
  //#endregion
60
392
  //#region src/api.contract.ts
61
393
  const deploymentStatusSchema = z.enum([
@@ -80,8 +412,16 @@ const deploymentSchema = z.object({
80
412
  authorUsername: z.string().nullable(),
81
413
  authorAvatarUrl: z.string().nullable(),
82
414
  startedAt: z.coerce.date().nullable(),
83
- completedAt: z.coerce.date().nullable()
415
+ completedAt: z.coerce.date().nullable(),
416
+ environmentId: z.string(),
417
+ environmentName: z.string(),
418
+ isCurrent: z.boolean(),
419
+ deploymentPageUrl: z.url().nullable()
84
420
  });
421
+ const isValidLogTimeInput = (value) => {
422
+ if (ms(value) !== void 0) return true;
423
+ return !Number.isNaN(new Date(value).getTime());
424
+ };
85
425
  const createEnvironmentContractV1 = oc.route({
86
426
  path: "/v1/environments",
87
427
  method: "POST",
@@ -106,7 +446,7 @@ const createEnvironmentContractV1 = oc.route({
106
446
  projectId: z.string().describe("The ID of the project the environment belongs to")
107
447
  }));
108
448
  const getEnvironmentContractV1 = oc.route({
109
- path: "/v1/environments/:environmentId",
449
+ path: "/v1/environments/{environmentId}",
110
450
  method: "GET",
111
451
  summary: "Get an environment",
112
452
  description: "Get an environment by ID",
@@ -121,10 +461,20 @@ const getEnvironmentContractV1 = oc.route({
121
461
  createdAt: z.coerce.date(),
122
462
  projectId: z.string()
123
463
  }));
464
+ const domainSchema = z.object({
465
+ domain: z.string(),
466
+ status: z.enum([
467
+ "ongoing",
468
+ "deployed",
469
+ "failed"
470
+ ]),
471
+ createdAt: z.coerce.date()
472
+ });
124
473
  const productionEnvironmentSchema = z.object({
125
474
  id: z.string(),
126
475
  name: z.string(),
127
476
  mcpServerUrl: z.string(),
477
+ domains: z.array(domainSchema),
128
478
  latestDeployment: latestDeploymentSchema.nullable()
129
479
  });
130
480
  const environmentSchema = z.object({
@@ -153,7 +503,7 @@ const projectOutputSchema = z.object({
153
503
  environments: z.array(environmentSchema)
154
504
  });
155
505
  const getProjectContractV1 = oc.route({
156
- path: "/v1/projects/:projectId",
506
+ path: "/v1/projects/{projectId}",
157
507
  method: "GET",
158
508
  summary: "Get a project",
159
509
  description: "Get a project by ID",
@@ -167,7 +517,7 @@ const listProjectsContractV1 = oc.route({
167
517
  description: "List all projects for a team",
168
518
  tags: ["projects"],
169
519
  successDescription: "The list of projects"
170
- }).output(z.array(projectOutputSchema));
520
+ }).input(z.object({ teamId: z.string().optional() }).optional()).output(z.array(projectOutputSchema));
171
521
  const createProjectContractV1 = oc.route({
172
522
  path: "/v1/projects",
173
523
  method: "POST",
@@ -179,7 +529,8 @@ const createProjectContractV1 = oc.route({
179
529
  NOT_FOUND: {},
180
530
  BAD_REQUEST: {}
181
531
  }).input(z.object({
182
- name: z.string().min(1).max(100),
532
+ teamId: z.string().optional(),
533
+ name: z.string().trim().min(1).max(100),
183
534
  sourceRepository: z.string().optional(),
184
535
  branchName: z.string().min(1).optional(),
185
536
  runtime: runtimeSchema,
@@ -209,8 +560,84 @@ const createProjectContractV1 = oc.route({
209
560
  startCommand: z.string().nullable(),
210
561
  createdAt: z.coerce.date()
211
562
  }));
563
+ const environmentVariableOutputSchema = z.object({
564
+ id: z.string(),
565
+ key: z.string(),
566
+ value: z.string(),
567
+ isSecret: z.boolean(),
568
+ createdAt: z.coerce.date()
569
+ });
570
+ const listEnvironmentVariablesContractV1 = oc.route({
571
+ path: "/v1/environments/{environmentId}/environment-variables",
572
+ method: "GET",
573
+ summary: "List environment variables",
574
+ description: "List all environment variables for an environment",
575
+ tags: ["environments"],
576
+ successDescription: "The list of environment variables"
577
+ }).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(environmentVariableOutputSchema));
578
+ const createEnvironmentVariablesContractV1 = oc.route({
579
+ path: "/v1/environments/{environmentId}/environment-variables",
580
+ method: "POST",
581
+ summary: "Add environment variables",
582
+ description: "Add one or more environment variables to an environment",
583
+ tags: ["environments"],
584
+ successDescription: "The environment variables have been added successfully"
585
+ }).errors({
586
+ NOT_FOUND: {},
587
+ BAD_REQUEST: {}
588
+ }).input(z.object({
589
+ environmentId: z.string().describe("The ID of the environment"),
590
+ environmentVariables: environmentVariablesSchema
591
+ })).output(z.object({ success: z.literal(true) }));
592
+ const updateEnvironmentVariableContractV1 = oc.route({
593
+ path: "/v1/environment-variables/{environmentVariableId}",
594
+ method: "PATCH",
595
+ summary: "Update an environment variable",
596
+ description: "Update an environment variable by ID",
597
+ tags: ["environments"],
598
+ successDescription: "The environment variable has been updated successfully"
599
+ }).errors({
600
+ NOT_FOUND: {},
601
+ BAD_REQUEST: {}
602
+ }).input(z.object({
603
+ environmentVariableId: z.string().describe("The ID of the environment variable"),
604
+ key: environmentVariableSchema.shape.key,
605
+ value: environmentVariableSchema.shape.value.optional(),
606
+ isSecret: environmentVariableSchema.shape.isSecret.optional()
607
+ })).output(z.object({ success: z.literal(true) }));
608
+ const deleteEnvironmentVariableContractV1 = oc.route({
609
+ path: "/v1/environment-variables/{environmentVariableId}",
610
+ method: "DELETE",
611
+ summary: "Delete an environment variable",
612
+ description: "Delete an environment variable by ID",
613
+ tags: ["environments"],
614
+ successDescription: "The environment variable has been deleted successfully"
615
+ }).errors({ NOT_FOUND: {} }).input(z.object({ environmentVariableId: z.string().describe("The ID of the environment variable") })).output(z.object({ success: z.literal(true) }));
616
+ const deleteProjectContractV1 = oc.route({
617
+ path: "/v1/projects/{projectId}",
618
+ method: "DELETE",
619
+ summary: "Delete a project",
620
+ description: "Delete a project and all its environments",
621
+ tags: ["projects"],
622
+ successDescription: "The project has been deleted successfully"
623
+ }).errors({ NOT_FOUND: {} }).input(z.object({ projectId: z.string().describe("The ID of the project") })).output(z.object({ success: z.literal(true) }));
624
+ const updateProjectContractV1 = oc.route({
625
+ path: "/v1/projects/{projectId}",
626
+ method: "PATCH",
627
+ summary: "Update a project",
628
+ description: "Update project settings",
629
+ tags: ["projects"],
630
+ successDescription: "The project has been updated successfully"
631
+ }).errors({
632
+ NOT_FOUND: {},
633
+ BAD_REQUEST: {}
634
+ }).input(z.object({
635
+ projectId: z.string().describe("The ID of the project"),
636
+ name: z.string().min(1).max(100).optional().describe("The new name for the project"),
637
+ sourceRepository: z.string().nullable().optional().describe("The source repository to connect to the project")
638
+ })).output(projectOutputSchema);
212
639
  const deployEnvironmentContractV1 = oc.route({
213
- path: "/v1/environments/:environmentId/deploy",
640
+ path: "/v1/environments/{environmentId}/deploy",
214
641
  method: "POST",
215
642
  summary: "Deploy an environment",
216
643
  description: "Deploy an environment",
@@ -230,35 +657,330 @@ const uploadDeploymentArtifactContractV1 = oc.route({
230
657
  description: "Return a presigned S3 URL to upload a deployment artifact",
231
658
  tags: ["deployments"],
232
659
  successDescription: "The presigned upload URL has been generated successfully"
233
- }).output(z.object({
234
- uploadUrl: z.string().url().describe("Presigned S3 URL to upload the source archive with HTTP PUT"),
660
+ }).input(z.object({ teamId: z.string().optional() }).optional()).output(z.object({
661
+ uploadUrl: z.url().describe("Presigned S3 URL to upload the source archive with HTTP PUT"),
235
662
  token: z.string().describe("Token to identify the source archive"),
236
663
  expiresAt: z.coerce.date().describe("Expiration date of the presigned URL")
237
664
  }));
665
+ const listDeploymentsContractV1 = oc.route({
666
+ path: "/v1/projects/{projectId}/deployments",
667
+ method: "GET",
668
+ summary: "List project deployments",
669
+ description: "List all deployments for a project",
670
+ tags: ["deployments"],
671
+ successDescription: "The list of deployments"
672
+ }).errors({ NOT_FOUND: {} }).input(z.object({
673
+ projectId: z.string().describe("The ID of the project"),
674
+ status: z.array(deploymentStatusSchema).optional().describe("Filter by one or more statuses"),
675
+ environmentId: z.string().optional().describe("Filter by environment ID")
676
+ })).output(z.array(deploymentSchema));
238
677
  const getDeploymentContractV1 = oc.route({
239
- path: "/v1/deployments/:deploymentId",
678
+ path: "/v1/deployments/{deploymentId}",
240
679
  method: "GET",
241
680
  summary: "Get a deployment",
242
681
  description: "Get a deployment by ID",
243
682
  tags: ["deployments"],
244
683
  successDescription: "The deployment details"
245
684
  }).errors({ NOT_FOUND: {} }).input(z.object({ deploymentId: z.string().describe("The ID of the deployment") })).output(deploymentSchema);
685
+ const getLogsContractV1 = oc.route({
686
+ path: "/v1/environments/{environmentId}/logs",
687
+ method: "GET",
688
+ summary: "Get logs",
689
+ description: "Get logs for an environment",
690
+ tags: ["environments"],
691
+ successDescription: "The logs"
692
+ }).errors({
693
+ NOT_FOUND: {},
694
+ BAD_REQUEST: {}
695
+ }).input(z.object({
696
+ environmentId: z.string().describe("The ID of the environment"),
697
+ since: z.string().refine(isValidLogTimeInput, { message: "Invalid time. Use relative (1h, 30m, 2d) or ISO 8601 format." }).optional().describe("Start time — ISO 8601 (2024-01-01T00:00:00Z) or relative (1h, 30m, 2d)"),
698
+ until: z.string().refine(isValidLogTimeInput, { message: "Invalid time. Use relative (1h, 30m, 2d) or ISO 8601 format." }).optional().describe("End time — ISO 8601 or relative"),
699
+ limit: z.coerce.number().int().min(1).max(1e3).default(1e3).describe("Maximum number of log entries to return."),
700
+ level: z.array(z.enum([
701
+ "INFO",
702
+ "ERROR",
703
+ "WARNING",
704
+ "DEBUG"
705
+ ])).optional().describe("Filter by log level"),
706
+ search: z.string().optional().describe("Filter pattern to search for in log content"),
707
+ nextToken: z.string().optional().describe("Pagination token from a previous response")
708
+ })).output(z.object({
709
+ logs: z.array(z.object({
710
+ timestamp: z.coerce.date(),
711
+ type: z.enum([
712
+ "START",
713
+ "END",
714
+ "INFO",
715
+ "ERROR",
716
+ "WARNING",
717
+ "DEBUG"
718
+ ]),
719
+ requestId: z.string(),
720
+ content: z.string().optional(),
721
+ method: z.string().optional(),
722
+ durationInMs: z.number().optional()
723
+ })),
724
+ nextToken: z.string().nullable()
725
+ }));
726
+ const getLatestLogsContractV1 = oc.route({
727
+ path: "/v1/environments/{environmentId}/latest-logs",
728
+ method: "GET",
729
+ summary: "Get latest logs",
730
+ description: "Get the N most recent logs for an environment",
731
+ tags: ["environments"],
732
+ successDescription: "The latest logs"
733
+ }).errors({
734
+ NOT_FOUND: {},
735
+ BAD_REQUEST: {}
736
+ }).input(z.object({
737
+ environmentId: z.string().describe("The ID of the environment"),
738
+ limit: z.coerce.number().int().min(1).max(1e3).default(100).describe("Number of most recent log entries to return"),
739
+ level: z.array(z.enum([
740
+ "INFO",
741
+ "ERROR",
742
+ "WARNING",
743
+ "DEBUG"
744
+ ])).optional().describe("Filter by log level"),
745
+ search: z.string().optional().describe("Filter pattern to search for in log content")
746
+ })).output(z.object({ logs: z.array(z.object({
747
+ timestamp: z.coerce.date(),
748
+ type: z.enum([
749
+ "START",
750
+ "END",
751
+ "INFO",
752
+ "ERROR",
753
+ "WARNING",
754
+ "DEBUG"
755
+ ]),
756
+ requestId: z.string(),
757
+ content: z.string().optional(),
758
+ method: z.string().optional(),
759
+ durationInMs: z.number().optional()
760
+ })) }));
761
+ const getDeploymentLogsContractV1 = oc.route({
762
+ path: "/v1/deployments/{deploymentId}/logs",
763
+ method: "GET",
764
+ summary: "Get deployment logs",
765
+ description: "Get the logs for a deployment",
766
+ tags: ["deployments"],
767
+ successDescription: "The deployment logs"
768
+ }).errors({ NOT_FOUND: {} }).input(z.object({ deploymentId: z.string().describe("The ID of the deployment") })).output(z.object({
769
+ logs: z.array(z.object({
770
+ timestamp: z.coerce.date().optional(),
771
+ content: z.string().optional()
772
+ })),
773
+ hasMoreLogs: z.boolean()
774
+ }));
775
+ const analyticsDataPointSchema = z.object({
776
+ timestamp: z.number(),
777
+ categories: z.record(z.string(), z.unknown())
778
+ });
779
+ const analyticsTimeSeriesSchema = z.object({
780
+ sessions_count: z.array(analyticsDataPointSchema),
781
+ requests_count: z.array(analyticsDataPointSchema),
782
+ requests_latency_mean: z.array(analyticsDataPointSchema),
783
+ tool_errors: z.array(analyticsDataPointSchema),
784
+ mcp_errors: z.array(analyticsDataPointSchema),
785
+ output_token_mean: z.array(analyticsDataPointSchema),
786
+ task_count: z.array(analyticsDataPointSchema)
787
+ });
788
+ const getProjectAnalyticsContractV1 = oc.route({
789
+ path: "/v1/analytics/{projectId}",
790
+ method: "GET",
791
+ summary: "Get project analytics",
792
+ description: "Get analytics data for a project over a time range",
793
+ tags: ["analytics"],
794
+ successDescription: "The project analytics data"
795
+ }).errors({
796
+ NOT_FOUND: {},
797
+ BAD_REQUEST: {}
798
+ }).input(z.object({
799
+ projectId: z.string().describe("The ID of the project"),
800
+ startTimestamp: z.coerce.number().describe("Start timestamp in milliseconds"),
801
+ endTimestamp: z.coerce.number().describe("End timestamp in milliseconds"),
802
+ timeZone: z.string().describe("IANA timezone (e.g. Europe/Paris)")
803
+ }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp > 0, { message: "End date must be after start date" }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp <= 744 * 60 * 60 * 1e3, { message: "Date range must be less than 1 month" }).refine(({ timeZone }) => Intl.supportedValuesOf("timeZone").includes(timeZone), { message: "Time zone must be a valid IANA timezone" })).output(z.object({
804
+ metadata: z.object({
805
+ startTimestamp: z.number(),
806
+ endTimestamp: z.number(),
807
+ timeZone: z.string(),
808
+ startDate: z.coerce.date(),
809
+ interval: z.string()
810
+ }),
811
+ timeSeries: analyticsTimeSeriesSchema
812
+ }));
813
+ const listTeamsContractV1 = oc.route({
814
+ path: "/v1/teams",
815
+ method: "GET",
816
+ summary: "List teams",
817
+ description: "List all teams for the authenticated user",
818
+ tags: ["teams"],
819
+ successDescription: "The list of teams"
820
+ }).output(z.array(z.object({
821
+ id: z.string(),
822
+ name: z.string(),
823
+ createdAt: z.coerce.date(),
824
+ hasStripeAccount: z.boolean()
825
+ })));
826
+ const getTunnelTicketContractV1 = oc.route({
827
+ path: "/v1/tunnels/ticket",
828
+ method: "GET",
829
+ summary: "Get a tunnel ticket",
830
+ description: "Get a signed ticket for establishing a tunnel connection. Requires user authentication (API keys are not supported).",
831
+ tags: ["tunnels"],
832
+ successDescription: "The tunnel ticket"
833
+ }).output(z.object({
834
+ subdomain: z.string().describe("The subdomain assigned to the user"),
835
+ ticket: z.string().describe("The signed tunnel ticket"),
836
+ tunnelHost: z.string().describe("The tunnel host to connect to")
837
+ }));
838
+ const publishServerContractV1 = oc.route({
839
+ path: "/v1/distribution/publish",
840
+ method: "POST",
841
+ summary: "Publish a server to the MCP registry",
842
+ tags: ["distribution"],
843
+ successDescription: "The server has been published successfully"
844
+ }).errors({
845
+ NOT_FOUND: {},
846
+ BAD_REQUEST: {}
847
+ }).input(z.object({
848
+ projectId: z.string(),
849
+ domain: z.string(),
850
+ title: z.string().min(1).max(100),
851
+ description: z.string().min(1).max(100),
852
+ websiteUrl: z.url().max(255).optional(),
853
+ iconSrc: z.url().max(255).optional(),
854
+ dryRun: z.boolean().optional()
855
+ })).output(z.object({ serverFields: serverFieldsSchema }));
856
+ const getServerInfoContractV1 = oc.route({
857
+ path: "/v1/distribution/get",
858
+ method: "GET",
859
+ summary: "Get server info",
860
+ description: "Get info about a server",
861
+ tags: ["distribution"],
862
+ successDescription: "The server info"
863
+ }).errors({
864
+ NOT_FOUND: {},
865
+ BAD_REQUEST: {}
866
+ }).input(z.object({
867
+ projectId: z.string(),
868
+ domain: z.string()
869
+ })).output(z.object({ serverFields: serverFieldsSchema }));
870
+ const playgroundServerMetadataOutputSchema = z.object({
871
+ name: z.string(),
872
+ description: z.string(),
873
+ headers: z.array(z.object({
874
+ name: z.string(),
875
+ description: z.string(),
876
+ isRequired: z.boolean(),
877
+ isSecret: z.boolean()
878
+ })),
879
+ examplePrompts: z.array(playgroundExamplePromptSchema)
880
+ });
881
+ const playgroundOutputSchema = z.object({
882
+ isPlaygroundEnabled: z.boolean(),
883
+ serverMetadata: playgroundServerMetadataOutputSchema.nullable()
884
+ });
885
+ const getPlaygroundContractV1 = oc.route({
886
+ path: "/v1/environments/{environmentId}/playground",
887
+ method: "GET",
888
+ summary: "Get playground configuration",
889
+ description: "Get the playground configuration for an environment",
890
+ tags: ["environments"],
891
+ successDescription: "The playground configuration"
892
+ }).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(playgroundOutputSchema);
893
+ const upsertPlaygroundContractV1 = oc.route({
894
+ path: "/v1/environments/{environmentId}/playground",
895
+ method: "PUT",
896
+ summary: "Update playground configuration",
897
+ description: "Update the playground configuration for an environment. All fields are optional — only provided fields are updated.",
898
+ tags: ["environments"],
899
+ successDescription: "The updated playground configuration"
900
+ }).errors({
901
+ NOT_FOUND: {},
902
+ BAD_REQUEST: {}
903
+ }).input(z.object({
904
+ environmentId: z.string().describe("The ID of the environment"),
905
+ isPlaygroundEnabled: z.boolean().optional(),
906
+ name: z.string().min(1).max(100).optional(),
907
+ description: z.string().min(1).max(500).optional(),
908
+ headers: z.array(playgroundHeaderSchema).optional(),
909
+ examplePrompts: z.array(playgroundExamplePromptSchema).max(3).optional()
910
+ })).output(playgroundOutputSchema);
911
+ const createBeaconContractV1 = oc.route({
912
+ path: "/v1/beacon/audits",
913
+ method: "POST",
914
+ summary: "Create a beacon audit",
915
+ description: "Audit an MCP server for spec compliance and AI client compatibility",
916
+ tags: ["beacon"],
917
+ successDescription: "The audit has been created"
918
+ }).errors({
919
+ NOT_FOUND: {},
920
+ BAD_REQUEST: {}
921
+ }).input(z.object({
922
+ targetUrl: z.url().describe("The HTTPS URL of the MCP server to audit"),
923
+ teamId: z.string().optional().describe("The team ID to associate the audit with"),
924
+ projectId: z.string().optional().describe("The project ID to associate the audit with"),
925
+ excludeCategories: z.array(checkCategorySchema).optional().describe("Check categories to exclude from the audit")
926
+ })).output(z.object({ id: z.string() }));
927
+ const getBeaconContractV1 = oc.route({
928
+ path: "/v1/beacon/audits/{auditId}",
929
+ method: "GET",
930
+ summary: "Get a beacon audit",
931
+ description: "Get a beacon audit by ID, including the report if completed",
932
+ tags: ["beacon"],
933
+ successDescription: "The audit details"
934
+ }).errors({ NOT_FOUND: {} }).input(z.object({ auditId: z.string().describe("The ID of the audit") })).output(z.object({
935
+ id: z.string(),
936
+ targetUrl: z.string(),
937
+ status: auditStatusSchema,
938
+ durationMs: z.number().nullable(),
939
+ createdAt: z.coerce.date(),
940
+ report: auditReportWithScreenshotsSchema.nullable()
941
+ }));
246
942
  const contract = {
943
+ teams: { list: { v1: listTeamsContractV1 } },
944
+ analytics: { get: { v1: getProjectAnalyticsContractV1 } },
247
945
  deployments: {
946
+ list: { v1: listDeploymentsContractV1 },
248
947
  get: { v1: getDeploymentContractV1 },
249
- uploadArtifact: { v1: uploadDeploymentArtifactContractV1 }
948
+ uploadArtifact: { v1: uploadDeploymentArtifactContractV1 },
949
+ getLogs: { v1: getDeploymentLogsContractV1 }
250
950
  },
251
951
  environments: {
252
952
  create: { v1: createEnvironmentContractV1 },
253
953
  get: { v1: getEnvironmentContractV1 },
254
- deploy: { v1: deployEnvironmentContractV1 }
954
+ deploy: { v1: deployEnvironmentContractV1 },
955
+ getLogs: { v1: getLogsContractV1 },
956
+ getLatestLogs: { v1: getLatestLogsContractV1 }
957
+ },
958
+ environmentVariables: {
959
+ list: { v1: listEnvironmentVariablesContractV1 },
960
+ create: { v1: createEnvironmentVariablesContractV1 },
961
+ update: { v1: updateEnvironmentVariableContractV1 },
962
+ delete: { v1: deleteEnvironmentVariableContractV1 }
255
963
  },
256
964
  projects: {
965
+ update: { v1: updateProjectContractV1 },
257
966
  get: { v1: getProjectContractV1 },
258
967
  list: { v1: listProjectsContractV1 },
259
- create: { v1: createProjectContractV1 }
968
+ create: { v1: createProjectContractV1 },
969
+ delete: { v1: deleteProjectContractV1 }
970
+ },
971
+ playground: {
972
+ get: { v1: getPlaygroundContractV1 },
973
+ upsert: { v1: upsertPlaygroundContractV1 }
974
+ },
975
+ tunnels: { getTicket: { v1: getTunnelTicketContractV1 } },
976
+ distribution: {
977
+ publish: { v1: publishServerContractV1 },
978
+ get: { v1: getServerInfoContractV1 }
979
+ },
980
+ beacon: {
981
+ create: { v1: createBeaconContractV1 },
982
+ get: { v1: getBeaconContractV1 }
260
983
  }
261
984
  };
262
-
263
985
  //#endregion
264
- export { buildSettingsSchema, contract, createEnvironmentContractV1, environmentVariableSchema, environmentVariablesSchema, runtimeSchema, transportSchema };
986
+ export { PLATFORM_LABELS, buildSettingsSchema, contract, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, playgroundExamplePromptSchema, playgroundHeaderSchema, runtimeSchema, serverFieldsSchema, transportSchema, updateEnvironmentVariableSchema };