Skip to content

Local MCP Server for Remote MCP Server on AgentCore Runtime with Sig v4

Notifications You must be signed in to change notification settings

mackee/acruntime2mcp

Repository files navigation

acruntime2mcp

Amazon Bedrock AgentCore Runtime にデプロイされた MCP サーバーへ、stdio 経由で接続するプロキシです。

Claude Desktop や Cline などの MCP クライアントから、AgentCore Runtime 上の MCP サーバーをローカルのコマンドとして利用できます。

機能

  • AgentCore Runtime へのリクエスト転送(SigV4 認証付き)
  • 起動時ハンドシェイク(initialize)による疎通確認
  • event-stream / SSE 応答の自動展開
  • Runtime endpoint ARN / endpoint 名の指定に対応

必要要件

  • Go 1.25.6 以上
  • AWS 認証情報(~/.aws/credentials、環境変数、IAM ロール等)

インストール

go install github.com/mackee/acruntime2mcp@latest

またはソースからビルド:

git clone https://github.com/mackee/acruntime2mcp.git
cd acruntime2mcp
go build -o acruntime2mcp .

使い方

Runtime endpoint ARN を指定する(推奨)

acruntime2mcp arn:aws:bedrock-agentcore:ap-northeast-1:123456789012:runtime/my-runtime/runtime-endpoint/dev

endpoint ARN を渡すと、内部で runtime ARN と endpoint 名に自動分解されます。

Runtime ARN + endpoint 名を指定する

acruntime2mcp --endpoint-name dev arn:aws:bedrock-agentcore:ap-northeast-1:123456789012:runtime/my-runtime

Runtime ARN のみ(endpoint 指定なし)

acruntime2mcp arn:aws:bedrock-agentcore:ap-northeast-1:123456789012:runtime/my-runtime

オプション

オプション 説明
--endpoint-arn Runtime endpoint ARN を指定(内部で runtime ARN と endpoint 名に分解)
--endpoint-name Endpoint 名を指定(Qualifier として使用)
-h, --help ヘルプ表示

MCP クライアントでの設定例

Claude Desktop

claude_desktop_config.json:

{
  "mcpServers": {
    "my-agent": {
      "command": "acruntime2mcp",
      "args": [
        "arn:aws:bedrock-agentcore:ap-northeast-1:123456789012:runtime/my-runtime/runtime-endpoint/dev"
      ]
    }
  }
}

実行の流れ

  1. AgentCore Runtime に対して initialize を実行し疎通を確認
  2. ハンドシェイク成功後に stdio 受付を開始
  3. MCP クライアントからのリクエスト(tools/list, tools/call 等)を AgentCore Runtime に転送
  4. 応答が event-stream / SSE 形式の場合は JSON に変換して返却

テスト

go test ./...

実環境での統合テスト

AGENTCORE_ENDPOINT_ARN=arn:aws:bedrock-agentcore:ap-northeast-1:123456789012:runtime/my-runtime/runtime-endpoint/dev \
  go test -run TestEndpointQualifiedInitializeAndToolsList -v

ライセンス

MIT

About

Local MCP Server for Remote MCP Server on AgentCore Runtime with Sig v4

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages