Amazon Bedrock AgentCore Gateway: Turn APIs into MCP Tools

You need four things before you start: an AWS account with the CLI signed in, Node.js 20 or newer, Python 3.10 or newer, and one API or Lambda function you’d like an AI agent to use.

With those, AgentCore Gateway turns that function into a tool any MCP-speaking agent can call, in about 15 minutes.

Amazon Bedrock AgentCore Gateway is a managed entry point that sits between your agents and everything they call: tools, other agents and models. It’s one of the services in Amazon Bedrock AgentCore, and you can use it on its own.

If the CLI isn’t set up yet, install the AWS CLI and sign in first.

Last checked against the AWS docs on December 1, 2026.

Before you start, check:

  • AWS CLI signed in to a non-production account
  • Node.js 20+ (for the AgentCore CLI) and Python 3.10+ (for the test agent)
  • IAM rights to create roles, Lambda functions and AgentCore resources
  • A Lambda function, OpenAPI spec or MCP server to expose as a tool

This post contains affiliate links. As an Amazon Associate, Stepstocloud.com earns from qualifying purchases.

Gateway solves the wiring; deciding which tools an agent should have is a design question. The tool-use chapter in AI Engineering is a good primer before you expose anything that writes data.

AgentCore Gateway: one secure gateway routing agent traffic to tools, other agents and AI models
One gateway endpoint can front tools, other agents and model providers, each with its own credentials.

Understand the three target types

A gateway is a single URL. Behind it you attach targets, and AWS groups them into three kinds:

Target typeWhat you attachHow agents see it
MCP targetLambda functions, API Gateway REST APIs, OpenAPI specs, Smithy models, MCP servers, built-in connectorsAll merged into one virtual MCP server with a single tool list
HTTP targetAgentCore Runtime agents, A2A agents, external MCP servers, any HTTP endpointPassed through as-is, addressed by path
Inference targetModel providers such as Amazon Bedrock, OpenAI and AnthropicOne endpoint; the request’s model field picks the provider

Most people start with an MCP target, which is what this walkthrough builds. The agent connects once and sees every tool from every MCP target in one tools/list response.

See also  2024 Best 51 AWS IAM Interview Questions and Answers
A translator machine turning an API and Lambda function block into a plug-in MCP tool module for an AI agent
Gateway translates MCP tool calls into Lambda invocations or REST requests, so your existing code doesn’t change.

Step 1: Install the AgentCore CLI and create a project

npm install -g @aws/agentcore

agentcore create --name MyGatewayProject --template empty
cd MyGatewayProject

The project only holds the gateway and its targets; your test agent runs on your own machine.

Step 2: Describe your tools

Gateway needs a schema so the model knows what each tool does and what to send. For a Lambda target, save a tools.json file like this.

The descriptions matter: they’re what the model reads when deciding which tool to call.

[
  {
    "name": "get_order_status",
    "description": "Look up the shipping status of a customer order by order ID",
    "inputSchema": {
      "type": "object",
      "properties": {
        "order_id": { "type": "string", "description": "The order ID, e.g. A-10442" }
      },
      "required": ["order_id"]
    }
  }
]

Inside your Lambda function, Gateway passes the tool name in the client context. AWS’s quick start reads it like this and splits off the target prefix:

def lambda_handler(event, context):
    tool_name = context.client_context.custom["bedrockAgentCoreToolName"]
    tool = tool_name.split("___", 1)[1]
    if tool == "get_order_status":
        return {"order_id": event["order_id"], "status": "shipped"}
    return {"error": f"Unknown tool: {tool}"}

Step 3: Add the gateway and the target

# Test only: no inbound authorization
agentcore add gateway --name OrdersGateway --authorizer-type NONE

agentcore add gateway-target \
  --gateway OrdersGateway \
  --target-configuration '{
    "name": "OrdersLambda",
    "targetType": "lambdaFunctionArn",
    "lambdaFunctionArn": {
      "lambdaArn": "arn:aws:lambda:us-east-1:111122223333:function:orders-tool",
      "toolSchemaFile": "tools.json"
    }
  }'

--authorizer-type NONE is fine for a first test in a sandbox account and nowhere else. Swap it for a JWT authorizer before anyone else can reach the URL (see the next section).

Step 4: Deploy and find your gateway URL

agentcore deploy
agentcore status --json

Per the AgentCore Gateway quick start, the deploy builds an AWS CDK stack and takes about 2 to 3 minutes. The gateway ID is the last part of the ARN that status prints, and your MCP URL follows this pattern:

https://<gateway-id>.gateway.bedrock-agentcore.us-east-1.amazonaws.com/mcp
AgentCore Gateway quick start in the AWS docs with the add gateway and add gateway-target commands highlighted
(1) The test gateway is created with no inbound auth; (2) the Lambda target points at your function and its tools.json schema.

Step 5: Point an agent at the gateway

Any MCP client works. With Strands Agents (pip install strands-agents mcp), the agent lists the gateway’s tools and hands them to the model:

from strands import Agent
from strands.tools.mcp.mcp_client import MCPClient
from mcp.client.streamable_http import streamablehttp_client

GATEWAY_URL = "https://<gateway-id>.gateway.bedrock-agentcore.us-east-1.amazonaws.com/mcp"

mcp = MCPClient(lambda: streamablehttp_client(GATEWAY_URL))
with mcp:
    tools = mcp.list_tools_sync()
    agent = Agent(tools=tools)
    agent("Where is order A-10442?")

Ask a question your tool can answer and you should see the agent call get_order_status. For a JWT-protected gateway, send the token in an Authorization: Bearer header, as AWS’s full sample does.

See also  Complete Guide On: AWS Regions and Availability Zones

Lock it down before real use

Gateway handles security in two directions, as the Gateway core concepts page explains, and you need both. Inbound decides who may call the gateway; outbound decides how the gateway signs in to each tool.

DirectionOptionsUse
InboundOAuth (JWT), IAM SigV4, authenticate-only, noneJWT from Cognito, Okta or Entra ID for apps; IAM for AWS-to-AWS calls; none only in a sandbox
Outbound: Lambda and Smithy targetsThe gateway’s execution roleGive that role only lambda:InvokeFunction on the functions it needs
Outbound: OpenAPI and MCP server targetsCredential provider with an API key or OAuth, or IAM SigV4Keys stay in AgentCore Identity; the model never sees them

For a JWT authorizer, AWS’s example passes your identity provider’s discovery URL and allowed audience, for instance a Cognito user pool’s /.well-known/openid-configuration address. Pair that with AgentCore Policy rules on any tool that writes or deletes data.

AgentCore Gateway core concepts docs with the credential provider and MCP target sections highlighted
(1) Lambda and Smithy targets use the gateway’s execution role, while OpenAPI and MCP targets can use a stored credential provider; (2) MCP targets merge into one virtual MCP server.

Use semantic tool search when the list grows

A model choosing between 8 tools is fine. Choosing between 300 bloats every prompt and confuses it.

Gateway’s semantic tool selection, described in the Gateway overview, lets the agent search for the right few tools by task, which keeps prompts short and responses faster.

Keep tool names and descriptions specific (“Look up shipping status by order ID”, not “orders”); search and the model both depend on them.

A robot agent using a flashlight to find the three right tools in a huge wall of tool drawers
Semantic tool search lets an agent pull only the few tools a task needs instead of loading hundreds into every prompt.

Fix the common setup errors

SymptomLikely causeFix
Agent sees no toolsWrong URL or missing /mcp pathRebuild the URL from agentcore status --json
401 or 403 from the gatewayJWT audience or discovery URL mismatchMatch allowedAudience to your app client ID
Tool call fails with access deniedGateway role can’t invoke the LambdaGrant lambda:InvokeFunction on that function ARN
Lambda gets the wrong tool nameTarget prefix not strippedSplit on ___ as in the handler above
Model calls the wrong toolVague tool descriptionsRewrite descriptions as clear, single-purpose sentences

Know what it costs

Gateway is pay per use: you’re charged for operations such as listing and invoking tools, for search queries, and for targets indexed for semantic search.

Per the AgentCore pricing page, there’s no minimum fee, and data sent to your own VPC costs $0.006 per GB in commercial Regions.

See also  What Is AWS Athena: 9 Features, Pricing [Athena Tutorial]

Your Lambda functions and model calls are billed separately, at their usual rates. Clean up test gateways when you’re done; check how AWS pricing works if any of these meters are new to you.

Books for building agent tools

Stack of AI engineering books

AI Engineering (Chip Huyen, O’Reilly)

How agents choose and call tools, and how to test them.

Check price on Amazon
Stack of large language model books

Hands-On Large Language Models (O’Reilly)

The model side of tool calling, explained with visuals.

Check price on Amazon

Frequently asked questions

What is AgentCore Gateway?

AgentCore Gateway is a managed AI gateway in Amazon Bedrock AgentCore. It gives agents one secure endpoint for tools, other agents and model providers. It converts APIs and Lambda functions into MCP tools, passes traffic to other agents and routes model requests across providers.

Does AgentCore Gateway support MCP?

Yes. MCP targets are merged into one virtual MCP server, so an MCP client sees all tools in a single tools list. Gateway can turn Lambda functions, OpenAPI specs, Smithy models and API Gateway REST APIs into MCP tools, and it can also front existing MCP servers.

How do I secure an AgentCore gateway?

Set an inbound authorizer, such as OAuth JWT from Cognito, Okta or Entra ID, or IAM SigV4. For outbound calls, give the gateway role only the Lambda permissions it needs and store API keys or OAuth secrets in a credential provider. Use no authorization only for tests.

What can a gateway target be?

Targets come in three kinds. MCP targets include Lambda functions, OpenAPI specs, Smithy models, API Gateway REST APIs and MCP servers. HTTP targets pass traffic to agents or HTTP services. Inference targets route model requests to providers such as Amazon Bedrock, OpenAI and Anthropic.

How much does AgentCore Gateway cost?

Gateway is pay per use with no minimum fee. You are charged for operations such as listing and invoking tools, for search queries and for targets indexed for semantic search. Lambda functions and model calls behind the gateway are billed separately at their normal rates.

Do I need AgentCore Runtime to use Gateway?

No. Gateway works on its own. Any agent that speaks MCP can connect to it, whether it runs on your laptop, in a container, on Lambda or on AgentCore Runtime. The AWS quick start even runs the test agent on a local machine.

Conclusion

AgentCore Gateway gives your agents one secure door to every tool, agent and model they need, without writing MCP servers or storing keys in prompts.

  • Three target types: MCP (merged tools), HTTP (pass-through agents) and inference (model routing).
  • The AgentCore CLI creates, deploys and lists a gateway in a few commands.
  • Use no inbound auth only in a sandbox; switch to JWT or IAM for real traffic.
  • Clear tool descriptions decide whether the model picks the right tool.
  • Billing is per operation, search and indexed target, with no minimum.
AgentCore Gateway pin: turn APIs and Lambda functions into MCP tools

Recommended reading

Leave a Comment