Adding AWS DevOps Agent as a Direct MCP Passthrough to an AgentCore AI Agent
This document shows how to give an **Amazon Bedrock AgentCore AI agent** direct access to **AWS DevOps Agent** tools by connecting the AgentCore Gateway **directly** to the DevOps Agent hosted MCP endpoint — with **no Lambda intermediary**. The agent speaks MCP to a Gateway, and the Gateway forwards `tools/call` invocations straight to the DevOps Agent MCP endpoint, signed with `aidevops` SigV4 credentials.
This is a companion to the Lambda-backed pattern published in
Adding AWS DevOps Agent as an MCP Tool to an AgentCore AI Agent .
Removing the Lambda shortens the trust chain to 2 IAM hops and drops all custom code, in exchange for the full native tool surface (30+ tools) instead of a curated set, and no response shaping, call collapsing, or error normalization. Use this pattern for minimal infrastructure; use the Lambda pattern when you need those conveniences.
Security note: account IDs, role names, and gateway/target names shown here are placeholders — replace<AWS_ACCOUNT_ID>,<AWS_REGION>, and resource names with your own values at deploy time. Apply your organization's normal security review to all IAM roles and policies before rolling this out.
2. Architecture
┌───────────────────────────────────────────────────────────────────┐│ AgentCore AI Agent (Strands agent on AgentCore Runtime) ││ main.py + mcp_client/client.py ││ Role: \<RUNTIME_ROLE_NAME\> │└──────────────────────────────┬────────────────────────────────────┘ │ MCP over Streamable HTTP │ SigV4-signed (service: bedrock-agentcore) ▼┌───────────────────────────────────────────────────────────────────┐│ AgentCore Gateway (protocolType=MCP, authorizerType=AWS_IAM) ││ mcpServer target → DevOps Agent MCP endpoint ││ Role: \<GATEWAY_ROLE_NAME\> │└──────────────────────────────┬────────────────────────────────────┘ │ HTTPS + SigV4 (service: aidevops) │ (Gateway's own IAM role — GATEWAY_IAM_ROLE) ▼┌───────────────────────────────────────────────────────────────────┐│ AWS DevOps Agent MCP Endpoint (managed service) ││ https://connect.aidevops.\<AWS_REGION\>.api.aws/mcp ││ AgentSpace, investigations, chat, recommendations (30+ tools) │└───────────────────────────────────────────────────────────────────┘Each hop still has its own trust boundary — there's just one fewer hop than the Lambda pattern. No Lambda, no custom code.
3. Inspecting DevOps Agent's Native MCP Tools
Before registering the Gateway target, you can inspect what tools the DevOps Agent MCP
endpoint exposes natively using
awscurl :pip install awscurl
awscurl --service aidevops --region \<AWS_REGION\> \ -X POST \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' \ "https://connect.aidevops.\<AWS_REGION\>.api.aws/mcp"The response is a JSON-RPC result with an array of
{name, description, inputSchema} objects — DevOps Agent currently exposes 30+ tools covering chat, investigations, recommendations, release testing, access tokens, and more.> Note on the Gateway's own endpoint: unlike the DevOps Agent endpoint above, the Gateway's
/mcp endpoint (once created) does not accept a plain awscurl POST — see the callout in Section 8 for why, and what to use instead.If you want to restrict which tools the agent can call, use the Gateway's tool filtering configuration rather than curating a schema in custom code.
4. IAM / Security Model
Hop | Principal | Permission needed | Scope |
|---|---|---|---|
Agent → Gateway | AgentCore Runtime execution role ( \<RUNTIME_ROLE_NAME\> ) | bedrock-agentcore:InvokeGateway | Single Gateway ARN |
Gateway (inbound) | Gateway authorizerType: AWS_IAM | Validates caller's SigV4 identity | Enforced by the Gateway |
Gateway → DevOps Agent MCP | Gateway's own role ( \<GATEWAY_ROLE_NAME\> ), via GATEWAY_IAM_ROLE credential provider | aidevops:* (or narrower) | DevOps Agent MCP endpoint |
Key differences from the Lambda pattern:
- The Gateway role now holds
aidevops:*(previously the Lambda execution role held this).
- No Lambda resource policy needed — there is no Lambda.
- No
lambda:InvokeFunctionpermission needed anywhere.
Gateway role inline policy:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "aidevops:*", "Resource": "*" } ]}Scope
aidevops:* down where practical — e.g. aidevops:List* and aidevops:Get* for
read-only discovery/chat tools, separated from write actions like
aidevops:CreateBacklogTask and aidevops:CreateChat .
5. Registering the Direct MCP Target on the Gateway
This is the section that differs most from the Lambda pattern. Both commands below are validated directly against the
create-gateway-target API — copy them as-is. The full sequence is also automated end to end in setup-devops-agent-gateway.sh .5.1 Create the Gateway
aws bedrock-agentcore-control create-gateway \ --name "\<GATEWAY_NAME\>" \ --role-arn "arn:aws:iam::\<AWS_ACCOUNT_ID\>:role/\<GATEWAY_ROLE_NAME\>" \ --protocol-type MCP \ --authorizer-type AWS_IAM \ --region \<AWS_REGION\>Save the
gatewayId and gatewayUrl from the response.Gotcha — naming constraint. Gateway names must match
([0-9a-zA-Z][-]?){1,48} — no underscores. 5.2 Register the DevOps Agent MCP endpoint as a direct target
aws bedrock-agentcore-control create-gateway-target \ --gateway-identifier "\<GATEWAY_ID\>" \ --name "\<GATEWAY_TARGET_NAME\>" \ --description "Direct passthrough to AWS DevOps Agent MCP endpoint" \ --target-configuration '{ "mcp": { "mcpServer": { "endpoint": "https://connect.aidevops.\<AWS_REGION\>.api.aws/mcp", "listingMode": "DYNAMIC" } } }' \ --credential-provider-configurations '[{ "credentialProviderType": "GATEWAY_IAM_ROLE", "credentialProvider": { "iamCredentialProvider": { "service": "aidevops", "region": "\<AWS_REGION\>" } } }]' \ --region \<AWS_REGION\>listingMode: DYNAMIC means the Gateway discovers and proxies tools live from the upstream MCP endpoint — no static schema to maintain. The iamCredentialProvider block tells the Gateway which AWS service ( aidevops ) and region to SigV4-sign outbound calls for; the actual signing identity is still the Gateway's own role from 5.1.
6. Connecting the AgentCore AI Agent to the Gateway
Unchanged from the Lambda pattern — the agent runtime treats the Gateway as just another MCP server, so the same AgentCore AI agent described in the Lambda doc (
agentcore.json connection block, mcp_client/client.py , main.py ) works here without any code changes. Nothing in the agent depends on whether the Gateway's target is a Lambda or a direct mcpServer URL — only the Gateway ARN in agentcore.json needs to point at this pattern's Gateway.aws_service="bedrock-agentcore" in the agent's MCP client signs requests to the Gateway's endpoint. The Gateway's own outbound call to DevOps Agent ( aidevops service) happens one hop later and is invisible to the agent — same separation of signing concerns as the Lambda pattern, just with one fewer hop overall.> You can also use this connection through the AgentCore Harness to build your AI Agent :

7. Deployment Walkthrough
Run
gateway_without_lambda/setup-devops-agent-gateway.sh . It performs, idempotently:- PHASE 1 — IAM Roles. Creates four roles:
DevOpsSpaceRole-\<SUFFIX\>,DevOpsOperatorRole-\<SUFFIX\>,DevOpsGwRole-\<SUFFIX\>(holdsaidevops:*), andDevOpsRuntimeRole-\<SUFFIX\>(holdsbedrock-agentcore:InvokeGateway+bedrock:InvokeModel*).
- PHASE 2 — DevOps Agent Space. Creates the AgentSpace, associates the AWS account for topology discovery, and enables the operator app.
- PHASE 3 — AgentCore Gateway. Creates the Gateway (
protocolType=MCP,authorizerType=AWS_IAM), then registers the directmcpServertarget per Section 5 .
- PHASE 4 — Scoped InvokeGateway grant. Attaches an
InvokeSpecificGatewayinline policy to the runtime role, scoped to the one Gateway ARN just created (least privilege over the wildcard granted in Phase 1).
At the end, it writes
setup-env-output.sh next to itself with every resource name/ID/ARN it created — this is what the cleanup script consumes.cd gateway_without_lambdaexport AWS_ACCOUNT_ID="\<your-account-id\>"export AWS_REGION="us-east-1" # optional, defaults to us-east-1./setup-devops-agent-gateway.shNo Lambda deployment step — Phases 1 and 3 replace the entire Lambda build/deploy/ permission sequence from the original pattern. From here, deploying and connecting the AgentCore agent itself (
agentcore create , agentcore deploy ) is identical to the Lambda pattern's deployment steps for the agent runtime.
8. Testing & Verification
Verifying the Gateway target itself — a real constraint, not a config error. The obvious next step, calling the Gateway's own
/mcp endpoint with awscurl the same way Section 3 calls the DevOps Agent endpoint directly, does not work:awscurl --service bedrock-agentcore --region \<AWS_REGION\> \ -X POST \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' \ "\<GATEWAY_URL\>/mcp"This returns:
{"success":false,"error":"Http operation is not supported for gateway protocol type MCP"}MCP-protocol Gateways speak Streamable HTTP (an SSE-based transport), not plain HTTP POST/response. A one-shot
curl -style request simply isn't the right shape of call for this endpoint, regardless of how it's signed. Two ways to actually verify:- Control-plane check (fastest, no MCP client needed):
bash aws bedrock-agentcore-control list-gateway-targets \ --gateway-identifier "\<GATEWAY_ID\>" \ --region \<AWS_REGION\>Confirms the target exists and its status (READY/FAILED/etc.) without needing to speak MCP at all.
- Real MCP client, Streamable HTTP + SigV4 — e.g. via
mcp-proxy-for-aws:```json { "mcpServers": { "devops-agent-gateway": { "command": "uvx", "args": ["mcp-proxy-for-aws@latest", "<GATEWAY_URL>", "--service", "bedrock-agentcore", "--region", "<AWS_REGION>"] } } }
Full path via the deployed agent:
agentcore invoke --agent DevOpsAssistantAgent \ --payload '{"prompt": "What are my top 3 AWS cost drivers this month?"}'A successful response confirms both hops (agent → gateway, gateway → DevOps Agent MCP) are wired correctly — this is the most reliable end-to-end check for this pattern, since neither intermediate hop is
curl -testable the way the Lambda pattern's Lambda-in-isolation test is.Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article