Token导航 LogoToken导航TokenDH.com
Bedrock Agentcore Strands MCP Runtime logo
运维云端stdio官方级别未说明来源级核验

Bedrock Agentcore Strands MCP Runtime

MCP Server

一个基于AWS Bedrock的AgentCore运行时平台,集成了Strands代理、Atlassian MCP工具、Cognito认证的流式聊天前端,以及Terraform基础设施管理。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
PythonClaude云端部署Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Kjeff24

提供方

Kjeff24

最后核验

2026/5/17 20:20

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

python scripts/invoke.py "What is the weather today?" --runtime-arn $RUNTIME_ARN

详细介绍

AgentCore运行时平台

生产就绪的AWS Bedrock AgentCore运行时,使用Strands代理与Atlassian MCP工具集成,Cognito经过身份验证的流式聊天前端,以及用于ECR、网关、内存和Cognito的Terraform基础设施。

此存储库部署了什么

  • 基岩代理Core运行Strands代理时
  • AgentCore网关和MCP目标配置
  • 用于会话和长期上下文的AgentCore内存
  • Cognito用户池+OIDC应用程序客户端,用于前端身份验证
  • 使用Cognito代币保护的Angular流媒体聊天前端
  • ECR存储库和ARM64容器映像工作流

结构

src/
└── agentcore_strands/
    ├── __init__.py
    └── agent.py          # Strands agent with memory support

scripts/
└── invoke.py             # Script to invoke deployed runtime

push-to-ecr.sh            # Script to build and push Docker image to ECR

examples/
├── agent.local.py        # Local development example
└── example.local.md

infra/terraform/
├── cognito/
├── gateway/
├── memory/
├── runtime/
└── ecr/

docs/
├── AUTHENTICATION.md
├── JWT_TOKEN_GUIDE.md
├── CLOUDWATCH_LOGS.md
├── ATLASSIAN_MCP_INTEGRATION_BACKEND.md
├── ATLASSIAN_MCP_INTEGRATION_FRONTEND.md
├── strands-agent-integration.md
└── runtime-gateway-integration.md

frontend/                 # Angular chat client for runtime integration

Dockerfile            # Container image for AgentCore Runtime
pyproject.toml        # uv dependency management

快速开始

1.部署ECR存储库

cd infra/terraform/ecr
terraform init
terraform apply -var="repository_name=agentvault_agent"

2.构建并推送Docker镜像

export AWS_REGION=eu-west-1
export ECR_REPO_NAME=agentvault_agent
./push-to-ecr.sh

在Terraform、Docker推送和运行时部署中使用相同的存储库名称和区域。

3.部署网关

cd infra/terraform/gateway
terraform init
terraform apply

4.部署内存

cd infra/terraform/memory
terraform init
terraform apply -var="memory_name=my_agent_memory"

5.部署Cognito

cd infra/terraform/cognito
terraform init
terraform apply

6.部署运行时

使用Gateway、Memory和Cognito JWT授权值部署运行时:

GATEWAY_ID=$(cd infra/terraform/gateway && terraform output -raw gateway_id)
MEMORY_ID=$(cd infra/terraform/memory && terraform output -raw memory_id)
JWT_ISSUER=$(cd infra/terraform/cognito && terraform output -raw cognito_authority)
JWT_AUDIENCE=$(cd infra/terraform/cognito && terraform output -raw user_pool_client_id)

cd infra/terraform/runtime
terraform init
terraform apply \
  -var="container_image_uri=ACCOUNT.dkr.ecr.eu-west-1.amazonaws.com/agentvault_agent:latest" \
  -var="gateway_id=$GATEWAY_ID" \
  -var="memory_id=$MEMORY_ID" \
  -var="jwt_issuer=$JWT_ISSUER" \
  -var="jwt_audience=$JWT_AUDIENCE"

地形部署

网关

基本网关(无MCP服务器):

cd infra/terraform/gateway
terraform init
terraform apply

网关+带API密钥的MCP服务器:

# Store API key in Secrets Manager
aws secretsmanager create-secret \
  --name mcp-api-key \
  --secret-string "your-api-key"

# Deploy
terraform apply \
  -var="add_mcp_target=true" \
  -var="mcp_server_endpoint=https://your-mcp-server.com" \
  -var="mcp_auth_type=API_KEY" \
  -var='mcp_api_key_config={secret_arn="arn:aws:secretsmanager:REGION:ACCOUNT:secret:mcp-api-key"}'

带有OAuth的网关+MCP服务器:

terraform apply \
  -var="add_mcp_target=true" \
  -var="mcp_server_endpoint=https://your-mcp-server.com" \
  -var="mcp_auth_type=OAUTH" \
  -var='mcp_oauth_config={provider_vendor="GoogleOauth2",client_id="your-id",client_secret="your-secret",scopes=["read","write"]}'

带IAM的网关+MCP服务器:

terraform apply \
  -var="add_mcp_target=true" \
  -var="mcp_server_endpoint=https://your-mcp-server.com" \
  -var="mcp_auth_type=IAM"

运行时

部署(生产):

cd infra/terraform/runtime
terraform init

GATEWAY_ID=$(cd ../gateway && terraform output -raw gateway_id)
MEMORY_ID=$(cd ../memory && terraform output -raw memory_id)
JWT_ISSUER=$(cd ../cognito && terraform output -raw cognito_authority)
JWT_AUDIENCE=$(cd ../cognito && terraform output -raw user_pool_client_id)

terraform apply \
  -var="container_image_uri=123456789012.dkr.ecr.eu-west-1.amazonaws.com/agentvault_agent:latest" \
  -var="gateway_id=$GATEWAY_ID" \
  -var="memory_id=$MEMORY_ID" \
  -var="jwt_issuer=$JWT_ISSUER" \
  -var="jwt_audience=$JWT_AUDIENCE"

认知

部署:

cd infra/terraform/cognito
terraform init
terraform apply

获取前端/运行时连接的输出:

cd infra/terraform/cognito
terraform output user_pool_id
terraform output user_pool_client_id
terraform output cognito_authority
terraform output user_pool_domain

记忆

基本内存(仅STM):

cd infra/terraform/memory
terraform init
terraform apply -var="memory_name=my_agent_memory"

使用语义策略:

terraform apply \
  -var="memory_name=my_agent_memory" \
  -var='strategies=[{name="semantic-strategy",type="SEMANTIC",namespaces=["default"]}]'

使用所有内置策略:

terraform apply \
  -var="memory_name=my_agent_memory" \
  -var='strategies=[{name="semantic",type="SEMANTIC",namespaces=["default"]},{name="summary",type="SUMMARIZATION",namespaces=["{sessionId}"]},{name="user-pref",type="USER_PREFERENCE",namespaces=["preferences"]}]'

使用自定义策略:

terraform apply \
  -var="memory_name=my_agent_memory" \
  -var='strategies=[{name="custom-semantic",type="CUSTOM",namespaces=["{sessionId}"],configuration={type="SEMANTIC_OVERRIDE",consolidation={append_to_prompt="Focus on key relationships",model_id="anthropic.claude-3-sonnet-20240229-v1:0"}}}]'

ECR

创建存储库:

cd infra/terraform/ecr
terraform init
terraform apply -var="repository_name=agentvault_agent"

获取网关URL

cd infra/terraform/gateway
terraform output gateway_url

调用运行时

部署运行时后,使用以下命令进行测试:

# Get runtime ARN
cd infra/terraform/runtime
RUNTIME_ARN=$(terraform output -raw runtime_arn)

# Invoke with a prompt
python scripts/invoke.py "What is the weather today?" --runtime-arn $RUNTIME_ARN

# Continue conversation with session ID
python scripts/invoke.py "Tell me more" --runtime-arn $RUNTIME_ARN --session-id user123

# If your runtime is outside eu-west-1, pass --region
python scripts/invoke.py "Hello" --runtime-arn $RUNTIME_ARN --region us-east-1

配置前端

复制和编辑前端环境文件:

cp frontend/src/environments/environment.example.ts frontend/src/environments/environment.ts
cp frontend/src/environments/environment.prod.example.ts frontend/src/environments/environment.prod.ts

从Terraform输出中填充这些值:

  • agentcore.runtimeUrl 从运行时调用URL
  • cognito.authorityinfra/terraform/cognito 输出 cognito_authority
  • cognito.clientIdinfra/terraform/cognito 输出 user_pool_client_id
  • cognito.userPoolDomaininfra/terraform/cognito 输出 user_pool_domain

在本地运行前端:

cd frontend
npm install
npm start

文档

需求

  • AWS CLI已配置
  • 地形>=1.0
  • Python>=3.10
  • Node.js>=18
  • 创建IAM角色、基岩资源的权限
  • 对于运行时:ECR容器映像 /ping/invocations 端口8080上的端点

CI/CD

  • 部署工作流:
  • 销毁工作流:
  • 完整设置指南:

当前工作流行为:

  • 已配置部署 workflow_dispatch (手动运行)默认情况下。
  • 推触发应用程序被故意禁用 branches: [none].
  • 在当前工作流文件中,Terraform apply 台阶只能在 pushmain,因此手动运行验证/构建,但不应用基础架构,除非您对其进行调整 if 条件。

目录标签

目录标签

PythonClaude云端部署HCL本地部署AWSBedrock代理运行时Terraform部署Cognito认证流式聊天

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

oauth

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiooauth部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP