diff --git a/cmd/cart/main.go b/cmd/cart/main.go index 7ecce73..da3dc47 100644 --- a/cmd/cart/main.go +++ b/cmd/cart/main.go @@ -14,6 +14,7 @@ import ( "git.k6n.net/mats/go-cart-actor/pkg/actor" "git.k6n.net/mats/go-cart-actor/pkg/cart" + cartmcp "git.k6n.net/mats/go-cart-actor/pkg/cart/mcp" "git.k6n.net/mats/go-cart-actor/pkg/promotions" promotionmcp "git.k6n.net/mats/go-cart-actor/pkg/promotions/mcp" "git.k6n.net/mats/go-cart-actor/internal/ucp" @@ -242,6 +243,8 @@ func main() { log.Fatalf("Error creating cart pool: %v\n", err) } + cartMCP := cartmcp.New(pool) + // Publish each applied mutation to the "cart"/"mutation" RabbitMQ topic so the // backoffice /commerce live feed (and other consumers) see cart activity. // Best-effort: if AMQP is unreachable the cart still serves; the feed stays empty. @@ -299,6 +302,13 @@ func main() { mux.Handle("/mcp", promotionMCP.Handler()) mux.Handle("/mcp/", promotionMCP.Handler()) + // Cart MCP edge: inspect and mutate carts — get_cart, get_cart_items, + // update_item_quantity, remove_cart_item, clear_cart, apply_voucher, etc. + // Exposes 11 tools on the same grain pool, mounted at /cart-mcp so it does + // not conflict with the Promotions MCP at /mcp. + mux.Handle("/cart-mcp", cartMCP.Handler()) + mux.Handle("/cart-mcp/", cartMCP.Handler()) + // UCP REST adapter — Universal Commerce Protocol cartUCP := ucp.CartHandler(pool) if signer := loadUCPCartSigner(); signer != nil {