interface AddMcpServerTargetOptions
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Bedrock.Agentcore.Alpha.AddMcpServerTargetOptions |
Go | github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2#AddMcpServerTargetOptions |
Java | software.amazon.awscdk.services.bedrock.agentcore.alpha.AddMcpServerTargetOptions |
Python | aws_cdk.aws_bedrock_agentcore_alpha.AddMcpServerTargetOptions |
TypeScript (source) | @aws-cdk/aws-bedrock-agentcore-alpha ยป AddMcpServerTargetOptions |
Options for adding an MCP Server target to a gateway.
Example
const gateway = new agentcore.Gateway(this, "MyGateway", {
gatewayName: "my-gateway",
});
// OAuth2 authentication (recommended)
// Note: Create the OAuth provider using AWS console or Identity L2 construct when available
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";
// Add an MCP server target directly to the gateway
const mcpTarget = gateway.addMcpServerTarget("MyMcpServer", {
gatewayTargetName: "my-mcp-server",
description: "External MCP server integration",
endpoint: "https://my-mcp-server.example.com",
credentialProviderConfigurations: [
agentcore.GatewayCredentialProvider.fromOauthIdentityArn({
providerArn: oauthProviderArn,
secretArn: oauthSecretArn,
scopes:['mcp-runtime-server/invoke']
}),
],
});
// Grant sync permission to a Lambda function that will trigger synchronization
const syncFunction = new lambda.Function(this, "SyncFunction", {
runtime: lambda.Runtime.PYTHON_3_12,
handler: "index.handler",
code: lambda.Code.fromInline(`
import boto3
def handler(event, context):
client = boto3.client('bedrock-agentcore')
response = client.synchronize_gateway_targets(
gatewayIdentifier=event['gatewayId'],
targetIds=[event['targetId']]
)
return response
`),
});
mcpTarget.grantSync(syncFunction);
Properties
| Name | Type | Description |
|---|---|---|
| credential | ICredential[] | Credential providers for authentication. |
| endpoint | string | The HTTPS endpoint URL of the MCP server. |
| gateway | string | The name of the gateway target Valid characters are a-z, A-Z, 0-9, _ (underscore) and - (hyphen). |
| description? | string | Optional description for the gateway target. |
credentialProviderConfigurations
Type:
ICredential[]
Credential providers for authentication.
MCP servers require explicit authentication configuration. OAuth2 is strongly recommended over NoAuth.
endpoint
Type:
string
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
gatewayTargetName
Type:
string
The name of the gateway target Valid characters are a-z, A-Z, 0-9, _ (underscore) and - (hyphen).
description?
Type:
string
(optional, default: No description)
Optional description for the gateway target.

.NET
Go
Java
Python
TypeScript (