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 Model 和 Lambda 函數。

    顯示 MCP 伺服器端點的 TUI 目標類型選擇
  4. 遵循剩餘的精靈提示,提供目標名稱、端點或結構描述詳細資訊,以及傳出授權組態。特定欄位取決於您選取的目標類型。

如需更多 CLI 範例,請參閱 AgentCore Gateway 入門