GatewayTargetMcpServerProps Struct
Properties for creating an MCP Server-based Gateway Target.
| Source | aws-bedrockagentcore/lib/gateway/targets/target.ts |
|---|---|
| Type last changed |
Example
ts
const gateway = new agentcore.Gateway(this, "MyGateway", {
gatewayName: "my-gateway",
});
// OAuth2 (recommended): use OAuth2CredentialProvider + bindForGatewayOAuthTarget, or ARNs from console/API
const oauthProviderArn = "arn:aws:bedrock-agentcore:us-east-1:123456789012:token-vault/abc123/oauth2credentialprovider/my-oauth";
const oauthSecretArn = "arn:aws:secretsmanager:us-east-1:123456789012:secret:my-oauth-secret-abc123";
// Create a gateway target with MCP Server
const mcpTarget = agentcore.GatewayTarget.forMcpServer(this, "MyMcpServer", {
gatewayTargetName: "my-mcp-server",
description: "External MCP server integration",
gateway: gateway,
endpoint: "https://my-mcp-server.example.com",
credentialProviderConfigurations: [
agentcore.GatewayCredentialProvider.fromOauthIdentityArn({
providerArn: oauthProviderArn,
secretArn: oauthSecretArn,
scopes:['mcp-runtime-server/invoke']
}),
],
});
python
gateway = agentcore.Gateway(self, "MyGateway",
gateway_name="my-gateway"
)
# OAuth2 (recommended): use OAuth2CredentialProvider + bindForGatewayOAuthTarget, or ARNs from console/API
oauth_provider_arn = "arn:aws:bedrock-agentcore:us-east-1:123456789012:token-vault/abc123/oauth2credentialprovider/my-oauth"
oauth_secret_arn = "arn:aws:secretsmanager:us-east-1:123456789012:secret:my-oauth-secret-abc123"
# Create a gateway target with MCP Server
mcp_target = agentcore.GatewayTarget.for_mcp_server(self, "MyMcpServer",
gateway_target_name="my-mcp-server",
description="External MCP server integration",
gateway=gateway,
endpoint="https://my-mcp-server.example.com",
credential_provider_configurations=[
agentcore.GatewayCredentialProvider.from_oauth_identity_arn(
provider_arn=oauth_provider_arn,
secret_arn=oauth_secret_arn,
scopes=["mcp-runtime-server/invoke"]
)
]
)
java
Gateway gateway = Gateway.Builder.create(this, "MyGateway")
.gatewayName("my-gateway")
.build();
// OAuth2 (recommended): use OAuth2CredentialProvider + bindForGatewayOAuthTarget, or ARNs from console/API
String oauthProviderArn = "arn:aws:bedrock-agentcore:us-east-1:123456789012:token-vault/abc123/oauth2credentialprovider/my-oauth";
String oauthSecretArn = "arn:aws:secretsmanager:us-east-1:123456789012:secret:my-oauth-secret-abc123";
// Create a gateway target with MCP Server
GatewayTarget mcpTarget = GatewayTarget.forMcpServer(this, "MyMcpServer", GatewayTargetMcpServerProps.builder()
.gatewayTargetName("my-mcp-server")
.description("External MCP server integration")
.gateway(gateway)
.endpoint("https://my-mcp-server.example.com")
.credentialProviderConfigurations(List.of(GatewayCredentialProvider.fromOauthIdentityArn(OAuthConfiguration.builder()
.providerArn(oauthProviderArn)
.secretArn(oauthSecretArn)
.scopes(List.of("mcp-runtime-server/invoke"))
.build())))
.build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
var gateway = new Gateway(this, "MyGateway", new GatewayProps {
GatewayName = "my-gateway"
});
// OAuth2 (recommended): use OAuth2CredentialProvider + bindForGatewayOAuthTarget, or ARNs from console/API
var oauthProviderArn = "arn:aws:bedrock-agentcore:us-east-1:123456789012:token-vault/abc123/oauth2credentialprovider/my-oauth";
var oauthSecretArn = "arn:aws:secretsmanager:us-east-1:123456789012:secret:my-oauth-secret-abc123";
// Create a gateway target with MCP Server
var mcpTarget = GatewayTarget.ForMcpServer(this, "MyMcpServer", new GatewayTargetMcpServerProps {
GatewayTargetName = "my-mcp-server",
Description = "External MCP server integration",
Gateway = gateway,
Endpoint = "https://my-mcp-server.example.com",
CredentialProviderConfigurations = new [] { GatewayCredentialProvider.FromOauthIdentityArn(new OAuthConfiguration {
ProviderArn = oauthProviderArn,
SecretArn = oauthSecretArn,
Scopes = new [] { "mcp-runtime-server/invoke" }
}) }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
gateway := agentcore.NewGateway(this, jsii.String("MyGateway"), &GatewayProps{
GatewayName: jsii.String("my-gateway"),
})
// OAuth2 (recommended): use OAuth2CredentialProvider + bindForGatewayOAuthTarget, or ARNs from console/API
oauthProviderArn := "arn:aws:bedrock-agentcore:us-east-1:123456789012:token-vault/abc123/oauth2credentialprovider/my-oauth"
oauthSecretArn := "arn:aws:secretsmanager:us-east-1:123456789012:secret:my-oauth-secret-abc123"
// Create a gateway target with MCP Server
mcpTarget := agentcore.GatewayTarget_ForMcpServer(this, jsii.String("MyMcpServer"), &GatewayTargetMcpServerProps{
GatewayTargetName: jsii.String("my-mcp-server"),
Description: jsii.String("External MCP server integration"),
Gateway: gateway,
Endpoint: jsii.String("https://my-mcp-server.example.com"),
CredentialProviderConfigurations: []ICredentialProviderConfig{
agentcore.GatewayCredentialProvider_FromOauthIdentityArn(&OAuthConfiguration{
ProviderArn: oauthProviderArn,
SecretArn: oauthSecretArn,
Scopes: []*string{
jsii.String("mcp-runtime-server/invoke"),
},
}),
},
})
Properties
credentialProviderConfigurationsICredentialProviderConfig[]credential_provider_configurationstyping.List[ICredentialProviderConfig]credentialProviderConfigurationsList<ICredentialProviderConfig>CredentialProviderConfigurationsICredentialProviderConfig[]CredentialProviderConfigurations*[]ICredentialProviderConfig required #Credential providers for authentication.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string #Optional description for the gateway target The description can have up to 200 characters.
Default: No description
The HTTPS endpoint URL of the MCP server.
The endpoint must:
- Use HTTPS protocol
- Be properly URL-encoded
- Point to an MCP server that implements tool capabilities
The gateway this target belongs to.
gatewayTargetNameoptionalstringgateway_target_nameoptionalstrgatewayTargetNameoptionalStringGatewayTargetNameoptionalstringGatewayTargetNameoptional*string #The name of the gateway target The name must be unique within the gateway Pattern: ^([0-9a-zA-Z][-]?){1,100}$.
Default: auto generate