ApiGatewayTargetConfiguration
- class aws_cdk.aws_bedrockagentcore.ApiGatewayTargetConfiguration(*, api_gateway_tool_configuration, rest_api, metadata_configuration=None, stage=None)
Bases:
McpTargetConfigurationConfiguration for API Gateway-based MCP targets.
This configuration connects your gateway to an Amazon API Gateway REST API stage. The gateway translates incoming MCP requests into HTTP requests to your REST API and handles response formatting.
Key considerations:
API must be in the same account and region as the gateway
Only REST APIs are supported (no HTTP or WebSocket APIs)
API must use a public endpoint type
Methods with both AWS_IAM authorization and API key requirements are not supported
Proxy resources (e.g.,
/pets/{proxy+}) are not supported
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_apigateway as apigateway from aws_cdk import aws_bedrockagentcore as bedrockagentcore # api_gateway_http_method: bedrockagentcore.ApiGatewayHttpMethod # rest_api: apigateway.RestApi api_gateway_target_configuration = bedrockagentcore.ApiGatewayTargetConfiguration( api_gateway_tool_configuration=bedrockagentcore.ApiGatewayToolConfiguration( tool_filters=[bedrockagentcore.ApiGatewayToolFilter( filter_path="filterPath", methods=[api_gateway_http_method] )], # the properties below are optional tool_overrides=[bedrockagentcore.ApiGatewayToolOverride( method=api_gateway_http_method, name="name", path="path", # the properties below are optional description="description" )] ), rest_api=rest_api, # the properties below are optional metadata_configuration=bedrockagentcore.MetadataConfiguration( allowed_query_parameters=["allowedQueryParameters"], allowed_request_headers=["allowedRequestHeaders"], allowed_response_headers=["allowedResponseHeaders"] ), stage="stage" )
- Parameters:
api_gateway_tool_configuration (
Union[ApiGatewayToolConfiguration,Dict[str,Any]]) – Tool configuration defining which operations to expose.rest_api (
IRestApi) – The REST API to integrate with Must be in the same account and region as the gateway.metadata_configuration (
Union[MetadataConfiguration,Dict[str,Any],None]) – Metadata configuration for passing headers and query parameters Allows you to pass additional context through headers and query parameters. Default: - No metadata configurationstage (
Optional[str]) – The stage name of the REST API. Default: - Uses the deployment stage from the RestApi (restApi.deploymentStage.stageName)
Methods
- bind(_scope, gateway)
Binds this configuration to a construct scope Sets up necessary permissions for the gateway to access the API Gateway.
- Parameters:
- Return type:
Attributes
- api_gateway_tool_configuration
Tool configuration for the API Gateway target.
- metadata_configuration
Metadata configuration for the API Gateway target.
- rest_api_id
The ID of the REST API.
- stage
The stage name of the REST API.
- target_type
The target type.
Static Methods
- classmethod create(*, api_gateway_tool_configuration, rest_api, metadata_configuration=None, stage=None)
Create an API Gateway target configuration.
- Parameters:
api_gateway_tool_configuration (
Union[ApiGatewayToolConfiguration,Dict[str,Any]]) – Tool configuration defining which operations to expose.rest_api (
IRestApi) – The REST API to integrate with Must be in the same account and region as the gateway.metadata_configuration (
Union[MetadataConfiguration,Dict[str,Any],None]) – Metadata configuration for passing headers and query parameters Allows you to pass additional context through headers and query parameters. Default: - No metadata configurationstage (
Optional[str]) – The stage name of the REST API. Default: - Uses the deployment stage from the RestApi (restApi.deploymentStage.stageName)
- Return type:
- Returns:
A new ApiGatewayTargetConfiguration instance