@01.software/cli 0.10.0 → 0.10.3

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.
@@ -1,7 +1,7 @@
1
1
  // src/handler.ts
2
2
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
3
3
 
4
- // ../../packages/auth-contracts/dist/index.js
4
+ // ../../packages/auth-contracts/src/index.ts
5
5
  var MCP_RESOURCE_AUDIENCE = "https://mcp.01.software/mcp";
6
6
  var MCP_OAUTH_ISSUER = "https://01.software";
7
7
  var MCP_PROTECTED_RESOURCE_METADATA_PATH = "/.well-known/oauth-protected-resource/mcp";
@@ -125,6 +125,77 @@ var tenantContextResponseSchema = z.object({
125
125
  webhookConfigured: z.boolean()
126
126
  }).strict().optional()
127
127
  }).strict();
128
+ var tenantFeatureProgressFeatureSchema = z.enum(["ecommerce"]);
129
+ var tenantFeatureProgressInputSchema = z.object({
130
+ feature: tenantFeatureProgressFeatureSchema.describe(
131
+ "Feature to inspect for tenant implementation readiness"
132
+ ),
133
+ includeEvidence: z.boolean().optional().default(false).describe("Include sanitized counts and static surface evidence")
134
+ }).strict();
135
+ var tenantFeatureProgressStatusSchema = z.enum([
136
+ "ready",
137
+ "attention",
138
+ "blocked"
139
+ ]);
140
+ var tenantFeatureProgressItemStateSchema = z.enum([
141
+ "complete",
142
+ "incomplete",
143
+ "blocked",
144
+ "attention",
145
+ "optional",
146
+ "unknown",
147
+ "manual",
148
+ "not-applicable"
149
+ ]);
150
+ var tenantFeatureProgressSeveritySchema = z.enum([
151
+ "required",
152
+ "recommended",
153
+ "optional"
154
+ ]);
155
+ var tenantFeatureProgressEvidenceValueSchema = z.union([
156
+ z.string(),
157
+ z.number(),
158
+ z.boolean(),
159
+ z.null()
160
+ ]);
161
+ var tenantFeatureProgressItemSchema = z.object({
162
+ id: z.string(),
163
+ title: z.string(),
164
+ state: tenantFeatureProgressItemStateSchema,
165
+ severity: tenantFeatureProgressSeveritySchema,
166
+ summary: z.string(),
167
+ evidence: z.record(z.string(), tenantFeatureProgressEvidenceValueSchema).optional()
168
+ }).strict();
169
+ var tenantFeatureProgressGroupSchema = z.object({
170
+ id: z.string(),
171
+ title: z.string(),
172
+ summary: z.string().optional(),
173
+ items: z.array(tenantFeatureProgressItemSchema)
174
+ }).strict();
175
+ var tenantFeatureProgressResponseSchema = z.object({
176
+ schemaVersion: z.literal(1),
177
+ feature: tenantFeatureProgressFeatureSchema,
178
+ status: tenantFeatureProgressStatusSchema,
179
+ generatedAt: z.string(),
180
+ tenant: z.object({
181
+ id: z.string(),
182
+ name: z.string(),
183
+ plan: z.string()
184
+ }).strict(),
185
+ capability: z.object({
186
+ effectiveFeatures: z.array(z.string()),
187
+ planBlocked: z.array(z.string()),
188
+ closureAdded: z.array(z.string())
189
+ }).strict(),
190
+ summary: z.object({
191
+ complete: z.number().int().nonnegative(),
192
+ total: z.number().int().nonnegative(),
193
+ blocking: z.number().int().nonnegative(),
194
+ manual: z.number().int().nonnegative(),
195
+ unknown: z.number().int().nonnegative()
196
+ }).strict(),
197
+ groups: z.array(tenantFeatureProgressGroupSchema)
198
+ }).strict();
128
199
  var COLLECTION_SCHEMA_CONTRACT_VERSION = 1;
129
200
  var collectionSchemaEndpointParamsSchema = z.object({
130
201
  collectionSlug: z.string().min(1, "collectionSlug is required")
@@ -190,6 +261,29 @@ var updateTransactionSchema = z2.object({
190
261
  amount: z2.number().int().positive().optional().describe("Provider-confirmed amount for verified paid confirmation")
191
262
  }).strict();
192
263
  var UpdateTransactionSchema = updateTransactionSchema;
264
+ var providerSlugSchema = z2.string().trim().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/, "pgProvider must be lowercase slug");
265
+ var confirmPaymentSchema = z2.object({
266
+ orderNumber: z2.string().min(1).optional(),
267
+ pgPaymentId: z2.string().min(1, "pgPaymentId is required").describe("Provider payment identifier stored on the transaction"),
268
+ pgProvider: providerSlugSchema.describe(
269
+ "Payment provider slug, e.g. toss, portone, stripe"
270
+ ),
271
+ pgOrderId: z2.string().min(1).optional(),
272
+ amount: z2.number().int().nonnegative("amount must be non-negative").describe("Provider-confirmed amount in minor units"),
273
+ currency: z2.string().min(1).optional(),
274
+ paymentMethod: z2.string().optional(),
275
+ receiptUrl: z2.string().url().optional(),
276
+ approvedAt: z2.string().optional(),
277
+ providerStatus: z2.string().optional(),
278
+ providerEventId: z2.string().min(1).optional(),
279
+ confirmationSource: z2.enum([
280
+ "provider_webhook",
281
+ "provider_lookup",
282
+ "provider_api_confirm",
283
+ "manual_server"
284
+ ]).optional(),
285
+ metadata: z2.record(z2.string(), z2.unknown()).optional()
286
+ }).strict();
193
287
  var returnReasonSchema = z2.enum([
194
288
  "change_of_mind",
195
289
  "defective",
@@ -201,7 +295,8 @@ var restockActionSchema = z2.enum(["return_to_stock", "discard"]);
201
295
  var returnWithRefundItemSchema = z2.object({
202
296
  orderItem: z2.union([z2.string(), z2.number()]).transform(String),
203
297
  quantity: z2.number().int().positive("quantity must be a positive integer"),
204
- restockAction: restockActionSchema.default("return_to_stock")
298
+ restockAction: restockActionSchema.default("return_to_stock"),
299
+ restockingFee: z2.number().min(0, "restockingFee must be non-negative").optional().describe("Restocking fee charged for this line (ADR 0005 \xA7Gap 1)")
205
300
  }).strict();
206
301
  var returnWithRefundSchema = z2.object({
207
302
  orderNumber: z2.string().min(1, "orderNumber is required").describe("Order number (required)"),
@@ -209,6 +304,7 @@ var returnWithRefundSchema = z2.object({
209
304
  reasonDetail: z2.string().optional().describe("Detailed reason text (optional)"),
210
305
  returnItems: z2.array(returnWithRefundItemSchema).min(1, "At least one return item is required").max(100, "Too many return items").describe("Array of products to return (required)"),
211
306
  refundAmount: z2.number().min(0, "refundAmount must be non-negative").describe("Refund amount (required, min 0)"),
307
+ returnShippingFee: z2.number().min(0, "returnShippingFee must be non-negative").optional().describe("Return shipping fee charged to the customer (ADR 0005 \xA7Gap 1)"),
212
308
  pgPaymentId: z2.string().min(1, "pgPaymentId is required").describe("PG payment ID for refund (required)"),
213
309
  paymentKey: z2.string().min(1).optional().describe("Provider payment key for verified refund"),
214
310
  refundReceiptUrl: z2.string().optional().describe("Refund receipt URL (optional)")
@@ -237,6 +333,16 @@ var MCP_TOOL_CONTRACT = {
237
333
  oauthScope: "mcp:read",
238
334
  readOnly: true
239
335
  },
336
+ "product-detail": {
337
+ consoleRole: "tenant-viewer",
338
+ oauthScope: "mcp:read",
339
+ readOnly: true
340
+ },
341
+ "product-upsert": {
342
+ consoleRole: "tenant-admin",
343
+ oauthScope: "mcp:write",
344
+ readOnly: false
345
+ },
240
346
  "validate-discount": {
241
347
  consoleRole: "tenant-viewer",
242
348
  oauthScope: "mcp:read",
@@ -262,6 +368,11 @@ var MCP_TOOL_CONTRACT = {
262
368
  oauthScope: "mcp:read",
263
369
  readOnly: true
264
370
  },
371
+ "check-feature-progress": {
372
+ consoleRole: "tenant-viewer",
373
+ oauthScope: "mcp:read",
374
+ readOnly: true
375
+ },
265
376
  "add-cart-item": {
266
377
  consoleRole: "tenant-editor",
267
378
  oauthScope: "mcp:write",
@@ -363,9 +474,7 @@ var MCP_TOOL_CONTRACT = {
363
474
  readOnly: true
364
475
  }
365
476
  };
366
- var MCP_TOOL_NAMES = Object.keys(
367
- MCP_TOOL_CONTRACT
368
- );
477
+ var MCP_TOOL_NAMES = Object.keys(MCP_TOOL_CONTRACT);
369
478
  function isMcpToolName(toolName) {
370
479
  return Object.prototype.hasOwnProperty.call(MCP_TOOL_CONTRACT, toolName);
371
480
  }
@@ -433,6 +542,21 @@ var TOOL_POLICY_MANIFEST = {
433
542
  consoleSurface: "GET /api/products/{id}/stock",
434
543
  annotationPolicy: READ_ONLY_ANNOTATION
435
544
  },
545
+ "product-detail": {
546
+ category: "read-only-collection",
547
+ oauthScope: MCP_SCOPES.read,
548
+ consoleRole: "tenant-viewer",
549
+ consoleSurface: "GET /api/products/detail",
550
+ annotationPolicy: READ_ONLY_ANNOTATION
551
+ },
552
+ "product-upsert": {
553
+ category: "mutation-product",
554
+ oauthScope: MCP_SCOPES.write,
555
+ consoleRole: "tenant-admin",
556
+ consoleSurface: "POST /api/products/upsert",
557
+ annotationPolicy: DESTRUCTIVE_IDEMPOTENT_MUTATION_ANNOTATION,
558
+ exemptionReason: REASON_IDEMPOTENT_DESTRUCTIVE_UPDATE
559
+ },
436
560
  "validate-discount": {
437
561
  category: "read-only-collection",
438
562
  oauthScope: MCP_SCOPES.read,
@@ -469,6 +593,13 @@ var TOOL_POLICY_MANIFEST = {
469
593
  consoleSurface: "GET /api/tenants/context",
470
594
  annotationPolicy: READ_ONLY_ANNOTATION
471
595
  },
596
+ "check-feature-progress": {
597
+ category: "read-only-tenant",
598
+ oauthScope: MCP_SCOPES.read,
599
+ consoleRole: "tenant-viewer",
600
+ consoleSurface: "GET /api/tenants/feature-progress",
601
+ annotationPolicy: READ_ONLY_ANNOTATION
602
+ },
472
603
  // ── Cart mutations (mcp:write, tenant-editor) ──
473
604
  "add-cart-item": {
474
605
  category: "mutation-cart",
@@ -518,7 +649,7 @@ var TOOL_POLICY_MANIFEST = {
518
649
  exemptionReason: REASON_CART_EPHEMERAL
519
650
  },
520
651
  // ── Order mutations (mcp:write, tenant-admin) ──
521
- "checkout": {
652
+ checkout: {
522
653
  category: "mutation-order",
523
654
  oauthScope: MCP_SCOPES.write,
524
655
  consoleRole: "tenant-admin",
@@ -779,9 +910,12 @@ function signMcpServiceToken(context) {
779
910
  }
780
911
 
781
912
  // src/lib/console-api.ts
782
- var BASE_URL = process.env.SOFTWARE_API_URL || "http://localhost:3000";
913
+ var DEFAULT_API_URL = "https://api.01.software";
783
914
  var TIMEOUT_MS = 5e3;
784
915
  var MISSING_HTTP_AUTH_CONTEXT_ERROR = "MCP HTTP requests require a validated OAuth tenant context before tool execution.";
916
+ function resolveConsoleApiUrl() {
917
+ return (process.env.SOFTWARE_API_URL || process.env.NEXT_PUBLIC_SOFTWARE_API_URL || DEFAULT_API_URL).replace(/\/$/, "");
918
+ }
785
919
  function resolveAuthHeaderContext() {
786
920
  const oauthContext = tenantAuthContext();
787
921
  if (oauthContext) {
@@ -831,7 +965,7 @@ async function consoleGet(path, apiKey) {
831
965
  const controller = new AbortController();
832
966
  const timeoutId = setTimeout(() => controller.abort(), TIMEOUT_MS);
833
967
  try {
834
- const res = await fetch(`${BASE_URL}${path}`, {
968
+ const res = await fetch(`${resolveConsoleApiUrl()}${path}`, {
835
969
  headers: authHeaders,
836
970
  signal: controller.signal
837
971
  });
@@ -850,7 +984,7 @@ async function consolePost(path, body, apiKey) {
850
984
  const controller = new AbortController();
851
985
  const timeoutId = setTimeout(() => controller.abort(), TIMEOUT_MS);
852
986
  try {
853
- const res = await fetch(`${BASE_URL}${path}`, {
987
+ const res = await fetch(`${resolveConsoleApiUrl()}${path}`, {
854
988
  method: "POST",
855
989
  headers: { ...authHeaders, "Content-Type": "application/json" },
856
990
  body: JSON.stringify(body),
@@ -871,7 +1005,7 @@ async function consolePostTelemetry(path, body, apiKey) {
871
1005
  const controller = new AbortController();
872
1006
  const timeoutId = setTimeout(() => controller.abort(), TIMEOUT_MS);
873
1007
  try {
874
- const res = await fetch(`${BASE_URL}${path}`, {
1008
+ const res = await fetch(`${resolveConsoleApiUrl()}${path}`, {
875
1009
  method: "POST",
876
1010
  headers: { ...authHeaders, "Content-Type": "application/json" },
877
1011
  body: JSON.stringify(body),
@@ -1769,6 +1903,118 @@ async function stockCheck({
1769
1903
  }
1770
1904
  }
1771
1905
 
1906
+ // src/tools/product-detail.ts
1907
+ import { z as z22 } from "zod";
1908
+ var schema22 = {
1909
+ slug: z22.string().optional().describe("Product slug (one of slug or id required)"),
1910
+ id: z22.string().optional().describe("Product id (one of slug or id required)")
1911
+ };
1912
+ var metadata22 = {
1913
+ name: "product-detail",
1914
+ description: "Fetch full product detail by slug or id. Returns one resolver-ready product with variants, option slugs, option value slugs/media, brand, categories, tags, images, videos, and listing rollup, or null if missing/unpublished/wrong tenant/feature disabled.",
1915
+ annotations: {
1916
+ title: "Get product detail",
1917
+ readOnlyHint: true,
1918
+ destructiveHint: false,
1919
+ idempotentHint: true
1920
+ }
1921
+ };
1922
+ async function productDetail({
1923
+ slug,
1924
+ id
1925
+ }) {
1926
+ try {
1927
+ if (Boolean(slug) === Boolean(id)) {
1928
+ return toolError(new Error("Provide exactly one of slug or id"));
1929
+ }
1930
+ const client = getClient();
1931
+ const params = slug ? { slug } : { id };
1932
+ const result = await client.commerce.product.detail(params);
1933
+ return toolSuccess({ data: result });
1934
+ } catch (error) {
1935
+ return toolError(error);
1936
+ }
1937
+ }
1938
+
1939
+ // src/tools/product-upsert.ts
1940
+ import { z as z23 } from "zod";
1941
+ var optionValueSchema = z23.object({
1942
+ id: z23.string().optional().describe("Existing option-value ID for updates"),
1943
+ value: z23.string().describe("Display label (e.g. Black, S)"),
1944
+ slug: z23.string().optional().describe("Canonical value token used in variant maps and URLs"),
1945
+ swatchColor: z23.string().nullable().optional(),
1946
+ thumbnail: z23.string().nullable().optional(),
1947
+ images: z23.array(z23.string()).optional(),
1948
+ metadata: z23.unknown().optional()
1949
+ });
1950
+ var optionSchema = z23.object({
1951
+ id: z23.string().optional().describe("Existing option ID for updates"),
1952
+ title: z23.string().describe("Option name (e.g. Color, Size)"),
1953
+ slug: z23.string().optional().describe("Canonical option token used in variant maps and URLs"),
1954
+ values: z23.array(optionValueSchema).describe("Allowed option values")
1955
+ });
1956
+ var variantOptionValueSchema = z23.object({
1957
+ valueSlug: z23.string().optional(),
1958
+ valueId: z23.string().optional(),
1959
+ value: z23.string().optional()
1960
+ });
1961
+ var variantSchema = z23.object({
1962
+ id: z23.string().optional().describe("Existing variant ID for updates"),
1963
+ optionValues: z23.union([
1964
+ z23.record(z23.string(), z23.union([z23.string(), variantOptionValueSchema])),
1965
+ z23.array(z23.string())
1966
+ ]).optional().describe(
1967
+ "Option-value selection. Prefer canonical { optionSlug: valueSlug } maps. Object values may use { valueSlug, valueId, value }. Exact { OptionTitle: ValueLabel } maps remain compatibility-only and fail when labels are ambiguous. Arrays of option-value IDs are also accepted."
1968
+ ),
1969
+ sku: z23.string().nullable().optional(),
1970
+ title: z23.string().nullable().optional(),
1971
+ price: z23.number().nonnegative().describe("Selling price (KRW, min 0)"),
1972
+ compareAtPrice: z23.number().nonnegative().nullable().optional(),
1973
+ stock: z23.number().int().nonnegative().optional(),
1974
+ isUnlimited: z23.boolean().optional(),
1975
+ weight: z23.number().nonnegative().nullable().optional(),
1976
+ requiresShipping: z23.boolean().optional(),
1977
+ barcode: z23.string().nullable().optional(),
1978
+ externalId: z23.string().nullable().optional(),
1979
+ isActive: z23.boolean().optional(),
1980
+ thumbnail: z23.string().nullable().optional(),
1981
+ images: z23.array(z23.string()).optional(),
1982
+ metadata: z23.unknown().optional()
1983
+ });
1984
+ var schema23 = {
1985
+ product: z23.record(z23.string(), z23.unknown()).describe(
1986
+ "Product fields. Include `id` to update an existing product; omit for create (then `title` is required)."
1987
+ ),
1988
+ options: z23.array(optionSchema).optional().describe(
1989
+ "Option definitions. Prefer explicit option slug and value slugs. Omitted options on an existing product are deleted (with their values)."
1990
+ ),
1991
+ variants: z23.array(variantSchema).optional().describe(
1992
+ "Variant rows. Prefer canonical { optionSlug: valueSlug } optionValues maps. Omitted variants on an existing product are deleted, unless referenced by an active cart or non-terminal order \u2014 those are soft-deactivated (isActive: false)."
1993
+ )
1994
+ };
1995
+ var metadata23 = {
1996
+ name: "product-upsert",
1997
+ description: "Atomically create or update a product together with its options, option-values, and variants in a single transaction. Mirrors Shopify productSet semantics. Any failure rolls back the entire write.",
1998
+ annotations: {
1999
+ title: "Upsert product (atomic)",
2000
+ readOnlyHint: false,
2001
+ destructiveHint: true,
2002
+ idempotentHint: true,
2003
+ openWorldHint: false
2004
+ }
2005
+ };
2006
+ async function productUpsert(params) {
2007
+ try {
2008
+ const client = getClient();
2009
+ const result = await client.commerce.product.upsert(
2010
+ params
2011
+ );
2012
+ return toolSuccess({ data: result });
2013
+ } catch (error) {
2014
+ return toolError(error);
2015
+ }
2016
+ }
2017
+
1772
2018
  // src/tools/get-collection-schema.ts
1773
2019
  import { SERVER_COLLECTIONS as SERVER_COLLECTIONS3 } from "@01.software/sdk";
1774
2020
 
@@ -1783,8 +2029,8 @@ async function getCollectionSchema(collection) {
1783
2029
  }
1784
2030
 
1785
2031
  // src/tools/get-collection-schema.ts
1786
- var schema22 = createCollectionSchemaToolInputSchema(SERVER_COLLECTIONS3).shape;
1787
- var metadata22 = {
2032
+ var schema24 = createCollectionSchemaToolInputSchema(SERVER_COLLECTIONS3).shape;
2033
+ var metadata24 = {
1788
2034
  name: "get-collection-schema",
1789
2035
  description: "Get the authoritative tenant-aware collection schema from console. Use this before create/update to understand writable fields, hidden fields, required metadata, and collection-level visibility.",
1790
2036
  annotations: {
@@ -1812,6 +2058,11 @@ async function getCollectionSchemaTool({
1812
2058
  function getTenantContextPath(includeCounts) {
1813
2059
  return includeCounts ? "/api/tenants/context?counts=true" : "/api/tenants/context";
1814
2060
  }
2061
+ function getTenantFeatureProgressPath(feature, includeEvidence) {
2062
+ const search = new URLSearchParams({ feature });
2063
+ if (includeEvidence) search.set("includeEvidence", "true");
2064
+ return `/api/tenants/feature-progress?${search.toString()}`;
2065
+ }
1815
2066
  async function getTenantContext(includeCounts = false) {
1816
2067
  const apiKey = resolveApiKey();
1817
2068
  const data = await consoleGet(
@@ -1820,10 +2071,18 @@ async function getTenantContext(includeCounts = false) {
1820
2071
  );
1821
2072
  return tenantContextResponseSchema.parse(data);
1822
2073
  }
2074
+ async function getTenantFeatureProgress(feature, includeEvidence = false) {
2075
+ const apiKey = resolveApiKey();
2076
+ const data = await consoleGet(
2077
+ getTenantFeatureProgressPath(feature, includeEvidence),
2078
+ apiKey
2079
+ );
2080
+ return tenantFeatureProgressResponseSchema.parse(data);
2081
+ }
1823
2082
 
1824
2083
  // src/tools/get-tenant-context.ts
1825
- var schema23 = tenantContextToolInputSchema.shape;
1826
- var metadata23 = {
2084
+ var schema25 = tenantContextToolInputSchema.shape;
2085
+ var metadata25 = {
1827
2086
  name: "get-tenant-context",
1828
2087
  description: "Get current tenant features, active collections, and field visibility. Call this at the start of every session. Use includeCounts=true to also get per-collection document counts for setup diagnostics.",
1829
2088
  annotations: {
@@ -1899,8 +2158,32 @@ async function handler({
1899
2158
  }
1900
2159
  }
1901
2160
 
2161
+ // src/tools/check-feature-progress.ts
2162
+ var schema26 = tenantFeatureProgressInputSchema.shape;
2163
+ var metadata26 = {
2164
+ name: "check-feature-progress",
2165
+ description: "Check tenant implementation progress for a supported feature. Start with feature=ecommerce to inspect catalog, cart, checkout, payment result, webhook, and operations readiness without mutating tenant data.",
2166
+ annotations: {
2167
+ title: "Check Feature Progress",
2168
+ readOnlyHint: true,
2169
+ destructiveHint: false,
2170
+ idempotentHint: true
2171
+ }
2172
+ };
2173
+ async function handler2({
2174
+ feature,
2175
+ includeEvidence
2176
+ }) {
2177
+ try {
2178
+ const progress = await getTenantFeatureProgress(feature, includeEvidence);
2179
+ return toolSuccess({ progress });
2180
+ } catch (error) {
2181
+ return toolError(error);
2182
+ }
2183
+ }
2184
+
1902
2185
  // src/tools/list-configurable-fields.ts
1903
- import { z as z22 } from "zod";
2186
+ import { z as z24 } from "zod";
1904
2187
 
1905
2188
  // src/lib/field-config.ts
1906
2189
  async function fetchFieldConfigs() {
@@ -1923,12 +2206,12 @@ function invalidateFieldConfigCache() {
1923
2206
  }
1924
2207
 
1925
2208
  // src/tools/list-configurable-fields.ts
1926
- var schema24 = {
1927
- collection: z22.string().optional().describe(
2209
+ var schema27 = {
2210
+ collection: z24.string().optional().describe(
1928
2211
  "Filter by collection slug (optional \u2014 returns all if omitted). Use this filter to reduce response size when you know which collection to check."
1929
2212
  )
1930
2213
  };
1931
- var metadata24 = {
2214
+ var metadata27 = {
1932
2215
  name: "list-configurable-fields",
1933
2216
  description: "List all configurable fields for tenant collections with current visibility state. Shows which fields can be shown/hidden and their current status. Returns all collections including inactive features \u2014 cross-reference with get-tenant-context for active features. Response includes ~300 fields across 47 collections \u2014 use collection filter when possible.",
1934
2217
  annotations: {
@@ -1959,17 +2242,17 @@ async function listConfigurableFields(params) {
1959
2242
  }
1960
2243
 
1961
2244
  // src/tools/update-field-config.ts
1962
- import { z as z23 } from "zod";
1963
- var schema25 = {
1964
- collection: z23.string().min(1).describe("Collection slug (required)"),
1965
- hiddenFields: z23.array(z23.string().min(1).max(200)).max(300).describe(
2245
+ import { z as z25 } from "zod";
2246
+ var schema28 = {
2247
+ collection: z25.string().min(1).describe("Collection slug (required)"),
2248
+ hiddenFields: z25.array(z25.string().min(1).max(200)).max(300).describe(
1966
2249
  "Fields to hide (required). This is a FULL REPLACE \u2014 fields NOT in this list will be shown. Pass [] to show all fields. Use list-configurable-fields first to see available field paths."
1967
2250
  ),
1968
- isHidden: z23.boolean().optional().describe(
2251
+ isHidden: z25.boolean().optional().describe(
1969
2252
  "Hide the entire collection from Admin Panel (optional). When true, individual hiddenFields are irrelevant."
1970
2253
  )
1971
2254
  };
1972
- var metadata25 = {
2255
+ var metadata28 = {
1973
2256
  name: "update-field-config",
1974
2257
  description: "Update field visibility configuration for a tenant collection. Hidden fields are removed from the Admin Panel UI. IMPORTANT: hiddenFields is a full replace, not a merge. Always call list-configurable-fields first to see current state.",
1975
2258
  annotations: {
@@ -1997,7 +2280,7 @@ async function updateFieldConfig(params) {
1997
2280
  }
1998
2281
 
1999
2282
  // src/tools/sdk-get-recipe.ts
2000
- import { z as z24 } from "zod";
2283
+ import { z as z26 } from "zod";
2001
2284
 
2002
2285
  // src/lib/sdk-recipes.ts
2003
2286
  var recipes = {
@@ -2429,8 +2712,8 @@ function getRecipe(goal, runtime = "both") {
2429
2712
  }
2430
2713
 
2431
2714
  // src/tools/sdk-get-recipe.ts
2432
- var schema26 = {
2433
- goal: z24.enum([
2715
+ var schema29 = {
2716
+ goal: z26.enum([
2434
2717
  "fetch-list",
2435
2718
  "fetch-by-id",
2436
2719
  "create-item",
@@ -2442,11 +2725,11 @@ var schema26 = {
2442
2725
  "file-upload",
2443
2726
  "bulk-operations"
2444
2727
  ]).describe("What the user wants to accomplish"),
2445
- runtime: z24.enum(["browser", "server", "both"]).default("both").describe("Target runtime environment"),
2446
- collection: z24.string().optional().describe("Specific collection name if applicable"),
2447
- includeExample: z24.boolean().default(true).describe("Whether to include a full code example")
2728
+ runtime: z26.enum(["browser", "server", "both"]).default("both").describe("Target runtime environment"),
2729
+ collection: z26.string().optional().describe("Specific collection name if applicable"),
2730
+ includeExample: z26.boolean().default(true).describe("Whether to include a full code example")
2448
2731
  };
2449
- var metadata26 = {
2732
+ var metadata29 = {
2450
2733
  name: "sdk-get-recipe",
2451
2734
  description: "Get a complete SDK code recipe for a specific task. Returns recommended approach, code example, and related documentation links. Use this FIRST when the user asks how to do something with the SDK.",
2452
2735
  annotations: {
@@ -2456,7 +2739,7 @@ var metadata26 = {
2456
2739
  idempotentHint: true
2457
2740
  }
2458
2741
  };
2459
- function handler2({
2742
+ function handler3({
2460
2743
  goal,
2461
2744
  runtime,
2462
2745
  collection,
@@ -2489,7 +2772,7 @@ function handler2({
2489
2772
  }
2490
2773
 
2491
2774
  // src/tools/sdk-search-docs.ts
2492
- import { z as z25 } from "zod";
2775
+ import { z as z27 } from "zod";
2493
2776
 
2494
2777
  // src/lib/sdk-doc-index.ts
2495
2778
  var docIndex = [
@@ -2664,11 +2947,11 @@ function searchDocs(query, limit = 5) {
2664
2947
  }
2665
2948
 
2666
2949
  // src/tools/sdk-search-docs.ts
2667
- var schema27 = {
2668
- query: z25.string().min(2).describe('Search keyword or phrase (e.g. "infinite scroll", "webhook", "customer login")'),
2669
- limit: z25.number().min(1).max(10).default(5).describe("Maximum results to return (1-10, default: 5)")
2950
+ var schema30 = {
2951
+ query: z27.string().min(2).describe('Search keyword or phrase (e.g. "infinite scroll", "webhook", "customer login")'),
2952
+ limit: z27.number().min(1).max(10).default(5).describe("Maximum results to return (1-10, default: 5)")
2670
2953
  };
2671
- var metadata27 = {
2954
+ var metadata30 = {
2672
2955
  name: "sdk-search-docs",
2673
2956
  description: "Search SDK documentation by keyword. Returns matching topics with summaries and resource links. Use when looking for specific SDK features or patterns.",
2674
2957
  annotations: {
@@ -2678,7 +2961,7 @@ var metadata27 = {
2678
2961
  idempotentHint: true
2679
2962
  }
2680
2963
  };
2681
- function handler3({
2964
+ function handler4({
2682
2965
  query,
2683
2966
  limit
2684
2967
  }) {
@@ -2703,9 +2986,9 @@ function handler3({
2703
2986
  }
2704
2987
 
2705
2988
  // src/tools/sdk-get-auth-setup.ts
2706
- import { z as z26 } from "zod";
2707
- var schema28 = {
2708
- scenario: z26.enum([
2989
+ import { z as z28 } from "zod";
2990
+ var schema31 = {
2991
+ scenario: z28.enum([
2709
2992
  "browser-client",
2710
2993
  "server-client",
2711
2994
  "customer-auth",
@@ -2714,7 +2997,7 @@ var schema28 = {
2714
2997
  "webhook-verification"
2715
2998
  ]).describe("Authentication scenario")
2716
2999
  };
2717
- var metadata28 = {
3000
+ var metadata31 = {
2718
3001
  name: "sdk-get-auth-setup",
2719
3002
  description: "Get the current authentication setup for a specific scenario. Returns env var names, code snippets, and security notes.",
2720
3003
  annotations: {
@@ -2853,7 +3136,7 @@ export async function POST(request: Request) {
2853
3136
  ]
2854
3137
  }
2855
3138
  };
2856
- function handler4({
3139
+ function handler5({
2857
3140
  scenario
2858
3141
  }) {
2859
3142
  try {
@@ -2868,14 +3151,14 @@ function handler4({
2868
3151
  }
2869
3152
 
2870
3153
  // src/tools/sdk-get-collection-pattern.ts
2871
- import { z as z27 } from "zod";
3154
+ import { z as z29 } from "zod";
2872
3155
  import { COLLECTIONS, SERVER_COLLECTIONS as SERVER_COLLECTIONS4 } from "@01.software/sdk";
2873
- var schema29 = {
2874
- collection: z27.enum(SERVER_COLLECTIONS4).describe("Collection name"),
2875
- operation: z27.enum(["read", "write", "full-crud"]).default("read").describe("What operations are needed"),
2876
- surface: z27.enum(["query-builder", "react-query", "server-api"]).default("query-builder").describe("Preferred API surface")
3156
+ var schema32 = {
3157
+ collection: z29.enum(SERVER_COLLECTIONS4).describe("Collection name"),
3158
+ operation: z29.enum(["read", "write", "full-crud"]).default("read").describe("What operations are needed"),
3159
+ surface: z29.enum(["query-builder", "react-query", "server-api"]).default("query-builder").describe("Preferred API surface")
2877
3160
  };
2878
- var metadata29 = {
3161
+ var metadata32 = {
2879
3162
  name: "sdk-get-collection-pattern",
2880
3163
  description: "Get the recommended CRUD pattern for a specific collection. Returns code examples for the chosen API surface and operation type.",
2881
3164
  annotations: {
@@ -3048,7 +3331,7 @@ function generatePattern(collection, operation, surface) {
3048
3331
  ].filter(Boolean)
3049
3332
  };
3050
3333
  }
3051
- function handler5({
3334
+ function handler6({
3052
3335
  collection,
3053
3336
  operation,
3054
3337
  surface
@@ -3076,14 +3359,14 @@ function handler5({
3076
3359
  }
3077
3360
 
3078
3361
  // src/prompts/sdk-usage-guide.ts
3079
- import { z as z28 } from "zod";
3080
- var schema30 = {
3081
- goal: z28.string().describe('What the user wants to accomplish (e.g., "query product list", "create order")'),
3082
- runtime: z28.enum(["browser", "server"]).optional().describe("Target runtime: browser (React/Next.js client) or server (Node.js)"),
3083
- surface: z28.enum(["query-builder", "react-query", "customer-api", "server-api"]).optional().describe("Preferred API surface"),
3084
- collection: z28.string().optional().describe("Specific collection if relevant")
3362
+ import { z as z30 } from "zod";
3363
+ var schema33 = {
3364
+ goal: z30.string().describe('What the user wants to accomplish (e.g., "query product list", "create order")'),
3365
+ runtime: z30.enum(["browser", "server"]).optional().describe("Target runtime: browser (React/Next.js client) or server (Node.js)"),
3366
+ surface: z30.enum(["query-builder", "react-query", "customer-api", "server-api"]).optional().describe("Preferred API surface"),
3367
+ collection: z30.string().optional().describe("Specific collection if relevant")
3085
3368
  };
3086
- var metadata30 = {
3369
+ var metadata33 = {
3087
3370
  name: "sdk-usage-guide",
3088
3371
  title: "SDK Usage Guide",
3089
3372
  description: "Provides guidance on how to perform a specific task using the 01.software SDK",
@@ -3216,18 +3499,44 @@ const client = createServerClient({
3216
3499
  })
3217
3500
  \`\`\`
3218
3501
 
3219
- You can perform the "${goal}" task by following the patterns above.`;
3502
+ You can perform the "${goal}" task by following the patterns above.
3503
+
3504
+ ## Common recipes
3505
+
3506
+ ### Product detail page (slug-based)
3507
+
3508
+ \`\`\`typescript
3509
+ const product = await client.commerce.product.detail({ slug })
3510
+ if (!product) return notFound()
3511
+ // product: { product, variants, options, brand, categories, tags, images, videos, listing }
3512
+ \`\`\`
3513
+
3514
+ For React: \`const { data } = client.query.useProductDetailBySlug(slug)\`.
3515
+
3516
+ ### Product listing (grouped)
3517
+
3518
+ \`\`\`typescript
3519
+ const { docs } = await client.commerce.product.listingGroups({ productIds })
3520
+ \`\`\`
3521
+
3522
+ ### Stock check before adding to cart
3523
+
3524
+ \`\`\`typescript
3525
+ const { allAvailable } = await client.commerce.product.stockCheck({
3526
+ items: [{ variantId, quantity }],
3527
+ })
3528
+ \`\`\``;
3220
3529
  }
3221
3530
 
3222
3531
  // src/prompts/collection-query-help.ts
3223
- import { z as z29 } from "zod";
3532
+ import { z as z31 } from "zod";
3224
3533
  import { COLLECTIONS as COLLECTIONS2, SERVER_COLLECTIONS as SERVER_COLLECTIONS5 } from "@01.software/sdk";
3225
- var schema31 = {
3226
- collection: z29.enum(SERVER_COLLECTIONS5).describe("Collection name"),
3227
- operation: z29.enum(["find", "create", "update", "delete"]).describe("Operation to perform (find, create, update, delete)"),
3228
- filters: z29.string().optional().describe("Filter conditions (JSON string, optional)")
3534
+ var schema34 = {
3535
+ collection: z31.enum(SERVER_COLLECTIONS5).describe("Collection name"),
3536
+ operation: z31.enum(["find", "create", "update", "delete"]).describe("Operation to perform (find, create, update, delete)"),
3537
+ filters: z31.string().optional().describe("Filter conditions (JSON string, optional)")
3229
3538
  };
3230
- var metadata31 = {
3539
+ var metadata34 = {
3231
3540
  name: "collection-query-help",
3232
3541
  title: "Collection Query Help",
3233
3542
  description: "Provides guidance on how to write queries for a specific collection",
@@ -3319,16 +3628,16 @@ ${operation === "find" ? `- Use \`where\` option for filtering (Payload query sy
3319
3628
  }
3320
3629
 
3321
3630
  // src/prompts/order-flow-guide.ts
3322
- import { z as z30 } from "zod";
3323
- var schema32 = {
3324
- scenario: z30.enum([
3631
+ import { z as z32 } from "zod";
3632
+ var schema35 = {
3633
+ scenario: z32.enum([
3325
3634
  "simple-order",
3326
3635
  "cart-checkout",
3327
3636
  "return-refund",
3328
3637
  "fulfillment-tracking"
3329
3638
  ]).describe("Order flow scenario")
3330
3639
  };
3331
- var metadata32 = {
3640
+ var metadata35 = {
3332
3641
  name: "order-flow-guide",
3333
3642
  title: "Order Flow Guide",
3334
3643
  description: "Provides step-by-step guidance for ecommerce order flows including creation, checkout, returns, and fulfillment.",
@@ -3513,9 +3822,9 @@ ${SCENARIOS[scenario] || "Unknown scenario."}
3513
3822
  }
3514
3823
 
3515
3824
  // src/prompts/feature-setup-guide.ts
3516
- import { z as z31 } from "zod";
3517
- var schema33 = {
3518
- feature: z31.enum([
3825
+ import { z as z33 } from "zod";
3826
+ var schema36 = {
3827
+ feature: z33.enum([
3519
3828
  "ecommerce",
3520
3829
  "customers",
3521
3830
  "articles",
@@ -3530,10 +3839,10 @@ var schema33 = {
3530
3839
  "community"
3531
3840
  ]).describe("Feature to get setup guide for")
3532
3841
  };
3533
- var metadata33 = {
3842
+ var metadata36 = {
3534
3843
  name: "feature-setup-guide",
3535
3844
  title: "Feature Setup Guide",
3536
- description: "Setup checklist and remediation guide for a tenant feature. Load before using get-tenant-context to diagnose setup gaps.",
3845
+ description: "Setup checklist and remediation guide for a tenant feature. Load with check-feature-progress and get-tenant-context to diagnose setup gaps.",
3537
3846
  role: "assistant"
3538
3847
  };
3539
3848
  var FEATURES = {
@@ -3563,6 +3872,7 @@ product-options, product-option-values, product-categories, product-tags, produc
3563
3872
  ### Config
3564
3873
 
3565
3874
  - **Webhook URL** must be configured in tenant settings for payment gateway callbacks
3875
+ - Use \`check-feature-progress\` for the tenant-aware ecommerce progress check
3566
3876
  - Use \`get-tenant-context\` to check current webhook configuration`,
3567
3877
  customers: `## Customers Setup Guide
3568
3878
 
@@ -3729,18 +4039,19 @@ function featureSetupGuide({
3729
4039
  ${FEATURES[feature] || "Unknown feature."}
3730
4040
 
3731
4041
  ## Related MCP Tools
4042
+ - \`check-feature-progress\` \u2014 run the tenant-aware ecommerce implementation progress check
3732
4043
  - \`get-tenant-context\` \u2014 check current collection counts and feature status
3733
4044
  - \`query-collection\` \u2014 verify existing documents in a collection
3734
4045
  - \`get-collection-schema\` \u2014 inspect tenant-aware fields before creating data via SDK or Console UI`;
3735
4046
  }
3736
4047
 
3737
4048
  // src/resources/(config)/app.ts
3738
- var metadata34 = {
4049
+ var metadata37 = {
3739
4050
  name: "app-config",
3740
4051
  title: "Application Config",
3741
4052
  description: "01.software SDK and MCP server configuration information"
3742
4053
  };
3743
- function handler6() {
4054
+ function handler7() {
3744
4055
  return `# 01.software MCP Server Configuration
3745
4056
 
3746
4057
  ## Server Info
@@ -3758,15 +4069,16 @@ HTTP MCP uses OAuth discovery and Authorization Code + PKCE.
3758
4069
  url = "https://mcp.01.software/mcp"
3759
4070
  \`\`\`
3760
4071
 
3761
- ## Hosted HTTP OAuth Tools (8)
4072
+ ## Hosted HTTP OAuth Tools (9)
3762
4073
 
3763
4074
  The hosted HTTP MCP endpoint at https://mcp.01.software/mcp exposes only these OAuth-safe tools:
3764
4075
 
3765
4076
  ### Schema (1)
3766
4077
  - \`get-collection-schema\` - Get authoritative tenant-aware collection schema
3767
4078
 
3768
- ### Tenant Context (1)
4079
+ ### Tenant Context (2)
3769
4080
  - \`get-tenant-context\` - Get tenant features, active collections, and field config
4081
+ - \`check-feature-progress\` - Check ecommerce implementation progress without mutating tenant data
3770
4082
 
3771
4083
  ### Field Config (2)
3772
4084
  - \`list-configurable-fields\` - List configurable fields and current hidden state
@@ -3778,7 +4090,7 @@ The hosted HTTP MCP endpoint at https://mcp.01.software/mcp exposes only these O
3778
4090
  - \`sdk-get-auth-setup\` - Get framework-specific auth setup guidance
3779
4091
  - \`sdk-get-collection-pattern\` - Get collection-specific usage patterns
3780
4092
 
3781
- ## Local CLI Stdio Surface (29)
4093
+ ## Local CLI Stdio Surface (30)
3782
4094
 
3783
4095
  For trusted local server-key workflows, start the stdio server:
3784
4096
 
@@ -3786,7 +4098,7 @@ For trusted local server-key workflows, start the stdio server:
3786
4098
  npx @01.software/cli mcp
3787
4099
  \`\`\`
3788
4100
 
3789
- Local stdio can expose generic read, order, return, cart, validation, stock, schema, tenant context, field config, and guidance tools. Generic collection write tools (create/update/delete/update-many/delete-many) are intentionally absent on every transport; use the SDK server client for generic writes.
4101
+ Local stdio can expose generic read, order, return, cart, validation, stock, schema, tenant context, feature progress, field config, and guidance tools. Generic collection write tools (create/update/delete/update-many/delete-many) are intentionally absent on every transport; use the SDK server client for generic writes.
3790
4102
 
3791
4103
  ## Rate Limits
3792
4104
 
@@ -3800,7 +4112,7 @@ Rate limits depend on your tenant plan:
3800
4112
 
3801
4113
  // src/resources/(collections)/schema.ts
3802
4114
  import { COLLECTIONS as COLLECTIONS3 } from "@01.software/sdk";
3803
- var metadata35 = {
4115
+ var metadata38 = {
3804
4116
  name: "collections-schema",
3805
4117
  title: "Collection Schema Info",
3806
4118
  description: "Available collections and their schema information"
@@ -3824,7 +4136,12 @@ var COLLECTIONS_BY_CATEGORY = {
3824
4136
  "fulfillments",
3825
4137
  "fulfillment-items"
3826
4138
  ],
3827
- "Shipping & Returns": ["returns", "return-items", "shipping-policies"],
4139
+ "Shipping & Returns": [
4140
+ "returns",
4141
+ "return-items",
4142
+ "shipping-policies",
4143
+ "shipping-zones"
4144
+ ],
3828
4145
  Customers: [
3829
4146
  "customers",
3830
4147
  "customer-profiles",
@@ -3832,7 +4149,7 @@ var COLLECTIONS_BY_CATEGORY = {
3832
4149
  "customer-addresses"
3833
4150
  ],
3834
4151
  Carts: ["carts", "cart-items"],
3835
- "Discounts & Promotions": ["discounts", "promotions"],
4152
+ Discounts: ["discounts"],
3836
4153
  Documents: ["documents", "document-categories", "document-types"],
3837
4154
  Articles: [
3838
4155
  "articles",
@@ -3846,9 +4163,7 @@ var COLLECTIONS_BY_CATEGORY = {
3846
4163
  "reactions",
3847
4164
  "reaction-types",
3848
4165
  "bookmarks",
3849
- "post-categories",
3850
- "reports",
3851
- "community-bans"
4166
+ "post-categories"
3852
4167
  ],
3853
4168
  Playlists: [
3854
4169
  "playlists",
@@ -3886,7 +4201,7 @@ var COLLECTIONS_BY_CATEGORY = {
3886
4201
  "event-tags"
3887
4202
  ]
3888
4203
  };
3889
- function handler7() {
4204
+ function handler8() {
3890
4205
  const categoryDocs = Object.entries(COLLECTIONS_BY_CATEGORY).map(([category, collections]) => {
3891
4206
  const collectionList = collections.filter((c) => COLLECTIONS3.includes(c)).map((c) => `- **${c}**`).join("\n");
3892
4207
  return `## ${category}
@@ -3938,12 +4253,12 @@ Total available collections: ${COLLECTIONS3.length}`;
3938
4253
  }
3939
4254
 
3940
4255
  // src/resources/(docs)/getting-started.ts
3941
- var metadata36 = {
4256
+ var metadata39 = {
3942
4257
  name: "docs-getting-started",
3943
4258
  title: "Getting Started",
3944
4259
  description: "01.software SDK getting started guide"
3945
4260
  };
3946
- function handler8() {
4261
+ function handler9() {
3947
4262
  return `# Getting Started
3948
4263
 
3949
4264
  A guide to getting started with the 01.software SDK.
@@ -3977,18 +4292,18 @@ const result = await client.collections.from('products').find({
3977
4292
 
3978
4293
  ## Next Steps
3979
4294
 
3980
- - [Quick Start](/docs/getting-started/quick-start) - Get started in 5 minutes
3981
- - [Configuration](/docs/getting-started/configuration) - Detailed configuration options
3982
- - [API Reference](/docs/api) - Full API documentation`;
4295
+ - [SDK Guide](/developers/sdk) - Install and query workspace content
4296
+ - [Authentication & Keys](/developers/authentication) - Choose the right key for each surface
4297
+ - [API](/developers/api) - Use the HTTP API when SDKs are not a fit`;
3983
4298
  }
3984
4299
 
3985
4300
  // src/resources/(docs)/guides.ts
3986
- var metadata37 = {
4301
+ var metadata40 = {
3987
4302
  name: "docs-guides",
3988
4303
  title: "Guides",
3989
4304
  description: "01.software SDK usage guides"
3990
4305
  };
3991
- function handler9() {
4306
+ function handler10() {
3992
4307
  return `# Guides
3993
4308
 
3994
4309
  Comprehensive guides to master the 01.software SDK.
@@ -4190,16 +4505,16 @@ Payload query syntax operators:
4190
4505
 
4191
4506
  For ecommerce collections, \`products.listing.*\` is the browse/search projection. Authoritative sellable price and stock remain on \`product-variants\`.
4192
4507
 
4193
- For more detailed guides, see the [Guides page](/docs/guides).`;
4508
+ For more implementation guidance, see the [SDK Guide](/developers/sdk).`;
4194
4509
  }
4195
4510
 
4196
4511
  // src/resources/(docs)/api.ts
4197
- var metadata38 = {
4512
+ var metadata41 = {
4198
4513
  name: "docs-api",
4199
4514
  title: "API Reference",
4200
4515
  description: "01.software SDK API reference documentation"
4201
4516
  };
4202
- function handler10() {
4517
+ function handler11() {
4203
4518
  return `# API Reference
4204
4519
 
4205
4520
  Comprehensive documentation for all methods and types in the 01.software SDK.
@@ -4476,16 +4791,16 @@ client.customer.isAuthenticated() // Check auth status
4476
4791
  client.customer.logout() // Clear token
4477
4792
  \`\`\`
4478
4793
 
4479
- For more details, see the [full API documentation](/docs/api).`;
4794
+ For more details, see the [API documentation](/developers/api).`;
4480
4795
  }
4481
4796
 
4482
4797
  // src/resources/(docs)/query-builder.ts
4483
- var metadata39 = {
4798
+ var metadata42 = {
4484
4799
  name: "docs-query-builder",
4485
4800
  title: "Query Builder",
4486
4801
  description: "01.software SDK Query Builder API reference (client.collections.from)"
4487
4802
  };
4488
- function handler11() {
4803
+ function handler12() {
4489
4804
  return `# Query Builder API
4490
4805
 
4491
4806
  The Query Builder provides a fluent interface for querying collections via \`client.collections.from(collection)\`.
@@ -4674,12 +4989,12 @@ console.log(result.hasNextPage) // true
4674
4989
  }
4675
4990
 
4676
4991
  // src/resources/(docs)/react-query.ts
4677
- var metadata40 = {
4992
+ var metadata43 = {
4678
4993
  name: "docs-react-query",
4679
4994
  title: "React Query Hooks",
4680
4995
  description: "01.software SDK React Query hooks reference (client.query)"
4681
4996
  };
4682
- function handler12() {
4997
+ function handler13() {
4683
4998
  return `# React Query Hooks
4684
4999
 
4685
5000
  React Query hooks are available on the browser-side \`Client\` via \`client.query\`. They provide automatic caching, background refetching, and cache invalidation.
@@ -4922,12 +5237,12 @@ export function ProductList() {
4922
5237
  }
4923
5238
 
4924
5239
  // src/resources/(docs)/server-api.ts
4925
- var metadata41 = {
5240
+ var metadata44 = {
4926
5241
  name: "docs-server-api",
4927
5242
  title: "Server-side API",
4928
5243
  description: "01.software SDK server-side API reference (client.commerce) for orders, fulfillments, returns, carts, and validation"
4929
5244
  };
4930
- function handler13() {
5245
+ function handler14() {
4931
5246
  return `# Server-side API
4932
5247
 
4933
5248
  Server-side operations are available via \`client.commerce\` on \`ServerClient\`. Use \`createServerClient\` with both \`publishableKey\` and \`secretKey\`.
@@ -5184,12 +5499,12 @@ const result = await client.commerce.shipping.calculate({
5184
5499
  }
5185
5500
 
5186
5501
  // src/resources/(docs)/customer-auth.ts
5187
- var metadata42 = {
5502
+ var metadata45 = {
5188
5503
  name: "docs-customer-auth",
5189
5504
  title: "Customer Auth API",
5190
5505
  description: "01.software SDK Customer Auth API reference (client.customer)"
5191
5506
  };
5192
- function handler14() {
5507
+ function handler15() {
5193
5508
  return `# Customer Auth API
5194
5509
 
5195
5510
  Customer authentication and profile management is available via \`client.customer\` on the browser-side \`Client\`.
@@ -5362,12 +5677,12 @@ async function loadProfile() {
5362
5677
  }
5363
5678
 
5364
5679
  // src/resources/(docs)/browser-vs-server.ts
5365
- var metadata43 = {
5680
+ var metadata46 = {
5366
5681
  name: "docs-browser-vs-server",
5367
5682
  title: "Client vs ServerClient",
5368
5683
  description: "When to use Client (createClient) vs ServerClient (createServerClient) in the 01.software SDK"
5369
5684
  };
5370
- function handler15() {
5685
+ function handler16() {
5371
5686
  return `# Client vs ServerClient
5372
5687
 
5373
5688
  The SDK provides two client types for different execution environments.
@@ -5521,12 +5836,12 @@ export function ProductList() {
5521
5836
  }
5522
5837
 
5523
5838
  // src/resources/(docs)/file-upload.ts
5524
- var metadata44 = {
5839
+ var metadata47 = {
5525
5840
  name: "docs-file-upload",
5526
5841
  title: "File Upload",
5527
5842
  description: "01.software SDK file upload patterns using the images collection"
5528
5843
  };
5529
- function handler16() {
5844
+ function handler17() {
5530
5845
  return `# File Upload
5531
5846
 
5532
5847
  Upload files using the \`images\` collection (tenant-scoped, unified image store) or \`system-media\` (global, non-tenant).
@@ -5672,12 +5987,12 @@ The platform stores files in Cloudflare R2 and serves via CDN (\`cdn.01.software
5672
5987
  }
5673
5988
 
5674
5989
  // src/resources/(docs)/webhook.ts
5675
- var metadata45 = {
5990
+ var metadata48 = {
5676
5991
  name: "docs-webhook",
5677
5992
  title: "Webhooks",
5678
5993
  description: "01.software SDK webhook verification and event handling"
5679
5994
  };
5680
- function handler17() {
5995
+ function handler18() {
5681
5996
  return `# Webhooks
5682
5997
 
5683
5998
  The platform dispatches HMAC-SHA256 signed webhook events to your registered URLs. Tenant developers own routing inside their webhook handler.
@@ -5785,9 +6100,91 @@ Failed webhook deliveries are queued with automatic retries. Ensure your handler
5785
6100
  Configure webhook URLs in the 01.software console under Tenant Settings > Webhooks. Multiple URLs can be registered; all receive every event.`;
5786
6101
  }
5787
6102
 
6103
+ // src/resources/(docs)/product-detail.ts
6104
+ var metadata49 = {
6105
+ name: "docs-product-detail",
6106
+ title: "Product Detail Helper",
6107
+ description: "01.software SDK commerce.product.detail helper guide"
6108
+ };
6109
+ function handler19() {
6110
+ return `# Product Detail Helper
6111
+
6112
+ ## When to use the helper vs the raw query builder
6113
+
6114
+ Use \`client.commerce.product.detail({ slug | id })\` when you need a full product detail page payload in one call. The helper folds the Payload query, access policy, and response shaping (variants, options, option value slugs/media, brand, categories, tags, images, videos, listing rollup) into a single call.
6115
+
6116
+ Use \`client.collections.from('products').find(...)\` (escape hatch) when you need bulk reads, custom filter combinations, or fields outside the helper response shape.
6117
+
6118
+ ## Single-call example
6119
+
6120
+ \`\`\`typescript
6121
+ import { createClient, resolveProductSelection } from '@01.software/sdk'
6122
+
6123
+ const client = createClient({
6124
+ publishableKey: process.env.NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY!,
6125
+ })
6126
+
6127
+ const detail = await client.commerce.product.detail({ slug: 'my-product' })
6128
+ if (!detail) return notFound()
6129
+ const selection = resolveProductSelection(detail, {
6130
+ search: '?opt.color=black&opt.size=large',
6131
+ })
6132
+ // selection.selectedVariant, selection.price, selection.stock, selection.media
6133
+ \`\`\`
6134
+
6135
+ ## URL round-trip
6136
+
6137
+ Use the SDK codec for one canonical selection URL format: \`opt.<optionSlug>=<valueSlug>\`. Option and value slugs are the stable public tokens exposed by product detail.
6138
+
6139
+ \`\`\`typescript
6140
+ import { createProductSelectionCodec } from '@01.software/sdk'
6141
+
6142
+ const codec = createProductSelectionCodec(detail)
6143
+ const selection = codec.parse('?opt.color=black')
6144
+ const href = codec.stringify(selection)
6145
+ \`\`\`
6146
+
6147
+ Value-slug-only URLs such as \`?black\` or \`?color=black\` are rejected because option titles are not stable identifiers.
6148
+
6149
+ ## React Query hook variant
6150
+
6151
+ \`\`\`typescript
6152
+ const { data: detail, isLoading } = client.query.useProductDetailBySlug(slug)
6153
+ \`\`\`
6154
+
6155
+ Cache invalidates automatically when any of 10 detail-relevant collections is mutated through SDK mutation hooks.
6156
+
6157
+ ## SSG / Server Component snippet
6158
+
6159
+ \`\`\`tsx
6160
+ // app/products/[slug]/page.tsx
6161
+ import { createClient } from '@01.software/sdk'
6162
+ import { notFound } from 'next/navigation'
6163
+
6164
+ export const revalidate = 60
6165
+
6166
+ export default async function ProductPage({ params }: { params: { slug: string } }) {
6167
+ const client = createClient({
6168
+ publishableKey: process.env.NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY!,
6169
+ })
6170
+ const detail = await client.commerce.product.detail({ slug: params.slug })
6171
+ if (!detail) return notFound()
6172
+ return <ProductView detail={detail} />
6173
+ }
6174
+ \`\`\`
6175
+
6176
+ ## The \`null\` return contract
6177
+
6178
+ The endpoint returns 404 for \`not_found\`, \`not_published\`, \`tenant_mismatch\`, or \`feature_disabled\`. The SDK collapses all 404s to \`null\` so consumer UIs render one "not available" path.
6179
+
6180
+ ## Backend correlation
6181
+
6182
+ Log \`client.lastRequestId\` against backend logs \u2014 the endpoint records the exact 404 code alongside the request ID.`;
6183
+ }
6184
+
5788
6185
  // src/server.ts
5789
6186
  var REGISTERED_TOOLS_BY_SERVER = /* @__PURE__ */ new WeakMap();
5790
- function registerTool(server, schema34, meta, handler19) {
6187
+ function registerTool(server, schema37, meta, handler21) {
5791
6188
  let registered = REGISTERED_TOOLS_BY_SERVER.get(server);
5792
6189
  if (!registered) {
5793
6190
  registered = /* @__PURE__ */ new Set();
@@ -5798,7 +6195,7 @@ function registerTool(server, schema34, meta, handler19) {
5798
6195
  meta.name,
5799
6196
  {
5800
6197
  description: meta.description,
5801
- inputSchema: schema34,
6198
+ inputSchema: schema37,
5802
6199
  annotations: meta.annotations
5803
6200
  },
5804
6201
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -5827,7 +6224,7 @@ function registerTool(server, schema34, meta, handler19) {
5827
6224
  const summary = activeSummary ?? ownSummary;
5828
6225
  let result = null;
5829
6226
  try {
5830
- result = await handler19(params);
6227
+ result = await handler21(params);
5831
6228
  return { content: [{ type: "text", text: result }] };
5832
6229
  } finally {
5833
6230
  if (summary) {
@@ -5844,26 +6241,26 @@ function registerTool(server, schema34, meta, handler19) {
5844
6241
  }
5845
6242
  );
5846
6243
  }
5847
- function registerPrompt(server, schema34, meta, handler19) {
6244
+ function registerPrompt(server, schema37, meta, handler21) {
5848
6245
  server.registerPrompt(
5849
6246
  meta.name,
5850
6247
  {
5851
6248
  title: meta.title,
5852
6249
  description: meta.description,
5853
- argsSchema: schema34
6250
+ argsSchema: schema37
5854
6251
  },
5855
6252
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5856
6253
  (params) => ({
5857
6254
  messages: [
5858
6255
  {
5859
6256
  role: meta.role ?? "assistant",
5860
- content: { type: "text", text: handler19(params) }
6257
+ content: { type: "text", text: handler21(params) }
5861
6258
  }
5862
6259
  ]
5863
6260
  })
5864
6261
  );
5865
6262
  }
5866
- function registerStaticResource(server, uri, meta, handler19) {
6263
+ function registerStaticResource(server, uri, meta, handler21) {
5867
6264
  server.registerResource(
5868
6265
  meta.name,
5869
6266
  uri,
@@ -5873,7 +6270,7 @@ function registerStaticResource(server, uri, meta, handler19) {
5873
6270
  mimeType: meta.mimeType ?? "text/plain"
5874
6271
  },
5875
6272
  async (url) => ({
5876
- contents: [{ uri: url.href, text: handler19() }]
6273
+ contents: [{ uri: url.href, text: handler21() }]
5877
6274
  })
5878
6275
  );
5879
6276
  }
@@ -5884,52 +6281,251 @@ function createServer(options = {}) {
5884
6281
  version: "0.1.0"
5885
6282
  });
5886
6283
  if (toolSurface === "full") {
5887
- registerTool(server, schema, metadata, queryCollection);
5888
- registerTool(server, schema2, metadata2, getCollectionById);
6284
+ registerTool(
6285
+ server,
6286
+ schema,
6287
+ metadata,
6288
+ queryCollection
6289
+ );
6290
+ registerTool(
6291
+ server,
6292
+ schema2,
6293
+ metadata2,
6294
+ getCollectionById
6295
+ );
5889
6296
  registerTool(server, schema3, metadata3, getOrder);
5890
6297
  registerTool(server, schema4, metadata4, createOrder);
5891
6298
  registerTool(server, schema5, metadata5, updateOrder);
5892
6299
  registerTool(server, schema6, metadata6, checkout);
5893
- registerTool(server, schema7, metadata7, createFulfillment);
5894
- registerTool(server, schema8, metadata8, updateFulfillment);
5895
- registerTool(server, schema9, metadata9, updateTransaction);
5896
- registerTool(server, schema10, metadata10, createReturn);
5897
- registerTool(server, schema11, metadata11, updateReturn);
5898
- registerTool(server, schema12, metadata12, returnWithRefund);
6300
+ registerTool(
6301
+ server,
6302
+ schema7,
6303
+ metadata7,
6304
+ createFulfillment
6305
+ );
6306
+ registerTool(
6307
+ server,
6308
+ schema8,
6309
+ metadata8,
6310
+ updateFulfillment
6311
+ );
6312
+ registerTool(
6313
+ server,
6314
+ schema9,
6315
+ metadata9,
6316
+ updateTransaction
6317
+ );
6318
+ registerTool(
6319
+ server,
6320
+ schema10,
6321
+ metadata10,
6322
+ createReturn
6323
+ );
6324
+ registerTool(
6325
+ server,
6326
+ schema11,
6327
+ metadata11,
6328
+ updateReturn
6329
+ );
6330
+ registerTool(
6331
+ server,
6332
+ schema12,
6333
+ metadata12,
6334
+ returnWithRefund
6335
+ );
5899
6336
  registerTool(server, schema13, metadata13, addCartItem);
5900
- registerTool(server, schema14, metadata14, updateCartItem);
5901
- registerTool(server, schema15, metadata15, removeCartItem);
5902
- registerTool(server, schema16, metadata16, applyDiscount);
5903
- registerTool(server, schema17, metadata17, removeDiscount);
6337
+ registerTool(
6338
+ server,
6339
+ schema14,
6340
+ metadata14,
6341
+ updateCartItem
6342
+ );
6343
+ registerTool(
6344
+ server,
6345
+ schema15,
6346
+ metadata15,
6347
+ removeCartItem
6348
+ );
6349
+ registerTool(
6350
+ server,
6351
+ schema16,
6352
+ metadata16,
6353
+ applyDiscount
6354
+ );
6355
+ registerTool(
6356
+ server,
6357
+ schema17,
6358
+ metadata17,
6359
+ removeDiscount
6360
+ );
5904
6361
  registerTool(server, schema18, metadata18, clearCart);
5905
- registerTool(server, schema19, metadata19, validateDiscount);
5906
- registerTool(server, schema20, metadata20, calculateShipping);
6362
+ registerTool(
6363
+ server,
6364
+ schema19,
6365
+ metadata19,
6366
+ validateDiscount
6367
+ );
6368
+ registerTool(
6369
+ server,
6370
+ schema20,
6371
+ metadata20,
6372
+ calculateShipping
6373
+ );
5907
6374
  registerTool(server, schema21, metadata21, stockCheck);
6375
+ registerTool(server, schema22, metadata22, productDetail);
6376
+ registerTool(
6377
+ server,
6378
+ schema23,
6379
+ metadata23,
6380
+ productUpsert
6381
+ );
5908
6382
  }
5909
- registerTool(server, schema22, metadata22, getCollectionSchemaTool);
5910
- registerTool(server, schema23, metadata23, handler);
5911
- registerTool(server, schema24, metadata24, listConfigurableFields);
5912
- registerTool(server, schema25, metadata25, updateFieldConfig);
5913
- registerTool(server, schema26, metadata26, handler2);
5914
- registerTool(server, schema27, metadata27, handler3);
5915
- registerTool(server, schema28, metadata28, handler4);
5916
- registerTool(server, schema29, metadata29, handler5);
5917
- registerPrompt(server, schema30, metadata30, sdkUsageGuide);
5918
- registerPrompt(server, schema31, metadata31, collectionQueryHelp);
5919
- registerPrompt(server, schema32, metadata32, orderFlowGuide);
5920
- registerPrompt(server, schema33, metadata33, featureSetupGuide);
5921
- registerStaticResource(server, "config://app", metadata34, handler6);
5922
- registerStaticResource(server, "collections://schema", metadata35, handler7);
5923
- registerStaticResource(server, "docs://sdk/getting-started", metadata36, handler8);
5924
- registerStaticResource(server, "docs://sdk/guides", metadata37, handler9);
5925
- registerStaticResource(server, "docs://sdk/api", metadata38, handler10);
5926
- registerStaticResource(server, "docs://sdk/query-builder", metadata39, handler11);
5927
- registerStaticResource(server, "docs://sdk/react-query", metadata40, handler12);
5928
- registerStaticResource(server, "docs://sdk/server-api", metadata41, handler13);
5929
- registerStaticResource(server, "docs://sdk/customer-auth", metadata42, handler14);
5930
- registerStaticResource(server, "docs://sdk/browser-vs-server", metadata43, handler15);
5931
- registerStaticResource(server, "docs://sdk/file-upload", metadata44, handler16);
5932
- registerStaticResource(server, "docs://sdk/webhook", metadata45, handler17);
6383
+ registerTool(
6384
+ server,
6385
+ schema24,
6386
+ metadata24,
6387
+ getCollectionSchemaTool
6388
+ );
6389
+ registerTool(
6390
+ server,
6391
+ schema25,
6392
+ metadata25,
6393
+ handler
6394
+ );
6395
+ registerTool(
6396
+ server,
6397
+ schema26,
6398
+ metadata26,
6399
+ handler2
6400
+ );
6401
+ registerTool(
6402
+ server,
6403
+ schema27,
6404
+ metadata27,
6405
+ listConfigurableFields
6406
+ );
6407
+ registerTool(
6408
+ server,
6409
+ schema28,
6410
+ metadata28,
6411
+ updateFieldConfig
6412
+ );
6413
+ registerTool(
6414
+ server,
6415
+ schema29,
6416
+ metadata29,
6417
+ handler3
6418
+ );
6419
+ registerTool(
6420
+ server,
6421
+ schema30,
6422
+ metadata30,
6423
+ handler4
6424
+ );
6425
+ registerTool(
6426
+ server,
6427
+ schema31,
6428
+ metadata31,
6429
+ handler5
6430
+ );
6431
+ registerTool(
6432
+ server,
6433
+ schema32,
6434
+ metadata32,
6435
+ handler6
6436
+ );
6437
+ registerPrompt(
6438
+ server,
6439
+ schema33,
6440
+ metadata33,
6441
+ sdkUsageGuide
6442
+ );
6443
+ registerPrompt(
6444
+ server,
6445
+ schema34,
6446
+ metadata34,
6447
+ collectionQueryHelp
6448
+ );
6449
+ registerPrompt(
6450
+ server,
6451
+ schema35,
6452
+ metadata35,
6453
+ orderFlowGuide
6454
+ );
6455
+ registerPrompt(
6456
+ server,
6457
+ schema36,
6458
+ metadata36,
6459
+ featureSetupGuide
6460
+ );
6461
+ registerStaticResource(
6462
+ server,
6463
+ "config://app",
6464
+ metadata37,
6465
+ handler7
6466
+ );
6467
+ registerStaticResource(
6468
+ server,
6469
+ "collections://schema",
6470
+ metadata38,
6471
+ handler8
6472
+ );
6473
+ registerStaticResource(
6474
+ server,
6475
+ "docs://sdk/getting-started",
6476
+ metadata39,
6477
+ handler9
6478
+ );
6479
+ registerStaticResource(server, "docs://sdk/guides", metadata40, handler10);
6480
+ registerStaticResource(server, "docs://sdk/api", metadata41, handler11);
6481
+ registerStaticResource(
6482
+ server,
6483
+ "docs://sdk/query-builder",
6484
+ metadata42,
6485
+ handler12
6486
+ );
6487
+ registerStaticResource(
6488
+ server,
6489
+ "docs://sdk/react-query",
6490
+ metadata43,
6491
+ handler13
6492
+ );
6493
+ registerStaticResource(
6494
+ server,
6495
+ "docs://sdk/server-api",
6496
+ metadata44,
6497
+ handler14
6498
+ );
6499
+ registerStaticResource(
6500
+ server,
6501
+ "docs://sdk/customer-auth",
6502
+ metadata45,
6503
+ handler15
6504
+ );
6505
+ registerStaticResource(
6506
+ server,
6507
+ "docs://sdk/browser-vs-server",
6508
+ metadata46,
6509
+ handler16
6510
+ );
6511
+ registerStaticResource(
6512
+ server,
6513
+ "docs://sdk/file-upload",
6514
+ metadata47,
6515
+ handler17
6516
+ );
6517
+ registerStaticResource(
6518
+ server,
6519
+ "docs://sdk/webhook",
6520
+ metadata48,
6521
+ handler18
6522
+ );
6523
+ registerStaticResource(
6524
+ server,
6525
+ "docs://sdk/product-detail",
6526
+ metadata49,
6527
+ handler19
6528
+ );
5933
6529
  return server;
5934
6530
  }
5935
6531
 
@@ -6134,7 +6730,10 @@ function setCors(res) {
6134
6730
  "Access-Control-Allow-Headers",
6135
6731
  "Authorization, Content-Type, mcp-session-id"
6136
6732
  );
6137
- res.setHeader("Access-Control-Expose-Headers", "Mcp-Session-Id, Mcp-Protocol-Version");
6733
+ res.setHeader(
6734
+ "Access-Control-Expose-Headers",
6735
+ "Mcp-Session-Id, Mcp-Protocol-Version"
6736
+ );
6138
6737
  }
6139
6738
  function getHeaderValue(headers, name) {
6140
6739
  const value = headers[name.toLowerCase()];
@@ -6214,7 +6813,7 @@ HTTP OAuth Tools
6214
6813
  ----------------
6215
6814
 
6216
6815
  Schema get-collection-schema
6217
- Context get-tenant-context
6816
+ Context get-tenant-context, check-feature-progress
6218
6817
  Field Config list-configurable-fields, update-field-config
6219
6818
  Guidance sdk-get-recipe, sdk-search-docs, sdk-get-auth-setup, sdk-get-collection-pattern
6220
6819
 
@@ -6233,9 +6832,9 @@ Resources (12): config, collections-schema, getting-started, guides, api, query-
6233
6832
  Links
6234
6833
  -----
6235
6834
 
6236
- Docs https://docs.01.software/docs/developers/integrations/mcp
6237
- SDK https://docs.01.software/docs/developers/sdk/client
6238
- API Reference https://docs.01.software/docs/developers/api/rest-api
6835
+ Integrations https://docs.01.software/integrations
6836
+ Readiness https://docs.01.software/readiness
6837
+ OpenAPI https://docs.01.software/api/openapi
6239
6838
  Console https://console.01.software
6240
6839
  `;
6241
6840
  var PROTECTED_RESOURCE_METADATA = JSON.stringify({
@@ -6258,9 +6857,11 @@ function writeOAuthError(res, status, error, description) {
6258
6857
  function acceptsEventStream(req) {
6259
6858
  const accept = getHeaderValue(req.headers, "accept");
6260
6859
  if (!accept) return false;
6261
- return accept.split(",").some((entry) => entry.trim().split(";")[0]?.toLowerCase() === "text/event-stream");
6860
+ return accept.split(",").some(
6861
+ (entry) => entry.trim().split(";")[0]?.toLowerCase() === "text/event-stream"
6862
+ );
6262
6863
  }
6263
- async function handler18(req, res) {
6864
+ async function handler20(req, res) {
6264
6865
  setCors(res);
6265
6866
  if (req.method === "OPTIONS") {
6266
6867
  res.writeHead(204);
@@ -6310,7 +6911,12 @@ async function handler18(req, res) {
6310
6911
  getHeaderValue(req.headers, "authorization")
6311
6912
  );
6312
6913
  if (!auth.valid) {
6313
- writeOAuthError(res, auth.error === "insufficient_scope" ? 403 : 401, auth.error, auth.errorDescription);
6914
+ writeOAuthError(
6915
+ res,
6916
+ auth.error === "insufficient_scope" ? 403 : 401,
6917
+ auth.error,
6918
+ auth.errorDescription
6919
+ );
6314
6920
  return;
6315
6921
  }
6316
6922
  const server = createServer({ toolSurface: "oauth" });
@@ -6365,5 +6971,5 @@ function writeRequestError(res, err) {
6365
6971
  res.end(JSON.stringify({ error: "Internal server error" }));
6366
6972
  }
6367
6973
  export {
6368
- handler18 as default
6974
+ handler20 as default
6369
6975
  };