-
Notifications
You must be signed in to change notification settings - Fork 821
Description
Summary
AgentCore Gateway fails to forward tools/call requests to MCP server targets configured with OAuth authentication (client_credentials flow). The Gateway returns "An internal error occurred" without forwarding the request to the MCP runtime.
Which component is impacted?
- 01-AgentCore-runtime
- 02-AgentCore-gateway
- 03-AgentCore-identity
- 04-AgentCore-memory
- 05-AgentCore-tools
- 06-AgentCore-observability
- 07-AgentCore-E2E
What Works
tools/listvia Gateway (cached from synchronization) ✅- Direct OAuth calls to MCP runtime (both
tools/listandtools/call) ✅
What Fails
tools/callvia Gateway → Returns "An internal error occurred" ❌
Environment
- Region: us-east-1
- Gateway Authentication: AWS_IAM (SigV4)
- Target Authentication: OAuth credential provider (Cognito client_credentials)
- MCP Runtime: AgentCore Runtime with customJWTAuthorizer
Reproduction Steps
- Create MCP runtime with
customJWTAuthorizer(Cognito OIDC discovery URL) - Create Gateway with AWS_IAM authentication
- Create Gateway target with OAuth credential provider:
- Token endpoint: Cognito
/oauth2/token - Grant type:
client_credentials - Scope: custom scope for MCP invoke
- Token endpoint: Cognito
- Verify target status is READY (synchronization succeeds)
- Call
tools/listvia Gateway → Works, returns tool list - Call
tools/callvia Gateway → Fails with internal error
Error Response
{"jsonrpc":"2.0","id":"1","error":{"code":-32603,"message":"An internal error occurred"}}Evidence
MCP runtime CloudWatch logs show only:
PingRequest(during synchronization)ListToolsRequest(during synchronization)
No CallToolRequest is ever received by the runtime when calling through Gateway.
When calling the MCP runtime directly with OAuth Bearer token (bypassing Gateway), both tools/list and tools/call work correctly.
Workaround
We implemented a workaround that calls the MCP runtime directly with OAuth tokens, bypassing the Gateway for tools/call requests. This confirms the issue is in the Gateway's request forwarding, not the MCP runtime or OAuth configuration.
Expected Behavior
Gateway should forward tools/call requests to MCP runtime targets with OAuth authentication, just as it does for tools/list requests.
AWS Support Case
Filed with AWS Support (Bedrock AgentCore / Gateway category).