使用 CLI 新增目標
您可以使用 AgentCore CLI,透過簡化的命令將目標新增至現有的閘道。
範例
- AgentCore CLI
-
-
新增 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
-
-
您也可以使用 AgentCore CLI 互動式終端機 UI。執行
agentcore以開啟 TUI,然後選取新增,然後選擇閘道目標 : -
在新增資源功能表中,選取閘道目標,然後按 Enter 鍵。
-
選取閘道的目標類型。精靈會顯示可用的目標類型,包括 MCP 伺服器端點、API Gateway REST API、OpenAPI 結構描述、Smithy Model 和 Lambda 函數。
-
遵循剩餘的精靈提示,提供目標名稱、端點或結構描述詳細資訊,以及傳出授權組態。特定欄位取決於您選取的目標類型。
-
如需更多 CLI 範例,請參閱 AgentCore Gateway 入門。
使用 AWS 管理主控台新增目標
使用 API 新增目標