View a markdown version of this page

使用 CLI 添加目标 - Amazon Bedrock AgentCore

使用 CLI 添加目标

您可以使用 AgentCore CLI 通过简化的命令将目标添加到现有网关。

AgentCore CLI
  1. 添加 MCP 服务器目标:

    agentcore add gateway-target \ --name MyMCPTarget \ --type mcp-server \ --endpoint https://your-mcp-server.example.com/mcp \ --gateway MyGateway agentcore deploy

    添加一个 Lambda 函数目标:

    agentcore add gateway-target \ --name MyLambdaTarget \ --type lambda-function-arn \ --lambda-arn arn:aws:lambda:us-east-1:123456789012:function:MyFunction \ --tool-schema-file tools.json \ --gateway MyGateway agentcore deploy

    添加一个 OpenAPI 架构目标:

    agentcore add gateway-target \ --name MyOpenAPITarget \ --type open-api-schema \ --schema path/to/openapi-spec.json \ --outbound-auth none|api-key|oauth \ --gateway MyGateway agentcore deploy

    使用 Web 搜索工具添加连接器目标:

    agentcore add gateway-target \ --name MyWebSearchToolTarget \ --type connector \ --connector web-search \ --exclude-domains blocked-website-1.com,blocked-website-2.com \ --gateway MyGateway agentcore deploy
Interactive
  1. 您也可以使用 AgentCore CLI 交互式终端 UI。运行agentcore打开 TUI,然后选择添加并选择网关目标

  2. 在 “添加资源” 菜单中,选择 “网关目标”,然后按 Enter

    TUI 添加资源菜单,网关目标选项可见
  3. 为您的网关选择目标类型。该向导显示了可用的目标类型,包括 MCP 服务器终端节点、API Gateway REST API、OpenAPI 架构、Smithy 模型和 Lambda 函数。

    显示 MCP 服务器端点的 TUI 目标类型选择
  4. 按照向导的其余提示提供目标名称、端点或架构详细信息以及出站授权配置。具体字段取决于您选择的目标类型。

有关更多 CLI 示例,请参阅 AgentCore 网关入门