ADR-004: Use domain APIs as MCP data sources
MCP data access goes through Catalog and Rating service APIs instead of reading their databases directly.
1. Context & Problem
To answer customer questions and support recommendations, the shared AI integration adapter must combine book information owned by CatalogDomainv1.0.0CatalogCore BookWorm subdomain that makes books discoverable, purchasable, and consistently described across the customer journ...Ownercatalog-experience-teamDiagramOpen docs with reader feedback owned by ReviewsDomainv1.0.0ReviewsCaptures individual customer feedback for books, publishes rating changes for Catalog discovery, and provides privacy-sc...Ownercatalog-experience-teamDiagramOpen docs. Reading directly from those services’ underlying databases would bypass established service boundaries, couple the AI adapter to internal storage schemas, and force the adapter to duplicate domain query and authorization logic.
BookWorm needed a clear rule for how the AI integration layer sources domain data while letting Catalog and Reviews evolve independently.
2. Business Value
- Independent domain evolution: Catalog and Reviews teams can redesign or optimize their internal databases without breaking AI integrations.
- Consistent business rules and security: Reusing domain service interfaces ensures AI lookups respect the exact same query semantics and authorization checks as every other consumer.
- Transparent reliability: When an upstream domain service is unavailable, the failure is surfaced honestly rather than disguised as missing or empty data, preventing misleading AI answers.
- Zero data-sync overhead: Avoiding a separate copy of catalog or review data removes synchronization pipelines, stale-cache repair jobs, and storage duplication costs.
3. How It Works
The shared AI integration server acts purely as a live pass-through adapter to the owning domain services:
- When an AI client requests book details or catalog searches, the adapter forwards the request to the Catalog service.
- When an AI client requests reviews or ratings, the adapter forwards the request to the Rating service.
- The adapter never connects directly to the Catalog or Rating databases, and it does not store or cache its own copy of domain records.
- Results returned by the domain services are packaged into the AI integration format and returned to the caller. If an upstream service fails or denies access, the adapter reports the error clearly instead of pretending no books or reviews exist.
4. Trade-offs & Lessons Learned
- Upstream dependency vs. schema coupling: Routing through domain APIs adds a network hop and makes AI lookups depend on upstream API availability, latency, and authorization policies—an intentional trade-off to avoid brittle direct database coupling.
- Adapter maintenance on API changes: Because the adapter consumes domain service contracts, changes to Catalog or Rating APIs may require corresponding updates to the adapter.
- No atomic cross-domain snapshot: Combining data from multiple domain APIs means each source may reflect slightly different latency and freshness; the adapter does not provide a single point-in-time snapshot across domains.
- Infrastructure alignment required: Network policies, service discovery, and identity permissions must explicitly allow the integration server to reach and authenticate with each upstream domain API.
Alternatives Evaluated
- Query Catalog and Rating databases directly: Rejected because it saves a service hop at the cost of coupling to private schemas, sharing database credentials, and bypassing domain boundaries.
- Replicate domain data into an adapter-owned store: Rejected because it creates a second data set requiring synchronization, freshness guarantees, and repair workflows.
- Duplicate domain rules inside the adapter: Rejected because business logic in the adapter would inevitably drift from the authoritative Catalog and Rating services.
5. Technical Reference
- Decision status: Accepted (
2026-11-04) - Affected systems, services & containers: MCP ServerServicev1.0.0MCP ServerInternal stateless Streamable HTTP MCP service that exposes read-only
Catalog lookup tools and reusable AI prompts.
PublishesListBooksGrpc, GetBookDetailsGrpc +2Ownerai-capabilities-teamDiagramRepositoryOpen docs, Catalog APIServicev1.0.0Catalog APIInternal HTTP and gRPC service for Catalog product management, hybrid
discovery, and authoritative book metadata.
PublishesBookUpdatedRatingFailedIntegrationEventSubscribesCreatePublisher, UpdatePublisher +24APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs, Rating APIServicev1.0.0Rating APIInternal HTTP and A2A gRPC service for collecting, listing, deleting, and
summarizing customer feedback for Catalog book...PublishesFeedbackCreatedIntegrationEvent, FeedbackDeletedIntegrationEventSubscribesCreateFeedback, DeleteFeedback +3APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs, Catalog DatabaseContainerv1.0.0Catalog DatabaseAuthoritative PostgreSQL system of record owned by the Catalog bounded context for books, authors, categories, publisher...Ownercatalog-experience-teamDiagramOpen docs, Rating DatabaseContainerv1.0.0Rating DatabaseAuthoritative Azure Cosmos DB system of record owned by the Reviews bounded context for customer feedback documents part...Ownercatalog-experience-teamDiagramOpen docs,
mcp-tools,product-catalog-system,rating-system - Data access path: MCP ServerServicev1.0.0MCP ServerInternal stateless Streamable HTTP MCP service that exposes read-only Catalog lookup tools and reusable AI prompts. PublishesListBooksGrpc, GetBookDetailsGrpc +2Ownerai-capabilities-teamDiagramRepositoryOpen docs retrieves Catalog data exclusively through Catalog APIServicev1.0.0Catalog APIInternal HTTP and gRPC service for Catalog product management, hybrid discovery, and authoritative book metadata. PublishesBookUpdatedRatingFailedIntegrationEventSubscribesCreatePublisher, UpdatePublisher +24APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs and review data exclusively through Rating APIServicev1.0.0Rating APIInternal HTTP and A2A gRPC service for collecting, listing, deleting, and summarizing customer feedback for Catalog book...PublishesFeedbackCreatedIntegrationEvent, FeedbackDeletedIntegrationEventSubscribesCreateFeedback, DeleteFeedback +3APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs. Direct connections to Catalog DatabaseContainerv1.0.0Catalog DatabaseAuthoritative PostgreSQL system of record owned by the Catalog bounded context for books, authors, categories, publisher...Ownercatalog-experience-teamDiagramOpen docs and Rating DatabaseContainerv1.0.0Rating DatabaseAuthoritative Azure Cosmos DB system of record owned by the Reviews bounded context for customer feedback documents part...Ownercatalog-experience-teamDiagramOpen docs are prohibited.
- Caching & state: MCP ServerServicev1.0.0MCP ServerInternal stateless Streamable HTTP MCP service that exposes read-only Catalog lookup tools and reusable AI prompts. PublishesListBooksGrpc, GetBookDetailsGrpc +2Ownerai-capabilities-teamDiagramRepositoryOpen docs maintains no application data store and does not cache upstream responses.
- Failure semantics: Upstream API failures remain visible to MCP clients and prevent the lookup or resource read from completing; MCP ServerServicev1.0.0MCP ServerInternal stateless Streamable HTTP MCP service that exposes read-only Catalog lookup tools and reusable AI prompts. PublishesListBooksGrpc, GetBookDetailsGrpc +2Ownerai-capabilities-teamDiagramRepositoryOpen docs must not mask an unavailable API as valid empty data.
- Security & discovery: Infrastructure and authorization policies must permit MCP ServerServicev1.0.0MCP ServerInternal stateless Streamable HTTP MCP service that exposes read-only Catalog lookup tools and reusable AI prompts. PublishesListBooksGrpc, GetBookDetailsGrpc +2Ownerai-capabilities-teamDiagramRepositoryOpen docs to discover and authenticate to Catalog APIServicev1.0.0Catalog APIInternal HTTP and gRPC service for Catalog product management, hybrid discovery, and authoritative book metadata. PublishesBookUpdatedRatingFailedIntegrationEventSubscribesCreatePublisher, UpdatePublisher +24APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs and Rating APIServicev1.0.0Rating APIInternal HTTP and A2A gRPC service for collecting, listing, deleting, and summarizing customer feedback for Catalog book...PublishesFeedbackCreatedIntegrationEvent, FeedbackDeletedIntegrationEventSubscribesCreateFeedback, DeleteFeedback +3APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs.