🔧setup-devops-agent
- ソース
- GitHub で見る ↗
説明
AWS DevOps Agent MCP 接続のセットアップおよび診断を行います。 次のような場合に使用: - `.mcp.json` に `aws-devops-agent` が存在しない場合 - 接続が切断・破損している場合 - ユーザーが「set up devops agent」または「configure agent」と発言した場合 MCP がすでに接続済みで正常に動作している場合は起動しません。
原文を表示
Setup and diagnostics for the AWS DevOps Agent MCP connection. Triggers when aws-devops-agent is missing from .mcp.json, when the connection is broken, or when the user says "set up devops agent" / "configure agent". Does NOT trigger if the MCP is already connected and working.
ユースケース
- ✓.mcp.jsonにaws-devops-agentがない
- ✓接続が切断・破損している
- ✓DevOps Agentのセットアップを要求される
- ✓Agentの設定を要求される
本文(日本語訳)
AWS DevOps Agent — Claude セットアップ
以下の手順は、Claude アプリケーション向けの AWS DevOps Agent プラグインのセットアップに特化したものです。 他のクライアントを使用する場合は、この手順を参考にしながら、クライアント固有の要件に合わせて調整してください。
Step 0: セットアップが必要かどうかを確認する
1/ "aws-devops-agent" MCP サーバーが起動中かどうか確認します。起動中の場合は、接続が有効であることを確認してください(「Step 3: 接続の確認」を参照)。
確認が成功した場合は、プラグインがすでに SigV4 または Bearer Token でセットアップ済みであることをユーザーに伝えてください。
設定を Bearer Token または SigV4 に切り替えることも提案できます。詳細は後述の「Step 2: 認証方式の決定」を参照してください。
ユーザーが認証設定を変更しない場合は、ここで終了します(DONE STOP HERE)。
2/ 以下の場所に "aws-devops-agent" キーを持つ MCP サーバー設定ファイルが存在するか確認します:
- プラグインスコープ:
${CLAUDE_PLUGIN_ROOT}/.mcp.json - プロジェクトスコープ:
.mcp.json(プロジェクトディレクトリ内、バージョン管理対象) - プロジェクト固有:
.claude/settings.local.json(プロジェクトディレクトリ内) - ユーザー固有ローカル:
~/.claude/settings.local.json - ユーザー固有グローバル:
~/.claude/settings.json - メイン Claude.json:
~/.claude.json - MCP 専用ファイル:
~/.claude/mcp_servers.json
確認後の対応:
aws-devops-agentキーが存在し、かつサーバーが接続済み(ツールが利用可能、「Step 3: 接続の確認」参照)の場合 → ユーザーに「DevOps Agent はすでに設定済みで接続されています。」と伝えてください。 MCP 設定で Bearer Token が使用されている場合は、代わりに SigV4 認証情報を使用するセットアップも可能であることを提案してください(複数の Agent スペース、管理ツール向け)。 SigV4 認証情報が使用されている場合は、代わりに Bearer Token 認証情報を使用するセットアップも可能であることを提案してください(単一の Agent スペース向け)。aws-devops-agentキーが存在するが失敗している場合 → 「Step 1: 現状の診断」へ進むaws-devops-agentキーが存在しない場合 → 「Step 1: 現状の診断」へ進む
Step 1: 現状の診断
以下のチェックを実行します:
# Bearer Token の確認
echo "DEVOPS_AGENT_TOKEN: $([ -n "$DEVOPS_AGENT_TOKEN" ] && echo 'set' || echo 'not set')"
echo "DEVOPS_AGENT_REGION: ${DEVOPS_AGENT_REGION:-not set}"
# SigV4 依存関係の確認
uvx --version 2>&1
# AWS 認証情報の確認
aws sts get-caller-identity 2>&1
以下の状態を判定します:
bearer_ready=DEVOPS_AGENT_TOKENが設定済み かつDEVOPS_AGENT_REGIONが設定済みsigv4_ready=aws sts get-caller-identityが成功 かつuvxがインストール済み
Step 2: 認証方式の決定
診断後、利用可能な方式が一つだけであっても、必ずユーザーにどちらを使用するか確認してください。 診断結果を提示し、ユーザーに選択させてください。
- Bearer Token を使用したい場合: Agent スペースの Operator アプリのみにアクセスできる場合に適しています。
- SigV4 を使用したい場合: 複数の Agent スペースを使用する場合や、Agent スペースを管理する管理者権限を持っている場合に適しています。
| Bearer 準備完了 | SigV4 準備完了 | 対応 |
|---|---|---|
| はい | はい | 「Bearer Token と AWS 認証情報の両方が設定されています。DevOps Agent にはどちらを使用しますか? Bearer Token(単一 Agent スペース向け)または AWS 認証情報 / SigV4(複数 Agent スペースおよび管理ツール向け)?」 |
| はい | いいえ | 「Bearer Token が設定されています。Bearer Token(単一 Agent スペース向け)を使用して DevOps Agent をセットアップしますか?または、代わりに AWS 認証情報 / SigV4 を設定しますか(複数 Agent スペースおよび管理ツール向け)?」 |
| いいえ | はい | 「有効な AWS 認証情報が存在します。SigV4(複数 Agent スペースおよび管理ツール向け)を使用して DevOps Agent をセットアップしますか?または、代わりに Bearer Token をセットアップしますか(単一 Agent スペース向け)?」 |
| いいえ | いいえ | 「Bearer Token も AWS 認証情報も設定されていません。Bearer Token(単一 Agent スペース向け)または AWS 認証情報 / SigV4(複数 Agent スペースおよび管理ツール向け)のどちらで接続しますか?」その後、選択した方式の手順を案内してください。 |
Bearer Token のセットアップを希望するユーザーには、AWS ドキュメントの DevOps Agent リモートサーバーへの接続 を参照するよう案内するか、このドキュメントに基づいてアクセストークンの作成手順を説明してください。
ユーザーの選択が確認されるまで Step 3 には進まないでください。
Step 3: 接続の確認
"aws-devops-agent" MCP サーバーがすでに起動中の場合は、ツールの一覧取得が可能かどうか確認してください。 可能であれば、接続が確認されたことになります。
それ以外の場合は、以下の手順に進んでください。
.mcp.json を書き込む前に接続を確認します。これにより、認証情報が実際のエンドポイントに対して有効であることを確認できます。
また、既存の MCP サーバー設定の確認にも使用できます。
Bearer Token による確認
curl -s -w "\nHTTP_STATUS: %{http_code}" \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DEVOPS_AGENT_TOKEN" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' \
"https://connect.aidevops.${DEVOPS_AGENT_REGION}.api.aws/mcp"
| 結果 | 意味 | 対応 |
|---|---|---|
HTTP 200 + result.tools 配列 |
成功 | Step 4 へ進む |
| HTTP 401 | Token が無効または期限切れ | Operator Web App で新しい Token を作成するようユーザーに伝える |
| HTTP 403 | Token のスコープが不足 | Token に agent:read + agent:operate スコープが必要であることをユーザーに伝える |
| 接続拒否 / タイムアウト | エンドポイントに到達不能 | SigV4 が利用可能な場合はフォールバックを提案。利用不可の場合は到達不能を報告 |
SigV4 による確認
timeout 30 bash -c '
{
echo "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"initialize\",\"params\":{\"protocolVersion\":\"2024-11-05\",\"capabilities\":{},\"clientInfo\":{\"name\":\"setup-check\",\"version\":\"1.0\"}}}"
sleep 0.5
echo "{\"jsonrpc\":\"2.0\",\"method\":\"notifications/initialized\"}"
sleep 0.5
echo "{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"tools/list\",\"params\":{}}"
sleep 8
} | uvx mcp-proxy-for-aws@latest "https://connect.aidevops.${DEVOPS_AGENT_REGION}.api.aws/mcp" --service aidevops --region "$DEVOPS_AGENT_REGION"
'
注意: 初回実行時は、
uvxがmcp-proxy-for-awsとその依存関係をダウンロードするため、10〜15 秒かかる場合があります。2 回目以降はほぼ即時に完了します。
| 結果 | 意味 | 対応 |
|---|---|---|
2 行目に result.tools が含まれる |
成功 | Step 4 へ進む |
| 出力なし / タイムアウト | 認証情報が無効またはエンドポイントに到達不能 | aws sts get-caller-identity を再確認する |
stderr に ExpiredTokenException |
AWS セッションの期限切れ | 再認証するようユーザーに伝える(aws sso login または認証情報の更新) |
AccessDeniedException |
IAM 権限が不足 | ユーザーのロールに DevOps Agent 権限が必要 |
Step 4: 確認と .mcp.json の書き込み
書き込み前に、ユーザーに確認します:
「接続を確認しました。[Bearer Token / SigV4] MCP サーバーをプラグインの
.mcp.jsonに追加します。続行しますか?」
ユーザーの確認後にのみ書き込みを行います。
サーバーエントリは 1 つだけ 書き込んでください(両方は書き込まない)。
MCP 設定は ${CLAUDE_PLUGIN_ROOT}/.mcp.json にインストールします。
ワークスペースレベルへのインストールも提案できます。
インストール先の選択肢は以下の通りです:
- プラグインスコープ:
${CLAUDE_PLUGIN_ROOT}/.mcp.json(デフォルト) - プロジェクトスコープ:
.mcp.json(プロジェクトディレクトリ内、バージョン管理対象) - プロジェクト固有:
.claude/settings.local.json(プロジェクトディレクトリ内)
Bearer Token 設定
{
"mcpServers": {
"aws-devops-agent": {
"type": "http",
"url": "https://connect.aidevops.${DEVOPS_AGENT_REGION}.api.aws/mcp",
"headers": {
"Authorization": "Bearer ${DEVOPS_AGENT_TOKEN}"
},
"timeout": 120000
}
}
}
SigV4 設定
<REGION> をユーザーの実際のリージョンに置き換えてください:
{
"mcpServers": {
"aws-devops-agent": {
"command": "uvx",
"timeout": 120000,
"args": [
"mcp-proxy-for-aws@latest",
"https://connect.aidevops.<REGION>.api.aws/mcp",
"--service", "aidevops",
"--region", "<REGION>"
]
}
}
}
フォールバック(aws-mcp)
プライマリの aws-devops-agent エンドポイントに到達できず、かつ SigV4 認証情報が利用可能な場合にのみ追加してください:
{
"mcpServers": {
"aws-mcp": {
"command": "uvx",
"timeout": 100000,
"args": [
"mcp-proxy-for-aws@latest",
"https://aws-mcp.us-east-1.api.aws/mcp",
"--metadata",
"AWS_REGION=us-east-1"
]
}
}
}
SigV4 のみ: 新しい MCP 設定の書き込み後、MCP サーバーの書き込みが完了したことをユーザーに伝え、次のステップへ進んでください。
Step 5: マルチスペースルーティング(SigV4 のみ)
SigV4 セットアップが成功したら、AgentSpace ルーティングの検出と設定を行います:
- 新しく接続した MCP 経由で
list_agent_spacesを呼び出し、利用可能なスペースを検出する - 一覧をユーザーに提示する
- 複数のスペースが存在する場合は、
.claude/aws-agents-for-devsecops.mdにルーティングガイドを書き込む:
# AWS DevOps Agent — ルーティングガイド
| スペース | Agent Space ID | 用途 |
|-------|----------------|---------|
| <name> | <id> | <ユーザーに確認> |
- 特定のスペースを対象とするツール呼び出しには、毎回
agent_space_idを渡すよう指示する。
Step 6: プラグインの
原文(English)を表示
AWS DevOps Agent — Claude Setup
The instructions below are specifically for setting up the AWS DevOps Agent plugin for Claude applications. For other clients, use this as a reference, but adjust the instructions based on the client's specific requirements.
Step 0: Check if setup is needed
1/ Check if the "aws-devops-agent" MCP server is running. If it is, verify that it has a valid connection (see "Step 3: Verify connectivity").
If verification is successful, you should inform the user that the plugin is already setup using SigV4 or Bearer Token. Offer that you can switch the configuration to Bearer Token or SigV4, see "Step 2: Decide auth path" below for details.
If the user does not want to change their auth configuration, then you are DONE STOP HERE.
2/ Check for an MCP server config with a key "aws-devops-agent" in the following locations:
- Plugin scoped:
${CLAUDE_PLUGIN_ROOT}/.mcp.json - Project-scoped: .mcp.json (in your project directory, version-controlled)
- Project-specific: .claude/settings.local.json (in your project directory)
- User-specific local: ~/.claude/settings.local.json
- User-specific global: ~/.claude/settings.json
- Main Claude.json: ~/.claude.json
- Dedicated MCP file: ~/.claude/mcp_servers.json
Then:
- If
aws-devops-agentkey exists AND the server is connected (tools are available, see "Step 3: Verify connectivity") → Inform the user: "DevOps Agent is already configured and connected."; If Bearer Token is used in the MCP config, suggest that you can alternatively setup the plugin to use SigV4 credentials for the AWS DevOps Agent (multiple agent spaces, admin tooling). If SigV4 credentials are used in the MCP config, suggest that you can alternatively setup the plugin to use Bearer Token credentials for the AWS DevOps Agent (single agent space). - If
aws-devops-agentkey exists but is failing → continue to "Step 1: Diagnose current state" - If
aws-devops-agentkey does NOT exist → continue to "Step 1: Diagnose current state"
Step 1: Diagnose current state
Run these checks:
# Bearer token
echo "DEVOPS_AGENT_TOKEN: $([ -n "$DEVOPS_AGENT_TOKEN" ] && echo 'set' || echo 'not set')"
echo "DEVOPS_AGENT_REGION: ${DEVOPS_AGENT_REGION:-not set}"
# SigV4 dependencies
uvx --version 2>&1
# AWS credentials
aws sts get-caller-identity 2>&1
Determine:
bearer_ready=DEVOPS_AGENT_TOKENis set ANDDEVOPS_AGENT_REGIONis setsigv4_ready=aws sts get-caller-identitysucceeds ANDuvxis installed
Step 2: Decide auth path
After diagnostics, ALWAYS ask the user which path they want — even if only one is available. Present what you found and let them choose.
The user may want to use bearer token if they only have access to the operator app for an agent space.
The user may want to use SigV4 if they use multiple agent spaces and/or have admin permissions to manage agent spaces.
| Bearer ready | SigV4 ready | Action |
|---|---|---|
| yes | yes | "You have both a bearer token and AWS credentials configured. Which would you prefer for the DevOps Agent? Bearer token (single agent space) or AWS credentials / SigV4 (multiple agent spaces and admin tooling)?" |
| yes | no | "You have a bearer token configured. Would you like me to set up the DevOps Agent using your Bearer token (single agent space)? Or would you prefer to configure AWS credentials / SigV4 instead (multiple agent spaces and admin tooling)?" |
| no | yes | "You have valid AWS credentials. Would you like me to set up the DevOps Agent using SigV4 (multiple agent spaces and admin tooling)? Or would you prefer to set up a Bearer token instead (single agent space)?" |
| no | no | "Neither a bearer token nor AWS credentials are configured. Would you like to connect via Bearer token (single agent space) or AWS credentials / SigV4 (multiple agent spaces and admin tooling)?" Then guide them through the chosen path. |
If the user would like to setup a bearer token, refer them to the AWS docs for Connect to DevOps Agent remote servers or walk them through the steps to create a access token from this document.
Do NOT proceed to Step 3 until the user confirms their choice.
Step 3: Verify connectivity
If the "aws-devops-agent" MCP server is already running, check if you can list tools. If you can, then you have verified the connection.
Otherwise, proceed.
Verify BEFORE writing .mcp.json. This confirms the credentials work against the live endpoint. Or use this to verify an existing MCP server config.
Bearer verification
curl -s -w "\nHTTP_STATUS: %{http_code}" \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DEVOPS_AGENT_TOKEN" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' \
"https://connect.aidevops.${DEVOPS_AGENT_REGION}.api.aws/mcp"
| Result | Meaning | Action |
|---|---|---|
HTTP 200 + result.tools array |
Success | Proceed to Step 4 |
| HTTP 401 | Token invalid or expired | Tell user to create a new token in the Operator Web App |
| HTTP 403 | Token scope insufficient | Tell user token needs agent:read + agent:operate scopes |
| Connection refused / timeout | Endpoint unreachable | If SigV4 is available, offer fallback. Otherwise report unavailable. |
SigV4 verification
timeout 30 bash -c '
{
echo "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"initialize\",\"params\":{\"protocolVersion\":\"2024-11-05\",\"capabilities\":{},\"clientInfo\":{\"name\":\"setup-check\",\"version\":\"1.0\"}}}"
sleep 0.5
echo "{\"jsonrpc\":\"2.0\",\"method\":\"notifications/initialized\"}"
sleep 0.5
echo "{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"tools/list\",\"params\":{}}"
sleep 8
} | uvx mcp-proxy-for-aws@latest "https://connect.aidevops.${DEVOPS_AGENT_REGION}.api.aws/mcp" --service aidevops --region "$DEVOPS_AGENT_REGION"
'
Note: The first run may take 10-15s as
uvxdownloadsmcp-proxy-for-awsand its dependencies. Subsequent runs are near-instant.
| Result | Meaning | Action |
|---|---|---|
Second line contains result.tools |
Success | Proceed to Step 4 |
| No output / timeout | Credentials invalid or endpoint unreachable | Check aws sts get-caller-identity again |
ExpiredTokenException in stderr |
AWS session expired | Tell user to re-authenticate (aws sso login or refresh creds) |
AccessDeniedException |
Missing IAM permissions | User needs DevOps Agent permissions on their role |
Step 4: Confirm and write .mcp.json
Before writing, confirm with the user:
"I've verified connectivity. I'll now add the [Bearer token / SigV4] MCP server to the plugin's
.mcp.json. Proceed?"
Only write after the user confirms. Write ONE server entry — never both. Install the MCP config in ${CLAUDE_PLUGIN_ROOT}/.mcp.json. You can also offer to install the MCP server at the workspace level. The installation options are:
- Plugin scoped:
${CLAUDE_PLUGIN_ROOT}/.mcp.json(default) - Project-scoped: .mcp.json (in your project directory, version-controlled)
- Project-specific: .claude/settings.local.json (in your project directory)
Bearer config
{
"mcpServers": {
"aws-devops-agent": {
"type": "http",
"url": "https://connect.aidevops.${DEVOPS_AGENT_REGION}.api.aws/mcp",
"headers": {
"Authorization": "Bearer ${DEVOPS_AGENT_TOKEN}"
},
"timeout": 120000
}
}
}
SigV4 config
Replace <REGION> with the user's actual region:
{
"mcpServers": {
"aws-devops-agent": {
"command": "uvx",
"timeout": 120000,
"args": [
"mcp-proxy-for-aws@latest",
"https://connect.aidevops.<REGION>.api.aws/mcp",
"--service", "aidevops",
"--region", "<REGION>"
]
}
}
}
Fallback (aws-mcp)
Only add if the primary aws-devops-agent endpoint is unreachable AND SigV4 credentials are available:
{
"mcpServers": {
"aws-mcp": {
"command": "uvx",
"timeout": 100000,
"args": [
"mcp-proxy-for-aws@latest",
"https://aws-mcp.us-east-1.api.aws/mcp",
"--metadata",
"AWS_REGION=us-east-1"
]
}
}
}
For Sigv4 only: After writing the new MCP config, inform the user that the MCP server has been written successfully. Proceed to the next step.
Step 5: Multi-space routing (SigV4 only)
After successful SigV4 setup, discover and configure AgentSpace routing:
- Call
list_agent_spacesvia the newly connected MCP to discover available spaces - Present the list to the user
- If multiple spaces exist, write a routing guide to
.claude/aws-agents-for-devsecops.md:
# AWS DevOps Agent — Routing Guide
| Space | Agent Space ID | Purpose |
|-------|----------------|---------|
| <name> | <id> | <ask user> |
- Instruct: pass
agent_space_idon every tool call when targeting a specific space.
Step 6: Reload plugin
Inform the user that they will need to run /reload-plugins to start the new MCP server. You may need to prompt the user to run it. Also mention that after restarting the MCP server they should try the following prompts:
- setup multi-space routing (SigV4 only)
- <list skill and prompt suggestions from ${CLAUDE_PLUGIN_ROOT}/README.md>
Bearer token guidance (for users who need to create one)
-
Open the AWS DevOps Agent Operator Web App for your AgentSpace
-
Navigate to Settings → Access tokens → Generate token
-
Create a token with Permissions:
Operate -
Set environment variables:
export DEVOPS_AGENT_TOKEN="<your-token>" export DEVOPS_AGENT_REGION="<your-region>"Available regions: https://docs.aws.amazon.com/devopsagent/latest/userguide/about-aws-devops-agent-supported-regions.html
-
Restart Claude Code (it reads env vars from the shell that launched it)
Important: Without
Operatepermissions, thechatandinvestigatetools will be completely invisible — not just fail, but absent from the tool list.
SigV4 guidance (for users who need to configure AWS credentials)
-
Install
uvxif not present:- macOS:
brew install uv - Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
- macOS:
-
Configure AWS credentials:
aws configure sso --profile devops-agent aws sso login --profile devops-agent export AWS_PROFILE=devops-agent -
Set the region:
export DEVOPS_AGENT_REGION="<your-region>" -
Verify:
aws sts get-caller-identity -
The IAM role must have DevOps Agent permissions (e.g., managed policy with aidevops access)
Important: Unset
DEVOPS_AGENT_TOKENwhen using SigV4. If both are set, clients may attempt bearer auth instead of the signing proxy.
Troubleshooting
| Error | Cause | Fix |
|---|---|---|
| No tools visible | Token not set or Claude Code not restarted | Set DEVOPS_AGENT_TOKEN + DEVOPS_AGENT_REGION, restart |
| HTTP 401 | Token invalid/expired | Create new token in Operator Web App |
chat/investigate missing |
Token scope is agent:read only |
Create token with agent:operate scope |
| Connection refused / timeout | Endpoint unreachable | Check network; if SigV4 available, offer aws-mcp fallback |
ExpiredTokenException |
AWS session credentials expired | aws sso login or refresh credentials |
AccessDeniedException (SigV4) |
Missing IAM permissions | Use a role with DevOps Agent access |
| Proxy won't start | uvx not installed |
brew install uv (macOS) or install per platform |
| Tools appear but calls timeout | Normal for chat (5-30s) |
Ensure "timeout": 120000 in mcp.json |
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。