Apply fine-grained entry management with Bedrock AgentCore Gateway interceptors
As enterprises quickly undertake AI brokers to automate workflows and improve productiveness, they face a vital scaling problem: managing safe entry to 1000’s of instruments throughout their group. Trendy AI deployments now not contain a handful of brokers calling a number of APIs—as an alternative, enterprises are constructing unified AI platforms the place lots of of brokers, shopper AI functions, and automatic workflows must entry 1000’s of Mannequin Context Protocol (MCP) instruments spanning totally different groups, organizations, and enterprise items.
This enhance in scale creates a elementary safety and governance drawback: How do you be sure that every calling principal—whether or not it’s an AI agent, person, or utility—solely accesses the instruments they’re approved to make use of? How do you dynamically filter software availability primarily based on person id, agent context, the channel by means of which entry is requested, and continually evolving permissions? How do you defend delicate information because it flows by means of multi-hop workflows from brokers to instruments to downstream APIs? And the way do you accomplish all of this with out sacrificing efficiency, creating operational bottlenecks, or forcing groups to deploy separate MCP server situations for each tenant or use case?
To handle these challenges, we’re launching a brand new function: gateway interceptors for Amazon Bedrock AgentCore Gateway. This highly effective new functionality offers fine-grained safety, dynamic entry management, and versatile schema administration.
High-quality-grained entry management for software entry
Enterprise prospects are deploying 1000’s of MCP instruments served by means of a unified AgentCore Gateway. These prospects use this single MCP gateway to entry instruments from totally different groups, organizations, shopper AI functions, and AI brokers, every with their corresponding entry permissions assigned to the calling principal. The problem is securing MCP software entry primarily based on the calling principal’s entry permissions and contextually responding to ListTools, InvokeTool, and Search calls to AgentCore Gateway.
Instrument filtering have to be primarily based on a number of dynamic components, together with agent id, person id, and execution context, the place permissions would possibly change dynamically primarily based on person context, the channel by means of which the person is accessing the brokers, workspace entry ranges, and different contextual attributes. This requires security-conscious filtering the place permission adjustments instantly have an effect on software availability with out caching stale permission states.
The next diagram offers an instance of person primarily based software filtering and units the context for the way the gateway evaluates id and context earlier than returning the allowed instruments.

Schema translation and information safety between MCP and downstream APIs
Clients face complicated challenges in managing the contract between AI brokers and downstream APIs whereas sustaining safety and suppleness. Organizations should dynamically map MCP request schemas to corresponding downstream API schemas, enabling vital information safety capabilities resembling redacting or eradicating delicate information like personally identifiable info (PII) or delicate private info (SPI) that customers would possibly ship as a part of prompts to brokers. This prevents delicate information leakage to downstream APIs when such info isn’t wanted for the API name.
Moreover, prospects require schema translation capabilities to deal with API contract adjustments whereas retaining the MCP schema intact and decoupled from downstream implementations. This decoupling permits smoother API evolution and versioning with out breaking the AI agent and power contracts, so backend groups can modify their API implementations, change discipline names, restructure payloads, or replace authentication necessities with out forcing adjustments to the agent layer or requiring retraining of AI fashions which have realized particular software schemas.
Tenant isolation for multi-tenant SaaS
Organizations providing brokers as a service or instruments as a service face complicated multi-tenancy necessities. Clients should deploy their MCP servers for all their customers whereas sustaining correct tenant isolation, requiring each tenant ID and person ID to be handed and validated. Multi-tenant MCP server architectures require totally different prospects and workspaces to stay fully remoted, with software entry strictly managed primarily based on tenant boundaries. The problem extends to figuring out whether or not separate gateways are wanted per tenant or if a single gateway can safely deal with multi-tenant situations with correct isolation ensures.
Dynamic software filtering
Clients want real-time, context-aware software filtering that adapts to altering permissions and person contexts. Organizations require unified MCP servers that may filter instruments in two levels: first by agent permissions and workspace context, then by semantic search—with vital necessities that no caching happens for dynamically filtered software lists as a result of permissions would possibly change at any time.
Customized header propagation and id context administration
AI brokers are essentially totally different from conventional microservices in that they’re autonomous and non-deterministic of their habits. In contrast to conventional microservice-to-microservice authorization approaches that usually depend on service-to-service belief and authorization strategies, AI brokers must execute workflows on behalf of end-users and entry downstream instruments, APIs, and sources primarily based on person execution context. Nonetheless, sending the unique authorization tokens to downstream providers creates vital safety vulnerabilities, resembling stolen credentials, privilege escalation, and the confused deputy drawback, the place a extra privileged service is tricked into performing actions on behalf of a much less privileged attacker.
Impersonation vs. act-on-behalf approaches
Clients face a elementary safety determination in how id context propagates by means of multi-hop workflows (agent to agent to software to API): utilizing an impersonation strategy or an act-on-behalf strategy.
With an impersonation strategy, the unique person’s JWT token is handed unchanged by means of every hop within the name chain. Though easier to implement, this strategy creates vital safety dangers. We don’t advocate this strategy because of the following dangers:
- Downstream providers obtain tokens with broader privileges than obligatory
- Elevated danger of privilege escalation if any part is compromised
- Token scope can’t be restricted to particular downstream targets
- Susceptible to confused deputy assaults, the place compromised providers can abuse overly privileged tokens
In an act-on-behalf strategy, every hop within the workflow receives a separate, scoped token particularly issued for that downstream goal, and JWT is used for propagating the execution context all through. This strategy is the really useful strategy as a result of it offers the next advantages:
- Precept of least privilege – Every service receives solely the permissions it must entry particular downstream APIs
- Decreased blast radius – Compromised tokens have restricted scope and may’t be reused elsewhere
- Higher auditability – A transparent chain of custody reveals which service acted on behalf of the person utilizing AgentCore Observability
- Token scope limitation – Every downstream goal receives tokens or credentials scoped particularly for its APIs
- Safety boundaries – Correct isolation is enforced between totally different providers within the name chain
- Confused Deputy prevention – Restricted-scope tokens and credentials stop providers from being tricked into performing unauthorized actions
The act-on-behalf mannequin requires the gateway to extract execution context from incoming requests, generate new scoped authorization tokens for every downstream goal, and inject applicable headers whereas sustaining the person’s id context for auditing and authorization selections—all with out exposing overly privileged credentials to downstream providers. This safe strategy makes certain AI brokers can execute workflows on behalf of customers whereas sustaining strict safety boundaries at each hop within the name chain.
The next diagram compares the workflows of impersonation vs. act-on-behalf approaches.

Within the impersonation strategy (high), when Consumer A connects to the agent, the agent passes Consumer A’s full id token with full scopes ("order: learn, promotions:write") unchanged to each the Order software and Promotions software, that means every software receives extra permissions than it wants. In distinction, the act-on-behalf strategy (backside) reveals the agent creating separate, scoped tokens for every software—the Order software receives solely the "order: learn" scope, the Promotions software receives solely the "promotions:write" scope, and every token contains an "Act: Agent" discipline, which establishes a transparent chain of duty displaying the agent is appearing on behalf of Consumer A. This demonstrates how delegation implements the precept of least privilege by limiting every downstream service to solely the particular permissions it wants, decreasing safety dangers and stopping potential token misuse.
AgentCore Gateway: Safe MCP integration for AI brokers
AgentCore Gateway transforms your present APIs and AWS Lambda features into agent-compatible instruments, connects to present MCP servers, and offers seamless integration with important third-party enterprise instruments and providers (resembling Jira, Asana, and Zendesk). This unified entry level permits safe integration throughout your enterprise techniques. With AgentCore Identification, brokers can securely entry and function throughout these instruments with correct authentication and authorization utilizing OAuth requirements.
With the launch of gateway interceptors, AgentCore Gateway helps organizations implement fine-grained entry management and credential administration by means of customized Lambda features at two vital factors:
- Gateway request interceptor – The request interceptor Lambda perform processes incoming requests earlier than they attain their goal instruments, enabling fine-grained entry controlling primarily based on person credentials, session context, and organizational insurance policies, audit path creation, schema translation, and extra.
- Gateway response interceptor – The response interceptor Lambda perform processes outgoing responses earlier than they return to the calling agent, permitting for audit path creation, instruments filtering, schema translation, and fine-grained entry controlling the search and record instruments.
The next diagram illustrates the request-response circulate by means of gateway interceptors.

Let’s look at the particular payload buildings that customized interceptors obtain and should return at every stage of the request-response cycle. The gateway request interceptor receives an occasion with the next construction:
Your gateway request interceptor Lambda perform should return a response with the transformedGatewayRequest discipline:
After the goal service responds, the gateway response interceptor is invoked with an occasion containing the unique request and the response:
Your gateway response interceptor Lambda perform should return a response with the transformedGatewayResponse discipline:
Understanding this request-response construction is important for implementing the customized interceptor logic we discover later on this publish. Gateway interceptors present vital capabilities for securing and managing agentic AI workflows:
- Header administration – Move authentication tokens, correlation IDs, and metadata by means of customized headers
- Request transformation – Modify request payloads, add context, or enrich information earlier than it reaches goal providers
- Safety enhancement – Implement customized authentication, authorization, and information sanitization logic
- High-quality-grained entry management – Safe MCP software entry primarily based on the calling principal’s entry permissions and contextually responding to ListTools, InvokeTool, and Search calls to AgentCore Gateway
- Tenant isolation for multi-tenant MCP instruments – Implement tenant isolation and entry controls primarily based on calling person, agent, and tenant identities in a multi-tenant atmosphere
- Observability – Add logging, metrics, and tracing info to watch agentic workflows
Gateway interceptors work with AgentCore Gateway goal varieties: together with Lambda features, OpenAPI endpoints, and MCP servers.
Use instances with gateway interceptors
Gateway interceptors allow versatile safety and entry management patterns for agentic AI techniques. This publish showcases three approaches: implementing fine-grained entry management for invoking instruments, dynamic instruments filtering primarily based on person permissions, and id propagation throughout distributed techniques.
Implementing fine-grained entry management for invoking instruments
AgentCore Gateway exposes a number of backend instruments by means of a unified MCP endpoint. Customers with totally different roles require totally different software permissions. You possibly can implement fine-grained entry management utilizing JWT scopes mixed with gateway interceptors to ensure customers can solely invoke approved instruments and uncover instruments that belong to their position or workspace. High-quality-grained entry management makes use of JWT scope values issued by Amazon Cognito (or one other OAuth 2 supplier). You may as well implement this utilizing a YAML file or a database with mapped permissions. We comply with a easy naming conference: customers obtain both full entry to an MCP goal (for instance, mcp-target-123) or tool-level entry (for instance, mcp-target-123:getOrder). These scopes map on to software permissions within the scope declare as a part of the incoming OAuth token, making the authorization mannequin predictable and simple to audit.
The next diagram illustrates this workflow.

The request interceptor enforces permissions at execution time by means of the next steps:
- Extract and decode the JWT to retrieve the scope declare.
- Determine which software is being invoked (utilizing
instruments/name). - Block the request if the person lacks both full goal entry or tool-specific permission primarily based on the configuration file or entry coverage information retailer.
- Return a structured MCP error for unauthorized invocations, stopping the backend software handler from executing.
The core authorization perform is deliberately minimal:
This sample permits predictable enforcement for each invocation and discovery paths (mentioned additional within the subsequent part). You possibly can prolong the mannequin with extra claims (for instance, tenantId and workspaceId) for multi-tenant architectures.
For operational safety, preserve interceptors deterministic, keep away from complicated branching logic, and rely completely on token claims quite than giant language mannequin (LLM) directions. By implementing authorization on the gateway boundary—earlier than the LLM sees or executes any software—you obtain robust isolation throughout roles, tenants, and domains with out modifying software implementations or MCP targets.
Dynamic instruments filtering
Brokers uncover out there instruments by means of two major strategies: semantic search capabilities that enable pure language queries (like “discover instruments associated to order administration”) and commonplace (instruments/record) operations that present an entire stock of obtainable instruments. This discovery mechanism is prime to agent performance, however it additionally presents vital safety concerns. With out correct filtering controls, MCP servers would return a complete record of all out there instruments, whatever the requesting agent’s or person’s authorization stage. This unrestricted software discovery creates potential safety vulnerabilities by exposing delicate capabilities to unauthorized customers or brokers.
When a goal returns a listing of instruments in response to semantic search or MCP instruments/record requests, the gateway response interceptor can be utilized to implement fine-grained entry management. The interceptor processes the response earlier than it reaches the requesting agent, so customers can solely uncover instruments they’re approved to entry. The workflow consists of the next steps:
- The goal validates the incoming JWT token and returns both the whole software record or a filtered set primarily based on semantic search, no matter fine-grained entry management.
- The configured response interceptor is invoked by AgentCore Gateway. The response interceptor extracts and decodes the JWT from the payload, retrieving the scope claims that outline the person’s permissions.
- For every software within the record, the interceptor evaluates the person’s authorization primarily based on the JWT scopes.
- Instruments that the person isn’t approved to entry are faraway from the record.
- The response interceptor returns a reworked response containing solely the approved instruments.
The next diagrams illustrate this workflow for each instruments.


The next is a code snippet of the response interceptor Lambda handler that performs JWT token extraction, software record retrieval, and permission-based filtering earlier than returning the reworked response with approved instruments:
The filter_tools_by_scope perform implements an authorization test for every software in opposition to the person’s allowed scopes:
The entire implementation could be discovered within the GitHub repo.
Customized headers propagation
As AI brokers work together with a number of downstream providers, sustaining person id throughout service boundaries turns into vital for safety, compliance, and audit trails. When brokers invoke instruments by means of AgentCore Gateway, the unique person’s id should circulate from the agent to the gateway, and from the gateway to focus on providers. With out correct id propagation, downstream providers can’t implement user-specific authorization insurance policies, keep correct audit logs, or implement tenant isolation. This problem intensifies in multi-tenant environments the place totally different customers share the identical agent infrastructure however require strict information separation.
Gateway request interceptors extract id info from incoming request headers and context, rework it into the format anticipated by downstream providers, and enrich requests earlier than they attain goal providers by following these steps:
- The gateway request interceptor extracts authorization headers from incoming requests and transforms them for downstream providers.
- AgentCore Gateway orchestrates the request circulate and manages interceptor execution.
- The goal invocation receives enriched requests with correctly formatted id info.
The gateway request interceptor helps organizations achieve end-to-end visibility into person actions, implement constant authorization insurance policies throughout service boundaries, and keep compliance with information sovereignty necessities.
The workflow consists of the next steps:
- The MCP shopper calls AgentCore Gateway.
- AgentCore Gateway authenticates the inbound request.
- AgentCore Gateway invokes the customized interceptor.
- The gateway request interceptor transforms the incoming request payload by including an authorization token as a parameter to ship to the downstream Lambda goal. (We don’t advocate sending the incoming JWT as-is to downstream APIs as a result of it’s insecure because of the danger of privilege escalation and stolen credentials. Nonetheless, there could be exceptions the place the agent must name the MCP server with an entry token for downstream APIs.) Alternatively, you’ll be able to take away the inbound JWT coming from the request and add a brand new JWT with a least-privileged scoped-down token for calling related downstream APIs.
- AgentCore Gateway calls the goal with the reworked request. The goal has the authorization token handed by the interceptor Lambda perform.
- AgentCore Gateway returns the response from the goal.
The next diagram illustrates this workflow.

The next is a code snippet of the interceptor Lambda handler that performs customized header propagation:
No auth and OAuth primarily based authorization
Many enterprises want versatile authorization fashions that stability discoverability with safety. Contemplate a situation the place you need to enable AI brokers and functions to find and search out there MCP instruments with out requiring authorization, enabling seamless software exploration and semantic search throughout your software catalog. Nonetheless, in the case of really invoking these instruments, you want strict OAuth-based authorization to ensure solely approved brokers and customers can execute software calls. You would possibly even want per-tool authorization insurance policies, the place some instruments require authentication whereas others stay publicly accessible, or the place totally different instruments require totally different permission ranges primarily based on the calling principal’s id and context.
AgentCore Gateway now helps this flexibility by means of the introduction of a “No Auth” authorization kind on the gateway stage for all inbound calls. When configured, this makes all targets and instruments accessible with out authentication for discovery functions. To implement OAuth authorization on the technique stage (ListTools vs. CallTools) or implement per-tool authorization insurance policies, you should use gateway interceptors to look at the inbound JWT, validate it in opposition to the necessities in line with RFC 6749 utilizing your authorization server’s discovery URL, and programmatically enable or deny entry to particular strategies or software calls. This strategy offers you fine-grained management: open discovery for ListTools and SearchTools requests whereas implementing strict OAuth validation for CallTools requests, and even implementing customized authorization logic that varies by software, person position, execution context, or different enterprise logic your group requires—all whereas retaining your MCP calls safe and compliant along with your safety insurance policies.
The next diagram illustrates this workflow.

The method begins with a ListTools name with No Auth to the AgentCore Gateway, which is configured with basic no-auth for all inbound calls. With this configuration, customers can uncover out there instruments with out authorization. Nonetheless, when the person subsequently makes a CallTool request to invoke a particular software, authorization is required. AgentCore Gateway invokes the customized request interceptor Lambda perform, which validates the JWT token from the authorization header and checks the person’s scopes and permissions in opposition to the particular software being invoked. If approved, the interceptor transforms and enriches the request with the mandatory authorization context, and AgentCore Gateway forwards the reworked request to the goal service. The goal processes the request and returns a response, which AgentCore Gateway then returns to the shopper, implementing strict OAuth-based authorization for precise software execution whereas sustaining open discovery for software itemizing.
To create a gateway configured with No Auth for inbound calls, use authorizerType as NONE, as proven within the following CreateGateway API:
Observability
Complete observability supplied by AgentCore Observability is vital for monitoring, debugging, and auditing AI agent workflows that work together with a number of instruments and providers by means of AgentCore Gateway. Gateway interceptors implement authorization, rework requests, and filter information earlier than downstream providers execute, making the observability layer a vital safety boundary. This gives the next key advantages:
- Safety determination visibility – Interceptors generate authoritative logs for authorization outcomes, together with enable/deny selections and the evaluated JWT scopes. This offers a transparent audit path for reviewing rejected requests, validating coverage habits, and analyzing how authorization guidelines are enforced throughout software invocations.
- Request and response traceability – Interceptors seize how MCP requests and responses are modified, resembling header enrichment, schema translation, and delicate information redaction. This delivers full traceability of payload adjustments and helps safe, compliant information dealing with throughout agent workflows.
- Downstream software observability – Interceptors log downstream software habits, together with standing codes, latency, and error responses. This creates constant visibility throughout targets, serving to groups troubleshoot failures, determine reliability points, and perceive end-to-end execution traits.
These logs additionally seize id and context attributes, serving to groups validate authorization habits and isolate points in environments the place a number of person teams or tenants share the identical gateway. Gateway interceptors routinely combine with AgentCore Observability, offering the next options:
- Actual-time monitoring of authorization selections
- Efficiency bottleneck identification by means of length and invocation metrics
- Finish-to-end traceability throughout multi-hop agentic workflows
- Identification and context attributes for validating authorization habits in multi-tenant environments
The next screenshot reveals pattern metrics from Amazon CloudWatch log teams for a gateway interceptor.

The metrics display wholesome gateway interceptor efficiency with a 100% success charge, minimal latency (4.47 milliseconds common), and no throttling points, indicating the system is working inside optimum parameters.
The next screenshot reveals pattern logs from CloudWatch for a gateway interceptor.

AgentCore Observability integration helps you monitor authorization selections in actual time, determine efficiency bottlenecks, and keep end-to-end traceability throughout multi-hop agentic workflows.
Conclusion
AgentCore Gateway with gateway interceptors addresses the elemental safety and entry management challenges organizations face when deploying agentic AI techniques at scale. The three patterns demonstrated—fine-grained entry management for software invocation, dynamic software filtering, and id propagation—present foundational constructing blocks for safe agentic architectures that bridge authentication gaps, keep credential isolation, and implement customized safety insurance policies. By offering programmable interception factors for each requests and responses, organizations can implement fine-grained entry management with out modifying underlying software implementations or MCP server architectures. As organizations scale to lots of of brokers and 1000’s of instruments, gateway interceptors present the flexibleness and management wanted to keep up safety, compliance, and operational visibility throughout complicated agentic AI deployments whereas aligning with enterprise integration patterns and safety greatest practices. AgentCore Gateway with gateway interceptors offers a versatile basis for implementing enterprise-grade safety controls throughout agentic AI architectures. To study extra about find out how to apply gateway interceptors to resolve frequent enterprise challenges, seek advice from the next code samples:
For full documentation on gateway interceptor configuration and deployment, seek advice from Fine-grained access control for Amazon Bedrock AgentCore Gateway.
Concerning the Authors
Dhawal Patel is a Principal Generative AI Tech lead at AWS. He has labored with organizations starting from giant enterprises to mid-sized startups on issues associated to agentic AI, deep studying, and distributed computing.
Ganesh Thiyagarajan is a Senior Options Architect at AWS with over 20 years of expertise in software program structure, IT consulting, and answer supply. He helps ISVs rework and modernize their functions on AWS. He’s additionally a part of the AI/ML Technical discipline group, serving to prospects construct and scale generative AI options.
Avinash Kolluri is a Sr Options Architect at AWS. He works with Amazon and its subsidiaries to design and implement cloud options that speed up innovation and operational excellence. With deep experience in AI/ML infrastructure and distributed techniques, he focuses on serving to prospects use AWS providers for constructing foundational fashions, workflow automation, and generative AI options.
Bhuvan Annamreddi is a Options Architect at AWS. He works with ISV prospects to design and implement superior cloud architectures and helps them improve their merchandise by utilizing AWS providers. He’s captivated with serving to prospects construct scalable, safe, and progressive techniques, with a robust curiosity in generative AI and serverless structure as enablers for delivering significant enterprise worth.
Mohammad Tahsin is a Generative AI Specialist Options Architect at AWS, the place he works with prospects to design, optimize, and deploy trendy AI/ML options. He’s captivated with steady studying and staying on the frontier of latest capabilities within the discipline. In his free time, he enjoys gaming, digital artwork, and cooking.
Ozan Deniz works as a Software program Growth Engineer in AWS. He and his crew concentrate on enhancing the vendor capabilities by generative AI. When not at work, he enjoys exploring the outside.
Kevin Tsao is a Software program Growth Engineer inside the AgentCore Gateway crew. He has been at Amazon for six years and has been working within the conversational AI and agentic AI area for the reason that starting of his tenure, contributing to providers resembling Bedrock Brokers and Amazon Lex.