本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
客服人員故障診斷的設定
注意
Apache Spark 故障診斷代理程式使用跨區域推論來處理自然語言請求並產生回應。如需詳細資訊,請參閱 Apache Spark 故障診斷代理程式的跨區域處理。Amazon SageMaker Unified Studio MCP 伺服器處於預覽狀態,可能會有所變更。
先決條件
在我們開始與 Kiro CLI 整合的設定程序之前,請確定您的工作站已安裝下列項目:
-
AWS 已設定的本機登入資料 (透過 AWS CLI、環境變數或 IAM 角色) - 用於本機操作,例如上傳升級的任務成品以進行 EMR 驗證任務執行。
設定資源
您可以使用 AWS CloudFormation 範本來設定 MCP 伺服器的資源。這些範本是範例,您應加以修改以符合您的需求。範本會為疑難排解程序建立下列資源:
-
IAM 角色,具有呼叫 MCP Server 的許可,以及所選平台疑難排解程序所需的許可。
選擇下表中的其中一個 Launch Stack (啟動堆疊) 按鈕。這會在個別區域的 AWS CloudFormation 主控台上啟動堆疊。
繼續前往指定堆疊詳細資訊頁面,輸入堆疊名稱。在 Parameters (參數) 下輸入其他資訊。提供以下資訊並繼續建立堆疊。
-
TroubleshootingRoleName - 要為故障診斷操作建立的 IAM 角色名稱
-
EnableEMREC2 - 啟用 EMR-EC2 疑難排解許可 (預設值: true)
-
EnableEMRServerless - 啟用 EMR-Serverless 疑難排解許可 (預設值: true)
-
EnableGlue - 啟用 Glue 故障診斷許可 (預設值: true)
-
CloudWatchKmsKeyArn - (選用) CloudWatch Logs 加密現有 KMS 金鑰的 ARN (僅限 EMR Serverless,預設加密保留空白)
您也可以下載並檢閱 CloudFormation 範本
# deploy the stack with CloudFormation CLI commands aws cloudformation deploy \ --template-file spark-troubleshooting-mcp-setup.yaml \ --stack-name spark-troubleshooting-mcp-setup \ --region <your Spark MCP server launch region> \ --capabilities CAPABILITY_NAMED_IAM \ --parameter-overrides \ TroubleshootingRoleName=spark-troubleshooting-role # retrieve the 1-line instruction to set the local environment variables, which will be used for the following MCP server configuration aws cloudformation describe-stacks \ --stack-name spark-troubleshooting-mcp-setup \ --region <your Spark MCP server launch region> \ --query "Stacks[0].Outputs[?OutputKey=='ExportCommand'].OutputValue" \ --output text
開啟輸出索引標籤 (或從上述 CloudFormation describe-stacks CLI 命令擷取),並從 CloudFormation 輸出複製 1 行指令以設定您的環境變數,然後在您的本機環境中執行。範例 1 行指令:
export SMUS_MCP_REGION=<your mcp server launch region> && export IAM_ROLE=arn:aws:iam::111122223333:role/spark-troubleshooting-role-xxxxxx
然後在本機執行下列命令來設定 IAM 設定檔和 MCP 伺服器組態:
# Step 1: Configure AWS CLI Profile aws configure set profile.smus-mcp-profile.role_arn ${IAM_ROLE} aws configure set profile.smus-mcp-profile.source_profile <AWS CLI Profile to assume the IAM role - ex: default> aws configure set profile.smus-mcp-profile.region ${SMUS_MCP_REGION} # Step 2: if you are using kiro CLI, use the following command to add the MCP configuration # Add Spark Troubleshooting MCP Server kiro-cli-chat mcp add \ --name "sagemaker-unified-studio-mcp-troubleshooting" \ --command "uvx" \ --args "[\"mcp-proxy-for-aws@latest\",\"https://sagemaker-unified-studio-mcp.${SMUS_MCP_REGION}.api.aws/spark-troubleshooting/mcp\", \"--service\", \"sagemaker-unified-studio-mcp\", \"--profile\", \"smus-mcp-profile\", \"--region\", \"${SMUS_MCP_REGION}\", \"--read-timeout\", \"180\"]" \ --timeout 180000 \ --scope global # Add Spark Code Recommendation MCP Server kiro-cli-chat mcp add \ --name "sagemaker-unified-studio-mcp-code-rec" \ --command "uvx" \ --args "[\"mcp-proxy-for-aws@latest\",\"https://sagemaker-unified-studio-mcp.${SMUS_MCP_REGION}.api.aws/spark-code-recommendation/mcp\", \"--service\", \"sagemaker-unified-studio-mcp\", \"--profile\", \"smus-mcp-profile\", \"--region\", \"${SMUS_MCP_REGION}\", \"--read-timeout\", \"180\"]" \ --timeout 180000 \ --scope global
這應該更新~/.kiro/settings/mcp.json為包含 MCP 伺服器組態,如下所示。
{ "mcpServers": { "sagemaker-unified-studio-mcp-troubleshooting": { "type": "stdio", "command": "uvx", "args": [ "mcp-proxy-for-aws@latest", "https://sagemaker-unified-studio-mcp.us-east-1.api.aws/spark-troubleshooting/mcp", "--service", "sagemaker-unified-studio-mcp", "--profile", "smus-mcp-profile", "--region", "us-east-1", "--read-timeout", "180" ], "timeout": 180000, "disabled": false }, "sagemaker-unified-studio-mcp-code-rec": { "type": "stdio", "command": "uvx", "args": [ "mcp-proxy-for-aws@latest", "https://sagemaker-unified-studio-mcp.us-east-1.api.aws/spark-code-recommendation/mcp", "--service", "sagemaker-unified-studio-mcp", "--profile", "smus-mcp-profile", "--region", "us-east-1", "--read-timeout", "180" ], "timeout": 180000, "disabled": false } } }
支援的界面 如需 Kiro、Cline 和 GitHub CoPilot 等不同 MCP 用戶端的組態指引,請參閱 。