@brainerce/mcp-server 3.9.0 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/http.js +290 -4
- package/dist/bin/stdio.js +290 -4
- package/dist/index.d.mts +0 -3
- package/dist/index.d.ts +0 -3
- package/dist/index.js +290 -4
- package/dist/index.mjs +290 -4
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -703,7 +703,7 @@ const growProvider = providers.find(p => p.provider === 'grow');
|
|
|
703
703
|
const paypalProvider = providers.find(p => p.provider === 'paypal');
|
|
704
704
|
\`\`\`
|
|
705
705
|
|
|
706
|
-
Each provider has: \`id\`, \`provider\` (flexible string \u2014 \`'stripe'\`, \`'grow'\`, \`'paypal'\`, \`'cardcom'\`, \`'sandbox'\`, and future providers), \`name\`, \`publicKey\`, \`stripeAccountId\` (Stripe only), \`supportedMethods\`, \`testMode\`, \`isDefault\`.
|
|
706
|
+
Each provider has: \`id\`, \`provider\` (flexible string \u2014 \`'stripe'\`, \`'grow'\`, \`'paypal'\`, \`'cardcom'\`, \`'morning'\`, \`'takbull'\`, \`'sandbox'\`, and future providers), \`name\`, \`publicKey\`, \`stripeAccountId\` (Stripe only), \`supportedMethods\`, \`testMode\`, \`isDefault\`.
|
|
707
707
|
|
|
708
708
|
The payment intent returned from \`createPaymentIntent()\` includes a \`clientSdk\` object whose \`renderType\` tells you exactly how to render \u2014 **branch on THAT, not on the provider name**:
|
|
709
709
|
|
|
@@ -2362,6 +2362,67 @@ Read \`storeInfo.i18n.supportedLocales\` and render a switcher in the header
|
|
|
2362
2362
|
that navigates to \`/{otherLocale}/{currentPathWithoutLocale}\`. The middleware
|
|
2363
2363
|
handles the canonical redirect when the user picks the default locale.`;
|
|
2364
2364
|
}
|
|
2365
|
+
function getMultilingualSeoSection() {
|
|
2366
|
+
return `## Multilingual SEO
|
|
2367
|
+
|
|
2368
|
+
### Slugs per locale (IMPORTANT)
|
|
2369
|
+
|
|
2370
|
+
Brainerce stores per-locale slugs in \`Product.translations[locale].slug\`.
|
|
2371
|
+
The API exposes them as \`product.localeSlugs\` \u2014 a flat \`Record<string, string>\`.
|
|
2372
|
+
|
|
2373
|
+
\`\`\`typescript
|
|
2374
|
+
// product.localeSlugs = { he: '\u05DE\u05D6\u05E8\u05DF-\u05D9\u05D5\u05D2\u05D4', en: 'yoga-mattress', ar: '\u062D\u0635\u064A\u0631\u0629-\u064A\u0648\u063A\u0627' }
|
|
2375
|
+
const locSlug = product.localeSlugs?.[locale] ?? product.slug;
|
|
2376
|
+
\`\`\`
|
|
2377
|
+
|
|
2378
|
+
Use AI translation (\`translateEntities\` / the AI Translate button in the admin) to populate
|
|
2379
|
+
locale-specific slugs automatically. Until translated, all locales fall back to the base slug
|
|
2380
|
+
(which Google still accepts \u2014 it resolves to the correct locale content via Accept-Language).
|
|
2381
|
+
|
|
2382
|
+
### hreflang tags
|
|
2383
|
+
|
|
2384
|
+
Every product page in a multi-locale store MUST emit bidirectional hreflang tags or Google
|
|
2385
|
+
ignores them entirely. The scaffolded template generates them automatically when
|
|
2386
|
+
\`NEXT_PUBLIC_BRAINERCE_LOCALES=he,en\` is set.
|
|
2387
|
+
|
|
2388
|
+
\`\`\`html
|
|
2389
|
+
<!-- Example output for /en/products/yoga-mattress -->
|
|
2390
|
+
<link rel="alternate" hreflang="he" href="https://store.com/products/\u05DE\u05D6\u05E8\u05DF-\u05D9\u05D5\u05D2\u05D4" />
|
|
2391
|
+
<link rel="alternate" hreflang="en" href="https://store.com/en/products/yoga-mattress" />
|
|
2392
|
+
<link rel="alternate" hreflang="x-default" href="https://store.com/products/\u05DE\u05D6\u05E8\u05DF-\u05D9\u05D5\u05D2\u05D4" />
|
|
2393
|
+
\`\`\`
|
|
2394
|
+
|
|
2395
|
+
If building a custom storefront, add to \`generateMetadata()\`:
|
|
2396
|
+
\`\`\`typescript
|
|
2397
|
+
alternates: {
|
|
2398
|
+
canonical: locale === defaultLoc ? \`/products/\${slug}\` : \`/\${locale}/products/\${slug}\`,
|
|
2399
|
+
languages: {
|
|
2400
|
+
he: \`\${baseUrl}/products/\${localeSlugs.he ?? baseSlug}\`,
|
|
2401
|
+
en: \`\${baseUrl}/en/products/\${localeSlugs.en ?? baseSlug}\`,
|
|
2402
|
+
'x-default': \`\${baseUrl}/products/\${localeSlugs[defaultLoc] ?? baseSlug}\`,
|
|
2403
|
+
},
|
|
2404
|
+
},
|
|
2405
|
+
\`\`\`
|
|
2406
|
+
|
|
2407
|
+
### URL structure
|
|
2408
|
+
|
|
2409
|
+
Google-recommended for headless storefronts:
|
|
2410
|
+
- Default locale: \`/products/\u05DE\u05D6\u05E8\u05DF-\u05D9\u05D5\u05D2\u05D4\` (no prefix)
|
|
2411
|
+
- Other locales: \`/en/products/yoga-mattress\` (prefixed)
|
|
2412
|
+
- \u274C Never: \`?locale=he\` query params (Google rates these as "Not recommended")
|
|
2413
|
+
|
|
2414
|
+
### Sitemap
|
|
2415
|
+
|
|
2416
|
+
The scaffolded \`sitemap.ts\` generates per-locale entries automatically:
|
|
2417
|
+
\`\`\`
|
|
2418
|
+
/products/\u05DE\u05D6\u05E8\u05DF-\u05D9\u05D5\u05D2\u05D4 (he \u2014 default, no prefix)
|
|
2419
|
+
/en/products/yoga-mattress (en)
|
|
2420
|
+
/ar/products/\u062D\u0635\u064A\u0631\u0629-\u064A\u0648\u063A\u0627 (ar)
|
|
2421
|
+
\`\`\`
|
|
2422
|
+
|
|
2423
|
+
Hebrew, Arabic, and other non-Latin slugs are fully supported \u2014 Google recommends
|
|
2424
|
+
using the audience's language in URLs and indexes non-ASCII characters correctly.`;
|
|
2425
|
+
}
|
|
2365
2426
|
function getAdminApiSection() {
|
|
2366
2427
|
return `## Admin API (v0.19.0+)
|
|
2367
2428
|
|
|
@@ -2445,6 +2506,20 @@ await admin.mergeTaxClasses(food.id, standardClassId);
|
|
|
2445
2506
|
Storefront (public, no apiKey \u2014 \`storeId\` mode): \`getStoreTaxClasses()\` lists
|
|
2446
2507
|
the store's classes (storefront-safe fields only) for a transparency badge.
|
|
2447
2508
|
|
|
2509
|
+
For a buyer-facing tax preview on PDP / PLP / cart, \`estimateTax({ country,
|
|
2510
|
+
subtotal })\` returns the tax portion at the Standard rate for the buyer's
|
|
2511
|
+
country. **Non-binding** \u2014 the authoritative tax still runs at checkout with
|
|
2512
|
+
the full shipping address (state / postal / per-class). Always render with an
|
|
2513
|
+
"Estimate" affordance.
|
|
2514
|
+
|
|
2515
|
+
\`\`\`typescript
|
|
2516
|
+
const { estimatedTax, rate, currency, note } = await store.estimateTax({
|
|
2517
|
+
country: 'IT', subtotal: 100,
|
|
2518
|
+
});
|
|
2519
|
+
// \u2192 { appliesTax: true, rate: 22, estimatedTax: 22, currency: 'EUR',
|
|
2520
|
+
// note: 'Estimate \u2014 final tax calculated at checkout\u2026' }
|
|
2521
|
+
\`\`\`
|
|
2522
|
+
|
|
2448
2523
|
### Regions (multi-currency / per-region providers)
|
|
2449
2524
|
|
|
2450
2525
|
A region binds countries \u2192 currency + tax-display mode + enabled payment
|
|
@@ -2475,6 +2550,19 @@ const { data: regions } = await store.getStoreRegions();
|
|
|
2475
2550
|
const region = await store.getStoreRegion(regions[0].id);
|
|
2476
2551
|
\`\`\`
|
|
2477
2552
|
|
|
2553
|
+
For a single round trip, \`getAutoRegion(country)\` resolves a buyer's country
|
|
2554
|
+
to a region server-side. Brainerce does NOT derive the country from the request
|
|
2555
|
+
IP (the storefront server is what reaches the backend, not the end-customer) \u2014
|
|
2556
|
+
your storefront extracts the country from its edge runtime (Cloudflare
|
|
2557
|
+
\`CF-IPCountry\`, Vercel \`request.geo?.country\`, Fastly \`client-geo-country\`,
|
|
2558
|
+
etc.) and forwards it. Returns \`matched=true\` on explicit country hit, \`false\`
|
|
2559
|
+
when falling back to the default region.
|
|
2560
|
+
|
|
2561
|
+
\`\`\`typescript
|
|
2562
|
+
const country = headers.get('cf-ipcountry') ?? 'US';
|
|
2563
|
+
const { region, matched } = await store.getAutoRegion(country);
|
|
2564
|
+
\`\`\`
|
|
2565
|
+
|
|
2478
2566
|
A shipping zone can be limited to regions via \`regionIds\` \u2014 the zone is then
|
|
2479
2567
|
only offered to checkouts that resolved to one of those regions. Empty/omitted =
|
|
2480
2568
|
available for any region (default); each id must belong to the same store.
|
|
@@ -2938,6 +3026,146 @@ entries \u2014 pick a descriptive slug (\`'shipping'\`, \`'returns'\`, \`'about'
|
|
|
2938
3026
|
- \`get-type-definitions\` with \`domain: 'content'\` for the TypeScript
|
|
2939
3027
|
interfaces.`;
|
|
2940
3028
|
}
|
|
3029
|
+
function getBlogSection() {
|
|
3030
|
+
return `## Blog
|
|
3031
|
+
|
|
3032
|
+
Merchants write and schedule blog posts in **Content \u2192 Blog** in the dashboard.
|
|
3033
|
+
Storefronts choose their own URL scheme \u2014 render posts at \`/blog/[slug]\`,
|
|
3034
|
+
\`/articles/[slug]\`, or whatever fits the brand.
|
|
3035
|
+
|
|
3036
|
+
Public reads carry \`Cache-Control: public, max-age=300, stale-while-revalidate=60\`.
|
|
3037
|
+
|
|
3038
|
+
**Scheduling:** A post is visible once \`status === 'PUBLISHED'\` and
|
|
3039
|
+
\`publishedAt <= now()\`. Set a future \`publishedAt\` while publishing to
|
|
3040
|
+
schedule \u2014 no cron needed; visibility is computed at query time.
|
|
3041
|
+
|
|
3042
|
+
### Reading posts (any SDK mode)
|
|
3043
|
+
|
|
3044
|
+
\`\`\`typescript
|
|
3045
|
+
// List published posts
|
|
3046
|
+
const { data: posts, meta } = await client.blog.getPosts({ page: 1, limit: 10 });
|
|
3047
|
+
|
|
3048
|
+
// Filter by category or tag
|
|
3049
|
+
const { data: news } = await client.blog.getPosts({ category: 'news' });
|
|
3050
|
+
const { data: tips } = await client.blog.getPosts({ tag: 'tutorial' });
|
|
3051
|
+
|
|
3052
|
+
// Fetch one by slug (returns null on 404)
|
|
3053
|
+
const post = await client.blog.getPost('my-first-post');
|
|
3054
|
+
if (post) {
|
|
3055
|
+
console.log(post.title); // string
|
|
3056
|
+
console.log(post.content); // HTML string from rich-text editor
|
|
3057
|
+
console.log(post.excerpt); // optional short summary
|
|
3058
|
+
console.log(post.tags); // string[]
|
|
3059
|
+
console.log(post.coverImageUrl, post.coverImageAlt);
|
|
3060
|
+
console.log(post.publishedAt); // ISO 8601 or undefined
|
|
3061
|
+
}
|
|
3062
|
+
\`\`\`
|
|
3063
|
+
|
|
3064
|
+
### BlogPost fields
|
|
3065
|
+
|
|
3066
|
+
| Field | Type | Notes |
|
|
3067
|
+
| ----------------- | ----------- | ------------------------------------- |
|
|
3068
|
+
| \`id\` | string | |
|
|
3069
|
+
| \`title\` | string | |
|
|
3070
|
+
| \`slug\` | string | Unique per store, URL-safe |
|
|
3071
|
+
| \`category\` | string? | Free-form (e.g. \`'news'\`) |
|
|
3072
|
+
| \`content\` | string | HTML from rich-text editor |
|
|
3073
|
+
| \`excerpt\` | string? | Short summary for listing cards |
|
|
3074
|
+
| \`coverImageUrl\` | string? | |
|
|
3075
|
+
| \`coverImageAlt\` | string? | |
|
|
3076
|
+
| \`author\` | string? | |
|
|
3077
|
+
| \`tags\` | string[] | |
|
|
3078
|
+
| \`publishedAt\` | string? | ISO 8601; null = publish immediately |
|
|
3079
|
+
| \`seoTitle\` | string? | |
|
|
3080
|
+
| \`seoDescription\`| string? | |
|
|
3081
|
+
| \`ogImageUrl\` | string? | |
|
|
3082
|
+
|
|
3083
|
+
### Rendering blog content
|
|
3084
|
+
|
|
3085
|
+
\`\`\`tsx
|
|
3086
|
+
// app/blog/[slug]/page.tsx
|
|
3087
|
+
import DOMPurify from 'isomorphic-dompurify';
|
|
3088
|
+
|
|
3089
|
+
const post = await brainerce.blog.getPost(params.slug);
|
|
3090
|
+
if (!post) notFound();
|
|
3091
|
+
|
|
3092
|
+
// Always sanitize before rendering HTML \u2014 treat external-origin content as untrusted
|
|
3093
|
+
const safeHtml = DOMPurify.sanitize(post.content);
|
|
3094
|
+
return <div dangerouslySetInnerHTML={{ __html: safeHtml }} className="prose" />;
|
|
3095
|
+
\`\`\`
|
|
3096
|
+
|
|
3097
|
+
The \`content\` field is HTML produced by the Lexical rich-text editor.
|
|
3098
|
+
**Always sanitize with DOMPurify (or equivalent) before rendering via
|
|
3099
|
+
\`dangerouslySetInnerHTML\`** \u2014 even though the content originates from your
|
|
3100
|
+
own editor, defense-in-depth prevents any stored-XSS path if content is ever
|
|
3101
|
+
migrated or imported from an external source.
|
|
3102
|
+
Apply a \`prose\` class (Tailwind Typography) for automatic styling.
|
|
3103
|
+
|
|
3104
|
+
### REST endpoints
|
|
3105
|
+
|
|
3106
|
+
| Method | Path | Returns |
|
|
3107
|
+
|--------|------|---------|
|
|
3108
|
+
| GET | \`/api/stores/:storeId/blog/posts\` | \`BlogPostListResponse\` |
|
|
3109
|
+
| GET | \`/api/stores/:storeId/blog/posts/:slug\` | \`BlogPost\` or 404 |
|
|
3110
|
+
| GET | \`/api/vc/:connectionId/blog/posts\` | Same, channel-scoped |
|
|
3111
|
+
| GET | \`/api/vc/:connectionId/blog/posts/:slug\` | \`BlogPost\` or 404 |
|
|
3112
|
+
`;
|
|
3113
|
+
}
|
|
3114
|
+
function getStorefrontBotSection(connectionId) {
|
|
3115
|
+
return `## Storefront Bot (AI chat widget)
|
|
3116
|
+
|
|
3117
|
+
The store's AI shopping assistant. ALL configuration (name, avatar, colors,
|
|
3118
|
+
greeting, starter questions, capabilities, guardrails) lives in the merchant
|
|
3119
|
+
dashboard \u2014 the embed never decides behavior, and the widget renders nothing
|
|
3120
|
+
until the merchant switches the bot Live.
|
|
3121
|
+
|
|
3122
|
+
### Zero-code embed (any site)
|
|
3123
|
+
|
|
3124
|
+
\`\`\`html
|
|
3125
|
+
<script src="https://cdn.brainerce.com/bot.js" data-connection-id="${connectionId}" defer></script>
|
|
3126
|
+
\`\`\`
|
|
3127
|
+
|
|
3128
|
+
Keep the tag exactly this bare \u2014 do NOT add \`integrity\` or \`crossorigin\`
|
|
3129
|
+
(the bootstrap is intentionally mutable; it is origin-pinned by CSP instead).
|
|
3130
|
+
|
|
3131
|
+
### SDK mount (React / Next.js / any bundler)
|
|
3132
|
+
|
|
3133
|
+
\`\`\`ts
|
|
3134
|
+
import { BrainerceBot } from 'brainerce/bot';
|
|
3135
|
+
|
|
3136
|
+
// client-side only (e.g. in a useEffect) \u2014 mounts a floating chat bubble
|
|
3137
|
+
const bot = await BrainerceBot.mount({ connectionId: '${connectionId}' });
|
|
3138
|
+
bot?.destroy(); // optional teardown
|
|
3139
|
+
\`\`\`
|
|
3140
|
+
|
|
3141
|
+
\`mount\` resolves to \`null\` when the bot is disabled (FREE plan, switched
|
|
3142
|
+
off, or unconfigured) \u2014 safe to call unconditionally. Options: \`connectionId\`
|
|
3143
|
+
(required), \`baseUrl\` (API origin override), \`target\` (mount element),
|
|
3144
|
+
\`onAddToCart\` (\`({ productId, variantId, quantity }) => boolean | Promise<boolean>\`
|
|
3145
|
+
\u2014 route the widget's cart adds through the site's own cart; \`variantId\` is
|
|
3146
|
+
null for simple products; return false to fall back to the product page).
|
|
3147
|
+
|
|
3148
|
+
Behavior: persists an anonymous session in localStorage, restores the
|
|
3149
|
+
conversation on revisit, streams answers, and shows product recommendation
|
|
3150
|
+
cards (image, price, add-to-cart / view). Multi-variant products get an
|
|
3151
|
+
in-card variant picker; shoppers can also ask the assistant to add an item
|
|
3152
|
+
and it goes through the same cart chain. Zero-result searches feed the
|
|
3153
|
+
merchant's "unmet demand" analytics. Aside from shopper-initiated cart adds,
|
|
3154
|
+
the bot is read-only.
|
|
3155
|
+
|
|
3156
|
+
Add-to-cart resolution chain: \`onAddToCart\` option \u2192 cancelable
|
|
3157
|
+
\`brainerce:bot:add-to-cart\` CustomEvent on window
|
|
3158
|
+
(\`detail: { productId, variantId, quantity, connectionId }\`; call
|
|
3159
|
+
preventDefault() after handling) \u2192 navigate to the product page.
|
|
3160
|
+
|
|
3161
|
+
Rules:
|
|
3162
|
+
- Mount once per page; do not pass any visual config \u2014 the dashboard owns it.
|
|
3163
|
+
- Do not wrap or restyle the widget; it renders in its own Shadow DOM.
|
|
3164
|
+
- Product card links expect the conventional \`/products/<slug>\` route.
|
|
3165
|
+
- Wire \`onAddToCart\` to the site's cart (see the cart section) so the header
|
|
3166
|
+
count updates when the bot adds items.
|
|
3167
|
+
`;
|
|
3168
|
+
}
|
|
2941
3169
|
function getSectionByTopic(topic, connectionId, currency) {
|
|
2942
3170
|
const cid = connectionId || "vc_YOUR_CONNECTION_ID";
|
|
2943
3171
|
const cur = currency || "USD";
|
|
@@ -2976,6 +3204,10 @@ function getSectionByTopic(topic, connectionId, currency) {
|
|
|
2976
3204
|
return getTaxDisplaySection(cur);
|
|
2977
3205
|
case "i18n":
|
|
2978
3206
|
return getI18nSection();
|
|
3207
|
+
case "multilingual-seo":
|
|
3208
|
+
case "hreflang":
|
|
3209
|
+
case "seo-i18n":
|
|
3210
|
+
return getMultilingualSeoSection();
|
|
2979
3211
|
case "critical-rules":
|
|
2980
3212
|
return getCriticalRulesSection() + "\n\n" + getTypeQuickReference();
|
|
2981
3213
|
case "type-reference":
|
|
@@ -2986,6 +3218,10 @@ function getSectionByTopic(topic, connectionId, currency) {
|
|
|
2986
3218
|
return getContactInquiriesSection();
|
|
2987
3219
|
case "content":
|
|
2988
3220
|
return getContentSection();
|
|
3221
|
+
case "blog":
|
|
3222
|
+
return getBlogSection();
|
|
3223
|
+
case "storefront-bot":
|
|
3224
|
+
return getStorefrontBotSection(cid);
|
|
2989
3225
|
case "all":
|
|
2990
3226
|
return [
|
|
2991
3227
|
"# Brainerce SDK \u2014 full topic dump",
|
|
@@ -3070,6 +3306,10 @@ function getSectionByTopic(topic, connectionId, currency) {
|
|
|
3070
3306
|
"",
|
|
3071
3307
|
"---",
|
|
3072
3308
|
"",
|
|
3309
|
+
getMultilingualSeoSection(),
|
|
3310
|
+
"",
|
|
3311
|
+
"---",
|
|
3312
|
+
"",
|
|
3073
3313
|
getAdminApiSection(),
|
|
3074
3314
|
"",
|
|
3075
3315
|
"---",
|
|
@@ -3078,10 +3318,18 @@ function getSectionByTopic(topic, connectionId, currency) {
|
|
|
3078
3318
|
"",
|
|
3079
3319
|
"---",
|
|
3080
3320
|
"",
|
|
3081
|
-
getContentSection()
|
|
3321
|
+
getContentSection(),
|
|
3322
|
+
"",
|
|
3323
|
+
"---",
|
|
3324
|
+
"",
|
|
3325
|
+
getBlogSection(),
|
|
3326
|
+
"",
|
|
3327
|
+
"---",
|
|
3328
|
+
"",
|
|
3329
|
+
getStorefrontBotSection(cid)
|
|
3082
3330
|
].join("\n");
|
|
3083
3331
|
default:
|
|
3084
|
-
return `Unknown topic: "${topic}". Available topics: setup, products, cart, checkout, checkout-custom-fields, payment, auth, order-confirmation, inventory, discounts, recommendations, product-customization-fields, tax, i18n, critical-rules, type-reference, admin, inquiries, content, all`;
|
|
3332
|
+
return `Unknown topic: "${topic}". Available topics: setup, products, cart, checkout, checkout-custom-fields, payment, auth, order-confirmation, inventory, discounts, recommendations, product-customization-fields, tax, i18n, critical-rules, type-reference, admin, inquiries, content, blog, all`;
|
|
3085
3333
|
}
|
|
3086
3334
|
}
|
|
3087
3335
|
|
|
@@ -3110,6 +3358,7 @@ var GET_SDK_DOCS_SCHEMA = {
|
|
|
3110
3358
|
"admin",
|
|
3111
3359
|
"inquiries",
|
|
3112
3360
|
"content",
|
|
3361
|
+
"storefront-bot",
|
|
3113
3362
|
"all"
|
|
3114
3363
|
]).describe("The SDK documentation topic to retrieve"),
|
|
3115
3364
|
salesChannelId: z.string().optional().describe("Sales channel ID (starts with vc_). Used to personalize setup code."),
|
|
@@ -3147,6 +3396,12 @@ interface Product {
|
|
|
3147
3396
|
priceMin?: string | null; // Lowest variant price (VARIABLE products) \u2014 same as basePrice for VARIABLE, kept for back-compat and JSON-LD range display.
|
|
3148
3397
|
priceMax?: string | null; // Highest variant price (VARIABLE products). Use with priceMin for "\u20AA49 \u2013 \u20AA199" range.
|
|
3149
3398
|
priceVaries?: boolean; // true when variant prices differ \u2014 show "\u20AA49 \u2013 \u20AA199" range.
|
|
3399
|
+
// FX DISPLAY overlay (PRD \xA723). Set only when getProducts({ regionId }) was called AND region.currency !== store.currency. basePrice/salePrice above stay in store currency \u2014 these are additive, display-only. The buyer is still charged in store currency at checkout; payment provider handles customer-side FX.
|
|
3400
|
+
displayPrice?: string; // basePrice \xD7 daily FX rate, in displayCurrency.
|
|
3401
|
+
displaySalePrice?: string; // salePrice \xD7 rate (if salePrice present).
|
|
3402
|
+
displayPriceMin?: string; // priceMin \xD7 rate (VARIABLE products).
|
|
3403
|
+
displayPriceMax?: string; // priceMax \xD7 rate (VARIABLE products).
|
|
3404
|
+
displayCurrency?: string; // ISO 4217 of the region \u2014 e.g. "EUR".
|
|
3150
3405
|
status: string;
|
|
3151
3406
|
type: 'SIMPLE' | 'VARIABLE';
|
|
3152
3407
|
isDownloadable?: boolean;
|
|
@@ -3190,6 +3445,10 @@ interface ProductVariant {
|
|
|
3190
3445
|
name?: string | null;
|
|
3191
3446
|
price?: string | null;
|
|
3192
3447
|
salePrice?: string | null;
|
|
3448
|
+
// FX DISPLAY overlay (PRD \xA723) \u2014 same semantics as on the parent Product.
|
|
3449
|
+
displayPrice?: string;
|
|
3450
|
+
displaySalePrice?: string;
|
|
3451
|
+
displayCurrency?: string;
|
|
3193
3452
|
attributes?: Record<string, string> | null;
|
|
3194
3453
|
options?: Array<{ name: string; value: string }>;
|
|
3195
3454
|
inventory?: InventoryInfo | null;
|
|
@@ -4319,6 +4578,15 @@ interface PublicRegionDetail extends PublicRegion {
|
|
|
4319
4578
|
}
|
|
4320
4579
|
// getStoreRegions(): { data: PublicRegion[] } \u2014 active regions, default first.
|
|
4321
4580
|
// getStoreRegion(regionId): PublicRegionDetail \u2014 one region + its providers.
|
|
4581
|
+
interface AutoRegionResponse {
|
|
4582
|
+
region: PublicRegion | null;
|
|
4583
|
+
matched: boolean; // true=country was in a region's list; false=fell back to default
|
|
4584
|
+
country: string; // upper-cased ISO-3166-1 alpha-2; '' when caller omitted it
|
|
4585
|
+
}
|
|
4586
|
+
// getAutoRegion(country): AutoRegionResponse \u2014 server-side resolution in one
|
|
4587
|
+
// round trip. Pair with the country your edge runtime extracts
|
|
4588
|
+
// (CF-IPCountry / request.geo.country / etc.) \u2014 Brainerce does NOT derive the
|
|
4589
|
+
// country from the request IP server-side (storefront != end-customer).
|
|
4322
4590
|
|
|
4323
4591
|
// ---- Tax Classes ---- (scopes: tax-classes:read / tax-classes:write)
|
|
4324
4592
|
// Charge differential rates by product type. A TaxRate may target a class via
|
|
@@ -4350,7 +4618,25 @@ interface AssignTaxClassDto { productIds?: string[]; variantIds?: string[]; cate
|
|
|
4350
4618
|
// getRegionCompatibleProviders(id), detectRegion(country, regions)
|
|
4351
4619
|
// Tax classes: getTaxClasses(), getTaxClass(id), createTaxClass(dto), updateTaxClass(id, dto),
|
|
4352
4620
|
// deleteTaxClass(id), setDefaultTaxClass(id), assignTaxClass(id, dto),
|
|
4353
|
-
// mergeTaxClasses(id, targetId)
|
|
4621
|
+
// mergeTaxClasses(id, targetId)
|
|
4622
|
+
//
|
|
4623
|
+
// SDK methods (storefront, public \u2014 storeId mode, no apiKey):
|
|
4624
|
+
// getStoreRegions(), getStoreRegion(id), getAutoRegion(country)
|
|
4625
|
+
// getStoreTaxClasses(), estimateTax({ country?, subtotal })
|
|
4626
|
+
//
|
|
4627
|
+
// estimateTax returns:
|
|
4628
|
+
interface TaxEstimateResponse {
|
|
4629
|
+
appliesTax: boolean;
|
|
4630
|
+
rate: number | null; // percent (18 = 18%) \u2014 null when no matching rule
|
|
4631
|
+
rateName: string | null;
|
|
4632
|
+
estimatedTax: number; // tax portion of subtotal in store currency
|
|
4633
|
+
pricesIncludeTax: boolean;
|
|
4634
|
+
currency: string; // store currency (cart/order currency)
|
|
4635
|
+
note: string; // disclaimer \u2014 preview is non-binding
|
|
4636
|
+
}
|
|
4637
|
+
// Non-binding by design: the authoritative tax runs at checkout against the
|
|
4638
|
+
// full shipping address. The country comes from your edge runtime
|
|
4639
|
+
// (CF-IPCountry / request.geo.country / etc.), NOT the request IP.`;
|
|
4354
4640
|
var TYPES_BY_DOMAIN = {
|
|
4355
4641
|
products: PRODUCTS_TYPES,
|
|
4356
4642
|
cart: CART_TYPES,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brainerce/mcp-server",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.0",
|
|
4
4
|
"description": "Framework-agnostic domain knowledge API for Brainerce. Provides SDK docs, types, business flows, critical rules, and store capabilities to AI tools like Lovable, Cursor, Bolt, v0, and Claude Code. Does NOT provide framework-specific boilerplate — clients build in whatever framework fits.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"brainerce-mcp": "dist/bin/stdio.js"
|