Best practice for exposing Magento 2 data to an external AI/MCP service

I’m working on an integration where an external AI service queries Magento 2
business data (orders, products, customers) using natural-language requests.

From an architectural point of view, I see two possible approaches:

  1. Implementing a Magento 2 module that accesses Magento internals
    (repositories, collections) and exposes AI-friendly endpoints.

  2. Using a standalone middleware service that integrates with Magento
    only via REST or GraphQL APIs.

From a Magento best-practices perspective:

  • Which approach is recommended for long-term maintainability and security?
  • Are there cases where deeper internal access via a module is justified,
    or should integrations always go through APIs?

I’m looking for architectural guidance rather than specific tools or products.