MCP with AWS SigV4
MCP servers hosted on AWS, including Bedrock AgentCore gateways and servers behind API Gateway with IAM authorization, require every request to be signed with AWS Signature Version 4. The gateway signs MCP requests on behalf of clients, so clients only need a virtual key and never see AWS credentials. Tool calls made by models through MCP tools are signed the same way.
A real-world scenario
A platform team exposes internal order tools through a Bedrock AgentCore gateway. Coding assistants and chat applications should use those tools, but none of them can hold IAM credentials. The team registers the AgentCore gateway on the Spanway gateway with the AWS SigV4 auth type and lets the gateway's task role sign. Every client connects to the gateway's /mcp endpoint with a virtual key, and the tool calls are signed, logged and subject to the same tool permissions as every other MCP server.
Before you start
The identity the gateway signs with needs permission to invoke the gateway or API. For Bedrock AgentCore that is the bedrock-agentcore:InvokeGateway action on the gateway resource. Scope the policy to the specific resource rather than granting it on all gateways. When no credentials are set on the server, the gateway uses its default AWS credential chain, so an IAM role on the instance, web identity tokens and container credentials all work.
| Field | Meaning |
|---|---|
auth_type | aws_sigv4. |
aws_region_name | Region used in the signature, such as us-east-1. |
aws_service_name | Service name used in the signature, bedrock-agentcore by default, or execute-api for API Gateway. |
aws_access_key_id, aws_secret_access_key, aws_session_token | Optional static credentials, with os.environ/ references allowed. Stored encrypted. |
aws_role_name, aws_session_name | Assume this role before signing, under this session name. |
Steps
-
In the Admin UI open
/ui/mcp-serversand click + Add New MCP Server, then pick a blank server from the Add MCP Server catalogue. Enter MCP Server Nameagentcore_tools, choose Streamable HTTP (Recommended) under Transport Type, and paste the AgentCore URL under MCP Server URL. Under Authentication settings choose AWS SigV4 (Bedrock AgentCore MCPs). Fill AWS Regionus-east-1and leave AWS Service Name atbedrock-agentcore. Leave AWS Access Key ID and AWS Secret Access Key blank to sign with the gateway's own role, or fill both. Set AWS Role ARN when the gateway should assume a role first. Click Add MCP Server. -
Or register the server over the API with a proxy admin key. The AWS fields travel under
credentials.curl -X POST http://localhost:4000/v1/mcp/server \-H "Authorization: Bearer $SPANWAY_MASTER_KEY" \-H "Content-Type: application/json" \-d '{"server_name": "agentcore_tools", "url": "https://my-gateway.gateway.bedrock-agentcore.us-east-1.amazonaws.com/mcp", "transport": "http", "auth_type": "aws_sigv4", "credentials": {"aws_region_name": "us-east-1", "aws_service_name": "bedrock-agentcore"}}'Or in the config file.
mcp_servers:agentcore_tools:url: https://my-gateway.gateway.bedrock-agentcore.us-east-1.amazonaws.com/mcptransport: httpauth_type: aws_sigv4aws_region_name: us-east-1aws_service_name: bedrock-agentcore -
Grant the server to a key or team under its MCP permissions, or set
allow_all_keys: trueon the server, see MCP access control. -
List the tools through the gateway with a virtual key.
curl -X POST http://localhost:4000/mcp \-H "Authorization: Bearer $SPANWAY_API_KEY" \-H "x-mcp-servers: agentcore_tools" \-H "Content-Type: application/json" \-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}' -
On the server's page in the Admin UI, use the connection test to confirm the signature is accepted.
Expected result
The gateway opens the MCP session with the upstream server, signs each request with SigV4 and relays the result. The tools/list call returns the server's tools in the MCP JSON-RPC shape.
{"jsonrpc": "2.0", "id": 1, "result": {"tools": [{"name": "get_order", "description": "Look up an order by id", "inputSchema": {"type": "object", "properties": {"order_id": {"type": "string"}}}}]}}
The server appears on the MCP Servers page with auth type aws_sigv4, and the MCP activity view lists every tool call with the key that made it.
Errors
| Status | Message | What it means and how to fix it |
|---|---|---|
401 | Authentication Error, Invalid proxy server token passed | The virtual key is missing, wrong, expired or blocked. |
403 | A message saying the key cannot access the MCP server | The server is not granted to the key or team. Grant it or set allow_all_keys. |
403 from AWS | User: ... is not authorized to perform: bedrock-agentcore:InvokeGateway or Credential should be scoped to a valid region | The signing identity lacks permission, or aws_service_name or aws_region_name does not match the endpoint. Fix the IAM policy or the two fields. |
401 from the server | Unauthorized | The server expected a different auth type, for example OAuth. Check the server's authorizer. |
400 | A message naming a changed destination field | The server's URL was changed while the stored credentials were sent back masked. Re-enter the credentials with the new URL. |
500 | Missing botocore to use AWS SigV4 authentication | The gateway image lacks the AWS signing library. Contact support@spanway.ai. |
Logs
The gateway records how it resolved the upstream credential for each MCP request. For a SigV4 server the resolution is aws_sigv4, visible in the MCP debug view and at DEBUG in the gateway logs. The upstream status of each MCP request is logged with the server name, so a run of 403 entries for one server points at the IAM policy or the region and service fields.
Related
MCP servers covers the other auth types and the config file fields, and the MCP Servers page describes every control of the form. MCP access control explains tool permissions. Bedrock pass-through signs Bedrock API calls with the same credential chain.