Skip to content

feat: add Klarna Agentic Product Protocol adapter for US product search - #34

Open
BuyWhere wants to merge 2 commits into
mainfrom
lyra/klarna-adapter
Open

feat: add Klarna Agentic Product Protocol adapter for US product search#34
BuyWhere wants to merge 2 commits into
mainfrom
lyra/klarna-adapter

Conversation

@BuyWhere

@BuyWhere BuyWhere commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a Klarna Agentic Product Protocol adapter that merges US product search results into BuyWhere MCP when the KLARNA_API_TOKEN env var is configured.

Changes

Code

  • src/klarna-adapter.ts — thin wrapper around Klarna agentic API with searchKlarna(), getKlarnaOffers(), pickBestOffer(), and formatKlarnaForBuyWhere()
  • src/index.ts — three integration points:
    • search_products: merges Klarna results inline for US queries (with source: Klarna (US) provenance)
    • get_product: routes krn:kpdc:product:* IDs to Klarna API
    • find_best_price: Klarna-first short-circuit for US queries when BuyWhere has no results

Documentation

  • README.md — Added Klarna integration section with configuration docs and "Built on Klarna Agentic Product Protocol" badge
  • RELEASE_NOTES.md — v1.1.0 entry

Built on Klarna Agentic Product Protocol

This integration uses the Klarna Agentic Product Protocol API (v2) for US product search. See https://docs.klarna.com/agentic-product-protocol for details.

Testing

  • Build passes (tsc)
  • Klarna adapter compiles independently
  • Integration points compile cleanly

Requires KLARNA_API_TOKEN env var to activate. Non-US queries are unaffected (Klarna merge only activates for country=us or region=us).

BuyWhere Bot added 2 commits June 25, 2026 10:43
Merges Klarna US search results into BuyWhere MCP server when
KLARNA_API_TOKEN env var is configured:

- src/klarna-adapter.ts: thin wrapper around Klarna agentic API
  - searchKlarna() — US product search
  - getKlarnaOffers() — product offer lookup
  - pickBestOffer() — best-price picker
  - formatKlarnaForBuyWhere() — formats Klarna results to BuyWhere shape

- src/index.ts: three integration points
  - search_products: merges Klarna results inline for US queries
  - get_product: routes krn:kpdc:product:* IDs to Klarna API
  - find_best_price: Klarna first short-circuit for US queries

Built on Klarna Agentic Product Protocol
- README: Klarna integration section with badge, config docs, tool descriptions
- RELEASE_NOTES: v1.1.0 entry covering all Klarna changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant