@solvapay/mcp-core 0.1.0 → 0.2.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/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ZodTypeAny } from 'zod';
2
- import { PurchaseCheckResult, PaymentMethodInfo, CustomerBalanceResult, GetUsageResult, SdkMerchantResponse, SdkProductResponse, components, PaywallStructuredContent, SolvaPay, PaywallError } from '@solvapay/server';
2
+ import { PurchaseCheckResult, PaymentMethodInfo, CustomerBalanceResult, GetUsageResult, SdkMerchantResponse, SdkProductResponse, components, SolvaPay, PaywallError, PaywallStructuredContent } from '@solvapay/server';
3
3
 
4
4
  /**
5
5
  * Canonical MCP tool names for the SolvaPay transport + bootstrap tools.
@@ -141,32 +141,21 @@ interface PaywallToolResult {
141
141
  /**
142
142
  * Which view a SolvaPay MCP server knows how to bootstrap.
143
143
  *
144
- * Four kinds map to an intent `open_*`-style tool: `checkout`,
145
- * `account`, `topup`, and `nudge` (opened implicitly when a successful
146
- * paywalled tool response carries `options.nudge`). `paywall` has no
147
- * dedicated tool the gate response inlines the bootstrap payload on
148
- * its `structuredContent`, and the React shell takes over the surface
149
- * when it sees `view: 'paywall'`.
144
+ * Each kind maps to exactly one intent `open_*`-style tool: `checkout`,
145
+ * `account`, `topup`. There is no `paywall` or `nudge` view those
146
+ * responses are plain text narrations per the text-only paywall
147
+ * refactor (merchant paywall / nudge tool results ship
148
+ * `content[0].text` + `structuredContent = gate` and never open the
149
+ * iframe).
150
150
  *
151
151
  * The legacy `'about'`, `'activate'`, and `'usage'` surfaces were
152
- * dropped with the three-mode refactor — About is now served by tool
153
- * descriptions + docs resources, Activate merged into checkout's
152
+ * dropped earlier — About is served by tool descriptions + docs
153
+ * resources, Activate merged into checkout's
154
154
  * `PlanActivationDispatcher`, and Usage folds inline into the account
155
155
  * view.
156
156
  */
157
- type SolvaPayMcpViewKind = 'checkout' | 'account' | 'topup' | 'paywall' | 'nudge';
158
- declare const SOLVAPAY_MCP_VIEW_KINDS: readonly ["checkout", "account", "topup", "paywall", "nudge"];
159
- /**
160
- * Minimal `kind`-tagged paywall content passed through `BootstrapPayload`
161
- * when the host opens the paywall view. The full
162
- * `PaywallStructuredContent` type lives in `@solvapay/server` (it's also
163
- * consumed by the non-MCP react paywall primitives); this shape is a
164
- * structural superset that adapters can forward without importing it.
165
- */
166
- interface SolvaPayMcpPaywallContent {
167
- kind: 'payment_required' | 'activation_required';
168
- [key: string]: unknown;
169
- }
157
+ type SolvaPayMcpViewKind = 'checkout' | 'account' | 'topup';
158
+ declare const SOLVAPAY_MCP_VIEW_KINDS: readonly ["checkout", "account", "topup"];
170
159
  /**
171
160
  * Payload returned by every `open_*` bootstrap tool and consumed by the
172
161
  * React MCP App shell to render the right view. Single source of truth —
@@ -178,25 +167,18 @@ interface SolvaPayMcpPaywallContent {
178
167
  * `customer` is `null` when the call is unauthenticated; each nested
179
168
  * field is `null` when the corresponding sub-read errored or doesn't
180
169
  * apply (e.g. `paymentMethod: null` when no card is on file).
170
+ *
171
+ * The legacy `paywall` / `nudge` / `data` fields were removed as part
172
+ * of the text-only paywall refactor: merchant paywall / nudge
173
+ * responses are plain narrations, not widget payloads, so the
174
+ * bootstrap no longer carries a gate or a nudge spec for the shell to
175
+ * render.
181
176
  */
182
177
  interface BootstrapPayload {
183
178
  view: SolvaPayMcpViewKind;
184
179
  productRef: string;
185
180
  stripePublishableKey: string | null;
186
181
  returnUrl: string;
187
- /** Only set for the `open_paywall` branch. */
188
- paywall?: SolvaPayMcpPaywallContent;
189
- /**
190
- * Upsell strip spec attached when `view: 'nudge'`. Rendered above
191
- * the merchant tool result by `McpNudgeView`.
192
- */
193
- nudge?: NudgeSpec;
194
- /**
195
- * Merchant tool result data embedded alongside a nudge so the shell
196
- * can surface it without a follow-up tool call. Only set when
197
- * `view: 'nudge'`.
198
- */
199
- data?: unknown;
200
182
  merchant: BootstrapMerchant;
201
183
  product: BootstrapProduct;
202
184
  plans: BootstrapPlan[];
@@ -769,36 +751,15 @@ declare function toolErrorResult(error: {
769
751
  declare function previewJson(value: unknown, max?: number): string;
770
752
 
771
753
  /**
772
- * Canonical paywall `_meta.ui` envelope used by every SolvaPay MCP
773
- * tool result. Centralising this shape means swapping the UI resource
774
- * URI is a one-line builder call at every call site.
775
- */
776
- interface PaywallUiMetaInput {
777
- /** UI resource URI the MCP host opens to render the paywall view. */
778
- resourceUri: string;
779
- }
780
- interface PaywallUiMeta {
781
- ui: {
782
- resourceUri: string;
783
- };
784
- [key: string]: unknown;
785
- }
786
- /**
787
- * Build the `_meta` envelope attached to paywall tool results. Consumed
788
- * by `paywallToolResult`, `buildPayableHandler`, and the descriptor
789
- * registration layer so the shape stays in lockstep.
754
+ * Standalone `buildBootstrapPayload` factory same logic
755
+ * `buildSolvaPayDescriptors` wires under the intent tools, exposed
756
+ * separately for adapters that want to produce a fresh intent-tool
757
+ * bootstrap without going through the full descriptor bundle.
790
758
  *
791
- * The bootstrap payload itself now travels on `structuredContent` this
792
- * envelope only tells the host which UI resource to open.
793
- */
794
- declare function buildPaywallUiMeta(input: PaywallUiMetaInput): PaywallUiMeta;
795
-
796
- /**
797
- * Standalone `buildBootstrapPayload` factory — same logic `buildSolvaPayDescriptors`
798
- * wires under the `open_*` tools, exposed separately so the paywall
799
- * envelope (`paywallToolResult`, `buildPayableHandler`) can embed the
800
- * full `BootstrapPayload` in `structuredContent` without duplicating
801
- * the parallel fetch layout.
759
+ * This used to be invoked from the widget-paywall branch of
760
+ * `buildPayableHandler` / `paywallToolResult` (to embed the full
761
+ * `BootstrapPayload` on the gate response), but those branches are
762
+ * text-only now and no longer need the closure.
802
763
  */
803
764
 
804
765
  interface CreateBuildBootstrapPayloadOptions {
@@ -807,11 +768,9 @@ interface CreateBuildBootstrapPayloadOptions {
807
768
  publicBaseUrl: string;
808
769
  getCustomerRef?: (extra?: McpToolExtra) => string | null;
809
770
  }
810
- type BuildBootstrapPayloadFn = (view: SolvaPayMcpViewKind, extra: McpToolExtra | undefined, extras?: {
811
- paywall?: PaywallStructuredContent;
812
- }) => Promise<BootstrapPayload>;
771
+ type BuildBootstrapPayloadFn = (view: SolvaPayMcpViewKind, extra: McpToolExtra | undefined) => Promise<BootstrapPayload>;
813
772
  /**
814
- * Produce a reusable `buildBootstrapPayload(view, extra, extras?)` closure
773
+ * Produce a reusable `buildBootstrapPayload(view, extra)` closure
815
774
  * wired against the same SolvaPay instance + product as a
816
775
  * `buildSolvaPayDescriptors` bundle.
817
776
  *
@@ -824,43 +783,43 @@ type BuildBootstrapPayloadFn = (view: SolvaPayMcpViewKind, extra: McpToolExtra |
824
783
  declare function createBuildBootstrapPayload(options: CreateBuildBootstrapPayloadOptions): BuildBootstrapPayloadFn;
825
784
 
826
785
  /**
827
- * Helper for hand-rolled MCP tool handlers that still want to attach the
828
- * `_meta.ui` envelope + a full `BootstrapPayload` to paywall results
829
- * without adopting `buildPayableHandler` / `registerPayableTool`
830
- * wholesale.
786
+ * Helper for hand-rolled MCP tool handlers that need to emit a
787
+ * text-only paywall response without adopting `buildPayableHandler` /
788
+ * `registerPayableTool` wholesale.
789
+ *
790
+ * The widget iframe is no longer opened for merchant payable data
791
+ * tools (per SEP-1865 + the text-only paywall refactor), so this
792
+ * helper ships a plain narration + `structuredContent = gate` pair.
793
+ * The gate's `message` field — built by the
794
+ * `classifyPaywallState` / `buildGateMessage` engine in
795
+ * `@solvapay/server` — names the recovery intent tool and inlines
796
+ * `checkoutUrl` for terminal-first hosts.
831
797
  */
832
798
 
833
799
  interface PaywallToolResultContext {
834
- /** UI resource URI the MCP host should open to render the paywall view. */
835
- resourceUri: string;
836
800
  /**
837
- * Builds the full `BootstrapPayload` that rides on
838
- * `structuredContent` so the React shell can mount the paywall view
839
- * from the gate response directly no follow-up `open_paywall` call.
840
- * Wire this from `buildSolvaPayDescriptors(...).buildBootstrapPayload`.
801
+ * Builds a full `BootstrapPayload`. Still accepted on the context
802
+ * for intent-tool reuse, but NOT consumed here the text-only
803
+ * paywall ships the gate verbatim. Leaving the field on the type
804
+ * preserves compatibility for callers that thread it through a
805
+ * bound helper.
806
+ *
807
+ * @deprecated Not called by `paywallToolResult`. Will be removed in
808
+ * a future major.
841
809
  */
842
810
  buildBootstrap?: BuildBootstrapPayloadFn;
843
- /** Forwarded to `buildBootstrap` so customer-scoped fields resolve. */
811
+ /** Forwarded for logging / telemetry; not consumed by the text path. */
844
812
  extra?: McpToolExtra;
845
813
  }
846
814
  /**
847
815
  * Convert a paywall gate (either a `PaywallError` or the underlying
848
816
  * `PaywallStructuredContent` returned by `paywall.decide()`) into a
849
- * `PaywallToolResult` carrying a full `BootstrapPayload` (so the
850
- * React shell can render the paywall view immediately) and the
851
- * `_meta.ui` envelope telling the host which resource to open.
852
- *
853
- * Prefer the gate-first form when you already have a
854
- * `PaywallDecision` in hand:
817
+ * text-only `PaywallToolResult`.
855
818
  *
856
819
  * ```ts
857
820
  * const decision = await solvaPay.paywall.decide(args, { product })
858
821
  * if (decision.outcome === 'gate') {
859
- * return paywallToolResult(decision.gate, {
860
- * resourceUri: 'ui://my-app/mcp-app.html',
861
- * buildBootstrap,
862
- * extra,
863
- * })
822
+ * return paywallToolResult(decision.gate)
864
823
  * }
865
824
  * ```
866
825
  *
@@ -871,18 +830,12 @@ interface PaywallToolResultContext {
871
830
  * try {
872
831
  * return await solvaPay.payable({ product }).mcp(handler)(args, extra)
873
832
  * } catch (err) {
874
- * if (err instanceof PaywallError) {
875
- * return paywallToolResult(err, {
876
- * resourceUri: 'ui://my-app/mcp-app.html',
877
- * buildBootstrap,
878
- * extra,
879
- * })
880
- * }
833
+ * if (err instanceof PaywallError) return paywallToolResult(err)
881
834
  * throw err
882
835
  * }
883
836
  * ```
884
837
  */
885
- declare function paywallToolResult(errOrGate: PaywallError | PaywallStructuredContent, ctx: PaywallToolResultContext): Promise<PaywallToolResult>;
838
+ declare function paywallToolResult(errOrGate: PaywallError | PaywallStructuredContent, _ctx?: PaywallToolResultContext): Promise<PaywallToolResult>;
886
839
 
887
840
  /**
888
841
  * Default Content Security Policy allow-list for SolvaPay MCP Apps.
@@ -900,6 +853,40 @@ declare const SOLVAPAY_DEFAULT_CSP: Required<SolvaPayMcpCsp>;
900
853
  */
901
854
  declare function mergeCsp(overrides: SolvaPayMcpCsp | undefined): Required<SolvaPayMcpCsp>;
902
855
 
856
+ /**
857
+ * `applyHideToolsByAudience(server, audiences)` — wraps the
858
+ * `tools/list` request handler on an `@modelcontextprotocol/sdk`
859
+ * `McpServer` so tool descriptors whose `_meta.audience` matches one
860
+ * of the supplied values are filtered out of the response.
861
+ *
862
+ * The tools stay `enabled: true` on the server, so `tools/call` still
863
+ * reaches their handlers — this helper only affects the `tools/list`
864
+ * response shape. Use `['ui']` when deploying to a text-host MCP
865
+ * client (Claude Desktop, MCPJam, ChatGPT connectors) that won't
866
+ * embed the SolvaPay iframe surface, while still allowing the iframe
867
+ * to invoke the hidden transport tools (`create_payment_intent` etc.)
868
+ * for server-side work.
869
+ *
870
+ * Internal-map reach-in rationale: `Protocol.setRequestHandler`
871
+ * contains an `assertCanSetRequestHandler` guard that fails when the
872
+ * SDK has already registered a handler for the method during
873
+ * registration — i.e. `tools/list` after any tool registration. The
874
+ * guard only fires through the public wrapper; the underlying
875
+ * `_requestHandlers` map accepts a replacement silently. Touching the
876
+ * map directly therefore sidesteps the guard without going through
877
+ * public API surface that could change in a minor SDK bump. The one
878
+ * piece of SDK-internal knowledge we live with until the SDK ships a
879
+ * first-class "replace handler" affordance.
880
+ *
881
+ * No-op when `audiences` is empty or falsy.
882
+ *
883
+ * This helper is exported from `@solvapay/mcp-core` so both
884
+ * `@solvapay/mcp` (stacked `createSolvaPayMcpServer`) and
885
+ * `@solvapay/mcp/fetch` (unified `createSolvaPayMcpFetch`) can apply
886
+ * the same filter without each re-implementing the reach-in.
887
+ */
888
+ declare function applyHideToolsByAudience(server: unknown, audiences: readonly string[] | undefined): void;
889
+
903
890
  /**
904
891
  * `buildSolvaPayDescriptors(options)` — framework-neutral tool surface
905
892
  * builder that every SolvaPay MCP adapter (`@solvapay/mcp`, future
@@ -913,6 +900,21 @@ declare function mergeCsp(overrides: SolvaPayMcpCsp | undefined): Required<Solva
913
900
  * iterates.
914
901
  */
915
902
 
903
+ /**
904
+ * Project `SolvaPayMerchantBranding` into an `icons[]` array suitable
905
+ * for MCP host chrome — either the per-tool `SolvaPayToolDescriptor`
906
+ * or the server-level `Implementation.icons[]` returned at
907
+ * `initialize`. Prefers the square `iconUrl` (expected shape for
908
+ * avatar slots); falls back to the landscape `logoUrl` with a note
909
+ * that hosts may need to letterbox. Returns `undefined` when neither
910
+ * asset is set.
911
+ *
912
+ * Exported so the MCP adapter (`@solvapay/mcp`) can reuse the same
913
+ * branding → icon projection when building the server-level
914
+ * `Implementation` payload, keeping per-tool and server-wide icons in
915
+ * lock-step.
916
+ */
917
+ declare function deriveIcons(branding: SolvaPayMerchantBranding | undefined): SolvaPayToolIcon[] | undefined;
916
918
  interface BuildSolvaPayDescriptorsOptions {
917
919
  /** Initialised SolvaPay instance. */
918
920
  solvaPay: SolvaPay;
@@ -1025,35 +1027,51 @@ declare function buildSolvaPayPrompts(options?: {
1025
1027
  */
1026
1028
  declare const SOLVAPAY_OVERVIEW_URI = "docs://solvapay/overview.md";
1027
1029
  declare const SOLVAPAY_OVERVIEW_MIME_TYPE = "text/markdown";
1028
- declare const SOLVAPAY_OVERVIEW_MARKDOWN = "# SolvaPay MCP server \u2014 overview\n\nThis MCP server connects a SolvaPay-protected product to your host so users can\nmanage their plan, usage, and billing **without leaving the chat**. It is\ndual-audience: every tool returns a UI bootstrap for hosts that render MCP UI\nresources (`basic-host`, Claude Desktop, ChatGPT, etc.) and a markdown summary\nwith clickable URLs for text-only hosts.\n\n## What the user can do\n\n- **Upgrade** \u2014 start or change a paid plan. `/upgrade` opens the embedded\n checkout (Stripe Elements inline) on UI hosts and returns a hosted-checkout\n URL on text hosts.\n- **Manage account** \u2014 current plan, balance, usage, payment method, cancel\n or reactivate auto-renewal. Credits + usage are folded inline into the\n account view. `/manage_account`.\n- **Top up credits** \u2014 add SolvaPay credits for usage-based plans.\n `/topup`.\n- **Activate plan** \u2014 pick a plan from the list or activate a specific plan\n by `planRef`. Free plans activate immediately, usage-based plans activate\n when balance covers the configured usage, paid plans return the embedded\n checkout or a hosted-checkout URL. `/activate_plan`.\n\n## How it fits together\n\nEach intent tool returns a full `BootstrapPayload` (merchant + product + plans\n+ customer snapshot) so the embedded UI never fires per-view read calls. When\na paywalled data tool hits the usage limit, its response carries the same\npayload with `view: \"paywall\"`, letting the host open the UI directly on the\npaywall screen \u2014 no second tool call required.\n\nAuth is handled by the SolvaPay OAuth bridge (see `createMcpOAuthBridge`). The\nbridge injects `customer_ref` onto every authenticated request; tools that\nneed an authenticated caller return `Unauthorized` when it is missing.\n\n## Also see\n\n- `docs://solvapay/overview.md` (this resource) \u2014 agent-facing narration.\n- `ui://<app>/mcp-app.html` \u2014 the embedded UI shell.\n- `tools/list` + `prompts/list` \u2014 programmatic discovery of the intent tools\n and their slash-command shortcuts.\n- Documentation: https://docs.solvapay.com/sdks/typescript/guides/mcp-app.\n";
1030
+ declare const SOLVAPAY_OVERVIEW_MARKDOWN = "# SolvaPay MCP server \u2014 overview\n\nThis MCP server connects a SolvaPay-protected product to your host so users can\nmanage their plan, usage, and billing **without leaving the chat**. It is\ndual-audience: every tool returns a UI bootstrap for hosts that render MCP UI\nresources (`basic-host`, Claude Desktop, ChatGPT, etc.) and a markdown summary\nwith clickable URLs for text-only hosts.\n\n## What the user can do\n\n- **Upgrade** \u2014 start or change a paid plan. `/upgrade` opens the embedded\n checkout (Stripe Elements inline) on UI hosts and returns a hosted-checkout\n URL on text hosts.\n- **Manage account** \u2014 current plan, balance, usage, payment method, cancel\n or reactivate auto-renewal. Credits + usage are folded inline into the\n account view. `/manage_account`.\n- **Top up credits** \u2014 add SolvaPay credits for usage-based plans.\n `/topup`.\n- **Activate plan** \u2014 pick a plan from the list or activate a specific plan\n by `planRef`. Free plans activate immediately, usage-based plans activate\n when balance covers the configured usage, paid plans return the embedded\n checkout or a hosted-checkout URL. `/activate_plan`.\n\n## How it fits together\n\nEach intent tool returns a full `BootstrapPayload` (merchant + product + plans\n+ customer snapshot) so the embedded UI never fires per-view read calls. When\na paywalled data tool hits the usage limit, its response is plain text: the\n`content[0].text` narration names the recovery intent tool\n(`upgrade` / `topup` / `activate_plan`) and inlines `gate.checkoutUrl` for\nterminal-first hosts. The structured gate rides on `structuredContent` for\nprogrammatic consumers. No widget iframe opens for a gate \u2014 the LLM reads the\nnarration and, if the user agrees, calls the named intent tool which mounts\nthe checkout / topup / account surface.\n\nAuth is handled by the SolvaPay OAuth bridge (see `createMcpOAuthBridge`). The\nbridge injects `customer_ref` onto every authenticated request; tools that\nneed an authenticated caller return `Unauthorized` when it is missing.\n\n## Also see\n\n- `docs://solvapay/overview.md` (this resource) \u2014 agent-facing narration.\n- `ui://<app>/mcp-app.html` \u2014 the embedded UI shell.\n- `tools/list` + `prompts/list` \u2014 programmatic discovery of the intent tools\n and their slash-command shortcuts.\n- Documentation: https://docs.solvapay.com/sdks/typescript/guides/mcp-app.\n";
1029
1031
 
1030
1032
  /**
1031
1033
  * `buildPayableHandler(solvaPay, ctx, handler)` — framework-neutral
1032
1034
  * wrapper that produces an MCP tool handler enforcing the SolvaPay
1033
- * paywall, auto-attaching `_meta.ui` to paywall results, and (when a
1034
- * `buildBootstrap` is provided) embedding the full `BootstrapPayload`
1035
- * in `structuredContent` so the React shell can render the paywall
1036
- * view without a follow-up tool call.
1035
+ * paywall.
1037
1036
  *
1038
1037
  * Merchant handlers receive a `ResponseContext` as their second
1039
1038
  * argument and return the `ResponseResult` envelope produced by
1040
1039
  * `ctx.respond(data, options?)`. `buildPayableHandler` unwraps the
1041
- * envelope — overlaying `options.text` / `options.nudge` and flushing
1042
- * queued `ctx.emit(...)` blocks into the terminal response.
1040
+ * envelope and for text-only paywall / nudge responses — ships
1041
+ * a clean narration + structuredContent pair without routing through
1042
+ * any widget iframe.
1043
1043
  *
1044
- * Every SolvaPay MCP adapter (`@solvapay/mcp`, future `fastmcp` /
1045
- * `fastmcp` adapters) wraps this in its framework-specific
1046
- * `registerTool` / `registerAppTool` call.
1044
+ * Per SEP-1865 / MCP Apps (2026-01-26), the widget iframe for payable
1045
+ * data tools has been deprecated outright: merchant-registered
1046
+ * paywalled tools no longer advertise `_meta.ui.resourceUri` at the
1047
+ * descriptor level, so hosts never open an uninvited iframe on a
1048
+ * successful tool call. Paywall / nudge / activation responses are
1049
+ * plain text narrations naming the recovery intent tool (`upgrade` /
1050
+ * `topup` / `activate_plan`) and inlining `gate.checkoutUrl` for
1051
+ * terminal-only hosts.
1052
+ *
1053
+ * The widget iframe is reserved for the three SolvaPay intent tools
1054
+ * (`upgrade`, `manage_account`, `topup`) where the user deliberately
1055
+ * asked for a checkout UI.
1056
+ *
1057
+ * Every SolvaPay MCP adapter (`@solvapay/mcp`, future `fastmcp`
1058
+ * adapters) wraps this in its framework-specific `registerTool` /
1059
+ * `registerAppTool` call.
1047
1060
  */
1048
1061
 
1049
1062
  interface BuildPayableHandlerContext {
1050
1063
  /** SolvaPay product ref the tool is protected against. */
1051
1064
  product: string;
1052
- /** UI resource URI the MCP host should open to render the paywall view. */
1053
- resourceUri: string;
1054
1065
  /**
1055
- * Builds the full `BootstrapPayload` to embed on paywall results.
1056
- * Wire from `buildSolvaPayDescriptors(...).buildBootstrapPayload`.
1066
+ * Builds the full `BootstrapPayload`. Still accepted on the context
1067
+ * for intent-tool reuse, but NO LONGER consumed by the payable
1068
+ * branch: merchant paywall / nudge responses are text-only now. A
1069
+ * future intent-tool helper may re-use this hook; leaving it on the
1070
+ * type preserves compat for direct callers (`registerPayableTool`).
1071
+ *
1072
+ * @deprecated No longer called by `buildPayableHandler`. Kept on the
1073
+ * context for backwards compatibility with callers that pass it
1074
+ * through a bound helper (e.g. `registerPayable`).
1057
1075
  */
1058
1076
  buildBootstrap?: BuildBootstrapPayloadFn;
1059
1077
  /**
@@ -1077,26 +1095,23 @@ type MerchantHandler<TArgs, TResult> = (args: TArgs, ctx: ResponseContext) => Pr
1077
1095
  * 1. Builds a `ResponseContext` from the pre-check `LimitResponseWithPlan`
1078
1096
  * and passes it as the second arg to the merchant handler.
1079
1097
  * 2. Routes the call through `solvaPay.payable({ product }).mcp(wrappedBusinessLogic)`.
1080
- * 3. Detects paywall results via `isPaywallStructuredContent`.
1081
- * 4. Rewrites `structuredContent` as a full `BootstrapPayload` with
1082
- * `view: 'paywall'` + the original gate content on `paywall`
1083
- * (when `buildBootstrap` is provided otherwise leaves the raw
1084
- * gate content intact).
1085
- * 5. Stamps `_meta.ui = { resourceUri }` so the host knows which UI
1086
- * resource to open.
1087
- * 6. Unwraps the merchant's `ResponseResult` envelope into the
1098
+ * 3. Detects paywall results via `isPaywallStructuredContent` and
1099
+ * ships them verbatim the adapter's `formatGate` already
1100
+ * produced the clean `{ isError: false, content[0].text =
1101
+ * gate.message, structuredContent = gate }` shape.
1102
+ * 4. Unwraps the merchant's `ResponseResult` envelope into the
1088
1103
  * terminal `SolvaPayCallToolResult`: applies `options.text` /
1089
- * `options.nudge` overlays and flushes `ctx.emit(...)` blocks into
1090
- * `content[]`.
1091
- * 7. Silently ignores `options.units` (V1 billing stays at one credit
1104
+ * `options.nudge` (as a text suffix) and flushes `ctx.emit(...)`
1105
+ * blocks into `content[]`.
1106
+ * 5. Silently ignores `options.units` (V1 billing stays at one credit
1092
1107
  * per call; V1.1 will thread it into `trackUsage`).
1093
1108
  */
1094
1109
  declare function buildPayableHandler<TArgs extends Record<string, unknown>, TResult>(solvaPay: SolvaPay, ctx: BuildPayableHandlerContext, handler: MerchantHandler<TArgs, TResult>): (args: Record<string, unknown>, extra?: McpToolExtra) => Promise<SolvaPayCallToolResult>;
1095
1110
 
1096
1111
  /**
1097
1112
  * Framework-neutral OAuth discovery JSON builders. These are runtime-agnostic
1098
- * (no Node, no fetch, no Express) — both `@solvapay/mcp-express` and
1099
- * `@solvapay/mcp-fetch` import them to produce the well-known responses.
1113
+ * (no Node, no fetch, no Express) — both `@solvapay/mcp/express` and
1114
+ * `@solvapay/mcp/fetch` import them to produce the well-known responses.
1100
1115
  *
1101
1116
  * Kept in `@solvapay/mcp-core` so third-party adapter authors (raw JSON-RPC,
1102
1117
  * `fastmcp`, …) can reuse the exact same shapes with zero transitive deps.
@@ -1164,4 +1179,4 @@ interface BuildAuthInfoFromBearerOptions extends McpBearerCustomerRefOptions {
1164
1179
  }
1165
1180
  declare function buildAuthInfoFromBearer(authorization?: string | null, options?: BuildAuthInfoFromBearerOptions): McpToolExtra['authInfo'] | null;
1166
1181
 
1167
- export { type BootstrapCustomer, type BootstrapMerchant, type BootstrapPayload, type BootstrapPlan, type BootstrapProduct, type BuildAuthInfoFromBearerOptions, type BuildBootstrapPayloadFn, type BuildPayableHandlerContext, type BuildSolvaPayDescriptorsOptions, type BuildSolvaPayRequestOptions, type ContentBlock, type CreateBuildBootstrapPayloadOptions, type CustomerSnapshot, DEFAULT_OAUTH_PATHS, type IntentTool, MCP_TOOL_NAMES, type McpAdapterOptions, McpBearerAuthError, type McpBearerCustomerRefOptions, type McpToolExtra, type McpToolName, NARRATORS, type NarratorOutput, type NudgeSpec, type OAuthAuthorizationServerOptions, type OAuthBridgePaths, OPEN_TOOL_FOR_VIEW, type PayableHandler, type PaywallToolResult, type PaywallToolResultContext, type PaywallUiMeta, type PaywallUiMetaInput, type ResponseContext, type ResponseOptions, type ResponseResult, SOLVAPAY_DEFAULT_CSP, SOLVAPAY_MCP_VIEW_KINDS, SOLVAPAY_OVERVIEW_MARKDOWN, SOLVAPAY_OVERVIEW_MIME_TYPE, SOLVAPAY_OVERVIEW_URI, type SolvaPayCallToolResult, type SolvaPayDescriptorBundle, type SolvaPayDocsResourceDescriptor, type SolvaPayMcpCsp, type SolvaPayMcpPaywallContent, type SolvaPayMcpViewKind, type SolvaPayMerchantBranding, type SolvaPayPromptDescriptor, type SolvaPayPromptResult, type SolvaPayResourceDescriptor, type SolvaPayToolAnnotations, type SolvaPayToolDescriptor, type SolvaPayToolIcon, type SolvaPayToolMode, TOOL_FOR_VIEW, VIEW_FOR_OPEN_TOOL, VIEW_FOR_TOOL, balanceSummary, buildAuthInfoFromBearer, buildPayableHandler, buildPaywallUiMeta, buildSolvaPayDescriptors, buildSolvaPayPrompts, buildSolvaPayRequest, createBuildBootstrapPayload, decodeJwtPayload, defaultGetCustomerRef, enrichPurchase, extractBearerToken, getCustomerRefFromBearerAuthHeader, getCustomerRefFromJwtPayload, getOAuthAuthorizationServerResponse, getOAuthProtectedResourceResponse, mergeCsp, narrateActivatePlan, narrateManageAccount, narrateTopup, narrateUpgrade, narratedToolResult, parseMode, paywallToolResult, previewJson, resolveOAuthPaths, toolErrorResult, toolResult, uiPlaceholder, withoutTrailingSlash };
1182
+ export { type BootstrapCustomer, type BootstrapMerchant, type BootstrapPayload, type BootstrapPlan, type BootstrapProduct, type BuildAuthInfoFromBearerOptions, type BuildBootstrapPayloadFn, type BuildPayableHandlerContext, type BuildSolvaPayDescriptorsOptions, type BuildSolvaPayRequestOptions, type ContentBlock, type CreateBuildBootstrapPayloadOptions, type CustomerSnapshot, DEFAULT_OAUTH_PATHS, type IntentTool, MCP_TOOL_NAMES, type McpAdapterOptions, McpBearerAuthError, type McpBearerCustomerRefOptions, type McpToolExtra, type McpToolName, NARRATORS, type NarratorOutput, type NudgeSpec, type OAuthAuthorizationServerOptions, type OAuthBridgePaths, OPEN_TOOL_FOR_VIEW, type PayableHandler, type PaywallToolResult, type PaywallToolResultContext, type ResponseContext, type ResponseOptions, type ResponseResult, SOLVAPAY_DEFAULT_CSP, SOLVAPAY_MCP_VIEW_KINDS, SOLVAPAY_OVERVIEW_MARKDOWN, SOLVAPAY_OVERVIEW_MIME_TYPE, SOLVAPAY_OVERVIEW_URI, type SolvaPayCallToolResult, type SolvaPayDescriptorBundle, type SolvaPayDocsResourceDescriptor, type SolvaPayMcpCsp, type SolvaPayMcpViewKind, type SolvaPayMerchantBranding, type SolvaPayPromptDescriptor, type SolvaPayPromptResult, type SolvaPayResourceDescriptor, type SolvaPayToolAnnotations, type SolvaPayToolDescriptor, type SolvaPayToolIcon, type SolvaPayToolMode, TOOL_FOR_VIEW, VIEW_FOR_OPEN_TOOL, VIEW_FOR_TOOL, applyHideToolsByAudience, balanceSummary, buildAuthInfoFromBearer, buildPayableHandler, buildSolvaPayDescriptors, buildSolvaPayPrompts, buildSolvaPayRequest, createBuildBootstrapPayload, decodeJwtPayload, defaultGetCustomerRef, deriveIcons, enrichPurchase, extractBearerToken, getCustomerRefFromBearerAuthHeader, getCustomerRefFromJwtPayload, getOAuthAuthorizationServerResponse, getOAuthProtectedResourceResponse, mergeCsp, narrateActivatePlan, narrateManageAccount, narrateTopup, narrateUpgrade, narratedToolResult, parseMode, paywallToolResult, previewJson, resolveOAuthPaths, toolErrorResult, toolResult, uiPlaceholder, withoutTrailingSlash };