AWS Builder Center

Connecting SaaS-hosted AI agents to SaaS-hosted MCP servers with Amazon Bedrock AgentCore

Learn how to place a governed Amazon Bedrock AgentCore MCP boundary between SaaS-hosted AI agents and SaaS-hosted tools while preserving user-level authorization.

SaaS-hosted AI assistants are increasingly able to act as Model Context Protocol (MCP) clients. At the same time, business software providers are publishing hosted MCP servers that expose search, retrieval, and workflow tools.
Connecting the two directly can be convenient. However, a collection of direct connections creates a fragmented security model: every assistant receives a separate configuration, every provider implements OAuth differently, and central teams struggle to determine which user, client, and tool caused an action.
Amazon Bedrock AgentCore Gateway can provide a stable, governed MCP endpoint between these two SaaS domains. It validates inbound identity, presents an approved tool catalog, evaluates policy, records activity, and delegates outbound credentials through Amazon Bedrock AgentCore Identity. When a client or provider has a protocol gap, an optional compatibility adapter hosted in AgentCore Runtime can normalize the interaction without becoming another identity provider or credential store.
In this article, you will learn how to:
  • Separate enterprise access from downstream SaaS authorization.
  • Use AgentCore Gateway as a durable enterprise tool boundary.
  • Choose between direct MCP targets and compatibility adapters.
  • Preserve provider-native, per-user permissions.
  • Introduce tool policy and write capabilities safely.
  • Promote the pattern consistently across environments.

The problem: two identity domains, not one

A user who signs in to an AI assistant through an enterprise identity provider has proved who they are to the enterprise. That does not automatically authorize the assistant to act in a third-party SaaS account. The SaaS provider owns a separate authorization boundary, data-sharing model, consent experience, scope vocabulary, and token lifecycle.
A secure architecture therefore answers two independent questions:
  1. Enterprise access: Is this user and this agent client allowed to invoke this MCP tool through the enterprise Gateway?
  1. Provider delegation: Has this user authorized access to the downstream SaaS provider, and what objects does that provider allow the user to see or change?
Conflating these questions often leads to shared service accounts, overly broad access, or attempts to replay one token across unrelated audiences. Keeping them separate preserves least privilege and allows the SaaS provider's existing sharing model to remain authoritative.

Reference architecture

Core idea: Treat AgentCore Gateway as the durable enterprise tool boundary. Agent clients and SaaS providers can change independently while identity, authorization policy, audit, and deployment controls remain consistent.
Figure 1 — Reference architecture with separate enterprise and SaaS authorization boundaries.
Reference architecture with separate enterprise and SaaS authorization boundaries.

Component
Responsibility
SaaS-hosted agent client
Acts as an MCP client, performs enterprise OAuth, discovers approved tools, and presents user interactions such as consent links or confirmations.
Enterprise identity provider
Authenticates the person and issues a JSON Web Token (JWT) with an approved issuer, client identifier, audience, scopes, and subject.
AgentCore Gateway
Acts as the MCP resource server and stable entry point. It validates inbound authorization, exposes targets, invokes policy, and records Gateway activity.
AgentCore Policy
Makes deterministic, tool-level authorization decisions based on the principal, action, Gateway, claims, and request context.
Request interceptor (optional)
Performs narrowly scoped validation or transformation before routing. It must fail closed and must not log bearer tokens or credentials.
Compatibility adapter in AgentCore Runtime (optional)
Normalizes MCP transport, tool schemas, provider-specific errors, or user-authorization handoff when a direct Gateway target is insufficient.
AgentCore Identity
Manages outbound OAuth providers, user-delegated authorization, token retrieval, refresh, and secure credential storage.
SaaS-hosted MCP server
Publishes tools and enforces the provider's scopes, user permissions, sharing model, and API limits.
Authorization completion application (conditional)
Completes OAuth URL session binding when the initiating client cannot perform the required completion API call. It receives only an opaque session reference and obtains user identity from trusted authentication context.

End-to-end request flow

  1. The user enables the enterprise MCP connection in a SaaS-hosted agent client.
  1. The client discovers the Gateway's OAuth protected-resource metadata and starts an authorization code flow with Proof Key for Code Exchange (PKCE) against the enterprise identity provider.
  1. The client sends the resulting bearer token to the Gateway's streamable HTTP MCP endpoint.
  1. The Gateway validates the token's signature, issuer, expiration, allowed client, audience, and required scopes before accepting  tools/list  or  tools/call .
  1. AgentCore Policy evaluates the requested tool and context. During rollout, teams can observe decisions in  LOG_ONLY  mode before enabling enforcement.
  1. The Gateway invokes the SaaS MCP target directly, or invokes an optional compatibility adapter when protocol or identity handoff requires normalization.
  1. For user-delegated access, AgentCore Identity retrieves a provider token associated with the authenticated user. If none exists, the provider authorization flow begins.
  1. The client presents the authorization URL to the user. The user signs in to the SaaS provider and grants the requested scopes.
  1. AgentCore Identity validates the authorization session binding and stores the resulting provider token. The client then retries the original tool call.
  1. The SaaS MCP server returns only the data and operations available to that provider identity. The response flows back through the Gateway to the agent client.

Choose a direct target or a compatibility adapter

Start with the native Gateway-to-MCP-server path. Add a compatibility adapter only for a demonstrated gap. This keeps the managed service boundary as large as possible and limits custom code.
Use a direct MCP target when…
Add an adapter when…
The provider implements a compatible streamable HTTP MCP transport.
The provider or client has a transport-version or session-handling incompatibility.
Gateway-supported OAuth, IAM, API-key, or token-exchange configuration satisfies the target.
Authorization must be translated into a supported elicitation or completion pattern.
Dynamic discovery or a reviewed static schema exposes the intended tools.
You must expose a deliberately reduced, renamed, or normalized tool contract.
Provider errors and authorization challenges reach the client in a usable form.
Provider errors need safe normalization so clients can distinguish authorization, retryable, and permanent failures.
Adapter boundary: An adapter should not become another identity provider, policy engine, or credential database. Prefer short-lived derived identity context, AgentCore-managed credentials, explicit resource policies, and deterministic transformation logic.

Implementation guidance

1. Define the trust model before creating resources

  • Identify every permitted front-side client and register it separately with the enterprise identity provider.
  • Define a Gateway audience and narrowly scoped permissions. Do not rely on the presence of a valid token alone.
  • Decide whether each downstream integration is user-delegated OAuth (3LO), workload-based OAuth (2LO), token exchange, IAM, or API-key based.
  • For user-delegated SaaS access, preserve the provider's user authorization and sharing model instead of replacing it with a shared service account.
  • Document which system owns user identity, tool entitlement, provider consent, data authorization, and revocation.

2. Configure the Gateway as the inbound MCP resource server

Configure custom JWT authorization with the identity provider's discovery URL and explicit allowlists for audiences, client identifiers, and scopes. A multi-client Gateway can support several approved SaaS agent clients without creating a Gateway for each client, provided policy and operational ownership are shared.
Authorizer type: CUSTOM_JWT
Discovery URL: https://idp.example.com/.well-known/openid-configuration
Allowed clients: [approved-agent-client-a, approved-agent-client-b]
Allowed audience: [enterprise-mcp-gateway]
Allowed scopes: [gateway.tools.invoke]
Keep the Gateway URL stable. Organize targets by security and operational domain—for example, collaboration tools—instead of creating a separate Gateway for every tool. Use separate Gateways when ownership, data classification, identity model, or availability requirements materially differ.
For configuration details, see  Set up inbound authorization for your gateway .

3. Configure outbound authorization in AgentCore Identity

  • Create an OAuth credential provider in the same AWS account and Region as the Gateway.
  • Store client secrets outside source control, and use a governed bootstrap and rotation process.
  • Request the smallest provider scope set that supports the approved tools.
  • Use a dedicated SaaS OAuth application for each lifecycle environment when redirect URIs, secrets, assignments, or data boundaries differ.
  • Use authorization code flow for user-delegated access. Use client credentials only when a true workload identity and shared data boundary are acceptable.

4. Add the MCP target and govern its catalog

AgentCore Gateway supports hosted MCP server targets with OAuth, IAM SigV4, API-key, or no-authorization configurations. Choose dynamic listing when capabilities must be discovered with a user's token and background machine-to-machine discovery is unavailable. Choose a static schema when the platform team must approve an exact tool contract and accepts that schema changes require a controlled deployment.
Tool descriptions are part of both the security surface and the user experience. Review names, input schemas, output schemas, mutability annotations, and descriptions before exposing a target to agent clients. Do not rely on a model to infer whether a tool is safe.

5. Introduce policy safely

Attach an AgentCore policy engine and start in  LOG_ONLY  mode. Exercise positive and negative paths, inspect traces, and compare expected decisions with observed decisions. Move to  ENFORCE  only after every approved tool has an explicit permit and every prohibited path has been tested.
Restrict the administrative permissions that can change the Gateway's enforcement mode or remove the policy engine. For rollout options, see  Policy enforcement modes .

6. Treat first-use authorization as a product flow

A tool can be correctly configured and still require the user to authorize the downstream SaaS provider on first use. MCP URL elicitation is the preferred interaction: the server returns an authorization URL, the client opens it, and the original request resumes or is retried after completion.
Test the exact client because support for elicitation, streaming sessions, and retry behavior can differ. See  Use elicitation with your AgentCore Gateway .
AgentCore's OAuth URL session binding verifies that the identity completing consent corresponds to the identity that initiated the authorization request. If a separate completion application is required, it should:
  • Accept only the AgentCore session reference.
  • Derive the user identifier from trusted authentication context.
  • Reject caller-supplied identity.
  • Avoid logging sensitive values.
  • Fail closed on mismatch or expiry.

Security controls that matter most

Control
Recommended treatment
Client admission
Allowlist individual OAuth client IDs. Use separate registrations for different agent platforms and environments.
User identity
Derive identity only from a validated JWT or trusted AgentCore identity context. Never accept a user identifier from tool arguments.
Audience and scopes
Validate both. Use resource-specific tokens or token exchange where supported; avoid replaying one broad token across unrelated services.
SaaS authorization
Use user-delegated OAuth when access must follow each user's provider permissions. Avoid shared accounts for user-specific data.
Secrets
Store client secrets in a managed secret store, keep them out of repositories and logs, and rotate them through an approved process.
Adapter invocation
Restrict the Runtime so only the intended Gateway can invoke it. Validate Gateway origin and use a short-lived, request-bound assertion when threat modeling calls for defense in depth.
Interceptors
Pass request headers only when required. Never log  Authorization  headers. Make interceptor logic stateless or idempotent because retries can occur.
Tool mutations
Expose read-only tools first. Require explicit policy, confirmation behavior, and rollback expectations before enabling writes.
Policy rollout
Observe in  LOG_ONLY , test decision traces, then promote to  ENFORCE  through a controlled release.
Network egress
Use fixed egress addresses when SaaS allowlisting requires them. Restrict outbound destinations, and retain DNS and flow-log evidence.
Audit
Correlate client, user subject, Gateway request, policy decision, target, tool, and outcome without recording tokens or provider data.

Common failure modes and what they teach

Symptom
Likely cause
Treatment
The agent connects, but tools are missing.
Schema synchronization, listing mode, or cached client metadata.
Verify target status and tool schema, then refresh the client connection metadata.
Inbound sign-in succeeds, but a tool asks for authorization.
Enterprise authentication is complete; downstream SaaS consent is not.
Complete the provider-specific 3LO flow and retry the tool. Treat this as expected first-use behavior.
An authorization URL is returned, but the client cannot act on it.
The client does not implement the elicitation mode used by the target.
Confirm protocol negotiation. Consider a minimal compatibility result or adapter without bypassing session binding.
Authorization completes but cannot be associated with the request.
User/session binding mismatch, expired session reference, or inconsistent user identifier.
Use one canonical derived identifier, reject caller-provided identity, and restart expired authorization sessions.
A direct provider connector is selected instead of the enterprise Gateway.
Ambiguous tool names or multiple enabled connections.
Use clear connection names, governed tool metadata, client permissions, and evaluation prompts that identify the enterprise connection.
A shared service account reveals too much data.
Provider authorization is workload based rather than user delegated.
Move to per-user 3LO or enforce an independently verified provider-side data filter. Do not assume enterprise login limits provider data.
Policy behaves differently after enforcement.
Insufficient  LOG_ONLY  coverage or missing Gateway policy permissions.
Test every action and identity class. Verify policy-engine permissions before promotion.
A generic server-side execution error is returned.
A lower-level OAuth, secret, transport, or Runtime exception was hidden.
Log safe error categories and correlation IDs. Inspect Gateway, Runtime, Identity, and provider telemetry without exposing secrets.

A repeatable deployment model

Use infrastructure as code and a promotion pipeline so the reference pattern remains consistent across development, test, and production. Keep environment-specific identifiers and endpoints in typed configuration, credentials in a managed secret store, and policy changes under review.
  • Platform deployment: Gateway, targets, Policy, OAuth providers, optional adapters, observability, and stack-bound roles and policies.
  • Identity administration: OAuth applications, assignments, scopes, claims, consent settings, and secret rotation.
  • SaaS administration: Provider OAuth application, redirect URI, approved scopes, user assignments, and data sharing.
  • Client administration: Enterprise MCP connection URL, OAuth client configuration, visible tools, and user enablement.
  • Release evidence: Infrastructure diff, policy tests, target health, tool catalog snapshot, positive and negative results, and rollback procedure.
Avoid copying an entire configuration for each environment. Reuse the architecture and code while keeping security-sensitive registrations, secrets, data access, and environment endpoints isolated wherever external systems require that separation.

Validation plan

Begin with one read-only tool and one pilot user, then expand deliberately.
Test
Expected result
Approved client, assigned user, correct scope
The Gateway accepts the connection and exposes only approved tools.
Wrong client ID
The Gateway rejects the request before target invocation.
Wrong audience or missing scope
The Gateway returns an authentication or insufficient-scope challenge.
Unentitled enterprise user
Policy records or enforces a denial according to rollout mode.
User without SaaS object access
The provider returns no unauthorized objects even though Gateway access is permitted.
First SaaS invocation
The client presents a usable authorization action; session binding completes for the initiating user.
Repeat invocation
AgentCore Identity reuses or refreshes the managed provider credential without another consent prompt while it remains valid.
Read-only prompt
Only the approved read tool is selected; no mutation tool is visible or invoked.
Existing-client regression
Previously approved agent clients continue working after a new client is added.
Revocation
Removing a client assignment, scope, policy permit, or provider authorization blocks subsequent access as designed.

What this architecture validates

  • Multiple SaaS-hosted agent clients can share one governed MCP tool boundary without sharing OAuth client registrations.
  • Enterprise authentication and downstream SaaS authorization can remain separate while still producing an auditable user-to-tool chain.
  • AgentCore Gateway and AgentCore Identity can centralize common security controls without replacing the provider's data permissions.
  • A small compatibility adapter can address protocol gaps while credentials, policy, and identity remain within managed boundaries.
  • The same Gateway endpoint can later support agents hosted in AgentCore Runtime, provided those runtimes explicitly obtain or propagate an approved Gateway credential. Runtime authorization does not automatically authorize outbound Gateway calls.

Conclusion

The scalable unit of reuse is not a direct agent-to-provider connection. It is a governed enterprise MCP boundary with explicit client admission, deterministic tool policy, managed outbound authorization, and provider-native user permissions. This approach allows organizations to adopt new agent clients and SaaS MCP servers without rebuilding the security architecture for every pairing.
Start with the native AgentCore Gateway path, one read-only tool, and observable policy decisions. Add compatibility code only when testing proves it necessary. Preserve separate identity domains, make first-use authorization a deliberate user experience, and promote changes through the same controlled process used for other platform infrastructure.

Further reading



Publication note: This article describes a general reference pattern based on public AWS capabilities and open standards. Validate current service availability, quotas, and provider requirements before production use. Any opinions expressed in this article are the author's and do not necessarily reflect the views of AWS.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article