1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

MCP Proxy for AWS で AWS SigV4 認証を使用して Amazon Bedrock AgentCore Runtime に接続する

1
Posted at

Model Context Protocol (MCP) Proxy for AWS とは?

MCP クライアントが AWS SigV4 認証を使用して AWS がホストするリモート MCP サーバーへ接続できるようにするクライアント側プロキシ。

ということは、先日 Cognito で Amazon Bedrock AgentCore Runtime に接続していたが、このプロキシを使えば、Amazon Bedrock AgentCore Gateway または Runtime 上に構築された MCP サーバーへ SigV4 認証を使用して接続するのも可能か?

GitHub の README にも以下の通り記載がある。

Claude Desktop や Amazon Q Developer CLI などの MCP クライアントを IAM 認証情報を使用して AWS 上の MCP サーバーに接続します。


やってみる

下準備

まず、前回の記事を参考に以下項目を実施し、Amazon Bedrock Agentcore Runtime をデプロイしておきます。
*Amazon Bedrock AgentCore Runtime の設定ファイルの作成で、「Aythorization Configration」を「no」で選択する以外は同じです。
スクリーンショット 2025-11-18 19.14.42.png

  • 準備するソースコード と requirements
  • bedrock-agentcore-starter-toolkit
  • Amazon Bedrock AgentCore Runtime の設定ファイルの作成
  • Amazon Bedrock AgentCore Runtime のデプロイ

SigV4 MCP endpoint URL の取得

次のコマンドで、<SigV4 MCP endpoint URL> を取得します。

mcp_url.py
agent_arn = "<Bedrock AgentCore Runtime の ARN>"
encoded_arn = agent_arn.replace(':', '%3A').replace('/', '%2F')
mcp_url = f"https://bedrock-agentcore.us-west-2.amazonaws.com/runtimes/{encoded_arn}/invocations?qualifier=DEFAULT"
print(f"MCP_URL: {mcp_url}")

インストール

インストールは、3 種類あるようです。

  • PyPiの使用
uvx mcp-proxy-for-aws@latest "<SigV4 MCP endpoint URL>"
  • ローカルリポジトリの使用
git clone https://github.com/aws/mcp-proxy-for-aws.git
cd mcp-proxy-for-aws
uv run mcp_proxy_for_aws/server.py <SigV4 MCP endpoint URL>
  • Dockerの使用
git clone https://github.com/aws/mcp-proxy-for-aws.git
cd mcp-proxy-for-aws
uv run mcp_proxy_for_aws/server.py <SigV4 MCP endpoint URL>

今回は mcp.json を次の通り修正します。

.mcp.json
{
  "mcpServers": {
    "test-mcp": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "mcp-proxy-for-aws@latest",
        "<SigV4 MCP endpoint URL>",
        "--service",
        "bedrock-agentcore",
        "--profile",
        "default",
        "--region",
        "us-west-2",
        "--log-level",
        "INFO"
      ]
    }
  }
}

動作確認

/mcp コマンドで MCP サーバーのツールが動作していることを確認します。
スクリーンショット 2025-11-18 22.55.56.png

では、最後に MCP サーバーのツールが動作しているか確認します。
スクリーンショット 2025-11-18 22.57.15.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?