使用 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 模型和 Lambda 函数。
-
按照向导的其余提示提供目标名称、端点或架构详细信息以及出站授权配置。具体字段取决于您选择的目标类型。
-
有关更多 CLI 示例,请参阅 AgentCore 网关入门。
使用 AWS 管理控制台添加目标
使用 API 添加目标