Build sales-api REST + MCP layers (Layer 3), full build in one pass

14 routes: Order (single key, full CRUD + order-details sub-resource)
and Orderdetail (composite key ordernumber+productcode, own
top-level resource, mirrors backend's own URL structure). MCP layer
built with the corrected single-route pattern from the start
(STATUS.md section 18) — 7 tools, list/get read-only for all 5
roles, create-order/create-orderdetail for admin+customer+support
(verified against OrderPermission/OrderScopedPermission.check() —
support gets an unconditional class-level pass, the status-only
restriction is object-level and doesn't apply to create).

Keycloak (local): sales-api-audience + mcp-sales-audience client
scopes, sales-api + mcp-sales resource clients, attached to the
broker and librechat respectively. Deploy key and broker secret
reused/mirrored from catalog-api and the live broker client, same
pattern as customers-api/payments-api.
This commit is contained in:
Stéphane Tailland
2026-08-23 17:02:17 +02:00
parent 88b2136903
commit de69f88e29
28 changed files with 1481 additions and 11 deletions
+233
View File
@@ -0,0 +1,233 @@
apiVersion: configuration.konghq.com/v1alpha1
kind: KongPluginBinding
metadata:
name: ${NAME}-sales-api-rewrite-listorders-binding
namespace: ${NAMESPACE}
spec:
controlPlaneRef:
type: konnectNamespacedRef
konnectNamespacedRef:
name: ${CONTROL_PLANE_REF_NAME}
pluginRef:
name: ${NAME}-sales-api-rewrite-listorders
targets:
routeRef:
group: configuration.konghq.com
kind: KongRoute
name: ${NAME}-sales-api-listorders
---
apiVersion: configuration.konghq.com/v1alpha1
kind: KongPluginBinding
metadata:
name: ${NAME}-sales-api-rewrite-createorder-binding
namespace: ${NAMESPACE}
spec:
controlPlaneRef:
type: konnectNamespacedRef
konnectNamespacedRef:
name: ${CONTROL_PLANE_REF_NAME}
pluginRef:
name: ${NAME}-sales-api-rewrite-createorder
targets:
routeRef:
group: configuration.konghq.com
kind: KongRoute
name: ${NAME}-sales-api-createorder
---
apiVersion: configuration.konghq.com/v1alpha1
kind: KongPluginBinding
metadata:
name: ${NAME}-sales-api-rewrite-getorder-binding
namespace: ${NAMESPACE}
spec:
controlPlaneRef:
type: konnectNamespacedRef
konnectNamespacedRef:
name: ${CONTROL_PLANE_REF_NAME}
pluginRef:
name: ${NAME}-sales-api-rewrite-getorder
targets:
routeRef:
group: configuration.konghq.com
kind: KongRoute
name: ${NAME}-sales-api-getorder
---
apiVersion: configuration.konghq.com/v1alpha1
kind: KongPluginBinding
metadata:
name: ${NAME}-sales-api-rewrite-updateorder-binding
namespace: ${NAMESPACE}
spec:
controlPlaneRef:
type: konnectNamespacedRef
konnectNamespacedRef:
name: ${CONTROL_PLANE_REF_NAME}
pluginRef:
name: ${NAME}-sales-api-rewrite-updateorder
targets:
routeRef:
group: configuration.konghq.com
kind: KongRoute
name: ${NAME}-sales-api-updateorder
---
apiVersion: configuration.konghq.com/v1alpha1
kind: KongPluginBinding
metadata:
name: ${NAME}-sales-api-rewrite-patchorder-binding
namespace: ${NAMESPACE}
spec:
controlPlaneRef:
type: konnectNamespacedRef
konnectNamespacedRef:
name: ${CONTROL_PLANE_REF_NAME}
pluginRef:
name: ${NAME}-sales-api-rewrite-patchorder
targets:
routeRef:
group: configuration.konghq.com
kind: KongRoute
name: ${NAME}-sales-api-patchorder
---
apiVersion: configuration.konghq.com/v1alpha1
kind: KongPluginBinding
metadata:
name: ${NAME}-sales-api-rewrite-deleteorder-binding
namespace: ${NAMESPACE}
spec:
controlPlaneRef:
type: konnectNamespacedRef
konnectNamespacedRef:
name: ${CONTROL_PLANE_REF_NAME}
pluginRef:
name: ${NAME}-sales-api-rewrite-deleteorder
targets:
routeRef:
group: configuration.konghq.com
kind: KongRoute
name: ${NAME}-sales-api-deleteorder
---
apiVersion: configuration.konghq.com/v1alpha1
kind: KongPluginBinding
metadata:
name: ${NAME}-sales-api-rewrite-getorderorderdetails-binding
namespace: ${NAMESPACE}
spec:
controlPlaneRef:
type: konnectNamespacedRef
konnectNamespacedRef:
name: ${CONTROL_PLANE_REF_NAME}
pluginRef:
name: ${NAME}-sales-api-rewrite-getorderorderdetails
targets:
routeRef:
group: configuration.konghq.com
kind: KongRoute
name: ${NAME}-sales-api-getorderorderdetails
---
apiVersion: configuration.konghq.com/v1alpha1
kind: KongPluginBinding
metadata:
name: ${NAME}-sales-api-rewrite-listorderdetails-binding
namespace: ${NAMESPACE}
spec:
controlPlaneRef:
type: konnectNamespacedRef
konnectNamespacedRef:
name: ${CONTROL_PLANE_REF_NAME}
pluginRef:
name: ${NAME}-sales-api-rewrite-listorderdetails
targets:
routeRef:
group: configuration.konghq.com
kind: KongRoute
name: ${NAME}-sales-api-listorderdetails
---
apiVersion: configuration.konghq.com/v1alpha1
kind: KongPluginBinding
metadata:
name: ${NAME}-sales-api-rewrite-createorderdetail-binding
namespace: ${NAMESPACE}
spec:
controlPlaneRef:
type: konnectNamespacedRef
konnectNamespacedRef:
name: ${CONTROL_PLANE_REF_NAME}
pluginRef:
name: ${NAME}-sales-api-rewrite-createorderdetail
targets:
routeRef:
group: configuration.konghq.com
kind: KongRoute
name: ${NAME}-sales-api-createorderdetail
---
apiVersion: configuration.konghq.com/v1alpha1
kind: KongPluginBinding
metadata:
name: ${NAME}-sales-api-rewrite-getorderdetail-binding
namespace: ${NAMESPACE}
spec:
controlPlaneRef:
type: konnectNamespacedRef
konnectNamespacedRef:
name: ${CONTROL_PLANE_REF_NAME}
pluginRef:
name: ${NAME}-sales-api-rewrite-getorderdetail
targets:
routeRef:
group: configuration.konghq.com
kind: KongRoute
name: ${NAME}-sales-api-getorderdetail
---
apiVersion: configuration.konghq.com/v1alpha1
kind: KongPluginBinding
metadata:
name: ${NAME}-sales-api-rewrite-updateorderdetail-binding
namespace: ${NAMESPACE}
spec:
controlPlaneRef:
type: konnectNamespacedRef
konnectNamespacedRef:
name: ${CONTROL_PLANE_REF_NAME}
pluginRef:
name: ${NAME}-sales-api-rewrite-updateorderdetail
targets:
routeRef:
group: configuration.konghq.com
kind: KongRoute
name: ${NAME}-sales-api-updateorderdetail
---
apiVersion: configuration.konghq.com/v1alpha1
kind: KongPluginBinding
metadata:
name: ${NAME}-sales-api-rewrite-patchorderdetail-binding
namespace: ${NAMESPACE}
spec:
controlPlaneRef:
type: konnectNamespacedRef
konnectNamespacedRef:
name: ${CONTROL_PLANE_REF_NAME}
pluginRef:
name: ${NAME}-sales-api-rewrite-patchorderdetail
targets:
routeRef:
group: configuration.konghq.com
kind: KongRoute
name: ${NAME}-sales-api-patchorderdetail
---
apiVersion: configuration.konghq.com/v1alpha1
kind: KongPluginBinding
metadata:
name: ${NAME}-sales-api-rewrite-deleteorderdetail-binding
namespace: ${NAMESPACE}
spec:
controlPlaneRef:
type: konnectNamespacedRef
konnectNamespacedRef:
name: ${CONTROL_PLANE_REF_NAME}
pluginRef:
name: ${NAME}-sales-api-rewrite-deleteorderdetail
targets:
routeRef:
group: configuration.konghq.com
kind: KongRoute
name: ${NAME}-sales-api-deleteorderdetail