Skip to content

Document stateless BYOK provider auth for derived-account adapters #2135

@bokelley

Description

@bokelley

Clarified ask

This is a documentation/pattern ask, not a request for new OAuth runtime functionality.

The SDK already has the primitives we need for OAuth/BYOK provider auth:

  • bearer/introspection/custom authentication can populate request authInfo
  • authInfo carries the token and stable credential/client identity
  • createDerivedAccountStore can require auth and derive the per-request account from ctx.authInfo
  • missing auth already maps to SDK AUTH_REQUIRED

We need docs/examples that show how to combine these pieces for Storefront-backed provider adapters.

Storefront model

Storefront is the buyer-facing seller/platform boundary. Inside that boundary, some backing adapters are provider-auth adapters: the client owns the provider credential lifecycle, passes the current provider bearer/API/OAuth token to the MCP session or tool call, and the Storefront adapter derives the per-request account/auth context from that credential.

Other Storefront flows that register or acknowledge buyer accounts can continue to use sync_accounts / implicit-account patterns. This issue is not asking to replace those shapes.

Desired docs/example

Show createDerivedAccountStore as the canonical pattern for provider-auth adapters behind a Storefront boundary:

const accounts = createDerivedAccountStore<MyAdapterMeta>({
  toAccount: (ctx) => ({
    id: 'audiostack',
    name: 'AudioStack',
    status: 'active',
    authInfo: ctx?.authInfo,
    ctx_metadata: {},
  }),
})

The important properties:

  • platform handlers can read the provider token from the resolved account/request auth context, e.g. ctx.account.authInfo.token or the current equivalent field
  • handlers can use a stable non-secret identity such as ctx.account.authInfo.clientId / credential id for idempotency and cache scoping
  • the host app does not persist provider credentials
  • no refresh token store, provider token store, or OAuth callback route is required when the client owns OAuth
  • AUTH_REQUIRED from createDerivedAccountStore is the standard signal clients can use to prompt for provider credentials

Per-tool / per-specialism guidance

Please document the expected pattern when only some Storefront-backed adapter tools require provider auth:

  • AudioStack creative tools require AudioStack bearer/OAuth auth.
  • get_adcp_capabilities should not require provider auth.
  • Some sales adapters may require auth for list_accounts, get_products, etc.

If account-resolution-level auth via createDerivedAccountStore is the intended mechanism, document that. If a tool/specialism should instead gate inside the handler using ctx.account.authInfo, show that pattern.

Non-goal

This is not asking the SDK to store provider credentials or implement OAuth on behalf of the Storefront host. For client-owned OAuth, the SDK already has the needed auth primitives; we just need the derived-account BYOK/provider-adapter recipe documented clearly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions