@agorio/sdk • Docs
Class: UcpClient
Constructors
new UcpClient()
new UcpClient(
options):UcpClient
Parameters
• options: UcpClientOptions = {}
Returns
Defined in
src/client/ucp-client.ts:36
Methods
callApi()
callApi(
path,options):Promise<unknown>
Make an API call to the merchant, using the preferred transport.
Transport selection:
- ‘auto’ (default): tries MCP if available, falls back to REST
- ‘rest’: REST only
- ‘mcp’: MCP only (throws if unavailable)
Parameters
• path: string
• options = {}
• options.body?: unknown
• options.method?: string
• options.serviceName?: string
• options.transport?: TransportPreference
Returns
Promise<unknown>
Defined in
src/client/ucp-client.ts:261
callMcp()
callMcp(
method,params?,serviceName?):Promise<unknown>
Make a direct JSON-RPC call via MCP transport.
Parameters
• method: string
• params?: Record<string, unknown>
• serviceName?: string
Returns
Promise<unknown>
Defined in
src/client/ucp-client.ts:328
discover()
discover(
domain):Promise<DiscoveryResult>
Discover a UCP merchant by domain. Fetches /.well-known/ucp, normalizes the profile, and caches the result.
Parameters
• domain: string
Returns
Promise<DiscoveryResult>
Defined in
src/client/ucp-client.ts:51
fetchSchema()
fetchSchema(
serviceName?):Promise<unknown>
Fetch the OpenAPI schema for a service.
Parameters
• serviceName?: string
Returns
Promise<unknown>
Defined in
src/client/ucp-client.ts:345
getA2aEndpoint()
getA2aEndpoint(
serviceName?):undefined|string
Get the A2A (agent-to-agent) agent card URL for a service. (v0.9)
Parameters
• serviceName?: string
Returns
undefined | string
Defined in
src/client/ucp-client.ts:181
getCapabilities()
getCapabilities():
UcpCapability[]
List all capabilities the merchant supports.
Returns
Defined in
src/client/ucp-client.ts:131
getCapability()
getCapability(
name):undefined|UcpCapability
Get a specific capability by name.
Parameters
• name: string
Returns
undefined | UcpCapability
Defined in
src/client/ucp-client.ts:145
getCapabilityLineage()
getCapabilityLineage(
name):UcpCapability[]
Walk the extends chain from a capability up to its base. (v0.9)
Returns the chain ordered from the queried capability to the root. If a capability is not found mid-chain, the walk stops and the partial chain is returned. Loops are guarded.
Parameters
• name: string
Returns
Defined in
src/client/ucp-client.ts:237
getDiscovery()
getDiscovery():
DiscoveryResult
Get the cached discovery result, or throw if not yet discovered.
Returns
Defined in
src/client/ucp-client.ts:121
getExtensionsOf()
getExtensionsOf(
parentName):UcpCapability[]
List capabilities whose extends field points at parentName. (v0.9)
Useful for discovering extensions of a base capability — e.g., every
extension of dev.ucp.shopping.checkout that the merchant advertises.
Parameters
• parentName: string
Returns
Defined in
src/client/ucp-client.ts:226
getMcpEndpoint()
getMcpEndpoint(
serviceName?):undefined|string
Get the MCP endpoint for a service.
Parameters
• serviceName?: string
Returns
undefined | string
Defined in
src/client/ucp-client.ts:170
getPaymentHandler()
getPaymentHandler(
id):undefined|PaymentHandler
Get a single payment handler by id. (v0.9)
Returned object includes config, config_schema, and
instrument_schemas so callers can introspect what the handler accepts.
Parameters
• id: string
Returns
undefined | PaymentHandler
Defined in
src/client/ucp-client.ts:202
getPaymentHandlers()
getPaymentHandlers():
PaymentHandler[]
Get payment handlers.
Returns
Defined in
src/client/ucp-client.ts:192
getRestEndpoint()
getRestEndpoint(
serviceName?):undefined|string
Get the REST endpoint for a service.
Parameters
• serviceName?: string
Returns
undefined | string
Defined in
src/client/ucp-client.ts:159
getServices()
getServices():
NormalizedService[]
Get all services with their transports.
Returns
Defined in
src/client/ucp-client.ts:152
getSigningKey()
getSigningKey(
kid):undefined|JwkKey
Look up a signing key by its kid. (v0.9)
Parameters
• kid: string
Returns
undefined | JwkKey
Defined in
src/client/ucp-client.ts:216
getSigningKeys()
getSigningKeys():
JwkKey[]
Get all signing keys advertised in the profile. (v0.9)
Returns
JwkKey[]
Defined in
src/client/ucp-client.ts:209
hasCapability()
hasCapability(
name):boolean
Check if merchant supports a specific capability.
Parameters
• name: string
Returns
boolean
Defined in
src/client/ucp-client.ts:138