Wire AWS MCP Server via mcp-proxy-for-aws
This commit is contained in:
@@ -71,6 +71,22 @@ from tools.code_interpreter import run_code
|
||||
|
||||
app = BedrockAgentCoreApp()
|
||||
|
||||
_aws_mcp_client = None
|
||||
_aws_mcp_tools = []
|
||||
try:
|
||||
from strands.tools.mcp import MCPClient
|
||||
from mcp_proxy_for_aws.client import aws_iam_streamablehttp_client
|
||||
_aws_mcp_client = MCPClient(
|
||||
lambda: aws_iam_streamablehttp_client(config.AWS_MCP_URL)
|
||||
)
|
||||
_aws_mcp_client.start()
|
||||
_aws_mcp_tools = [_aws_mcp_client]
|
||||
print('[main] AWS MCP client connected')
|
||||
except Exception as _e:
|
||||
import traceback
|
||||
print(f'[main] AWS MCP client failed: {type(_e).__name__}: {_e}')
|
||||
print(traceback.format_exc())
|
||||
|
||||
|
||||
# ── Tool definitions ──────────────────────────────────────────────────────
|
||||
|
||||
@@ -481,7 +497,7 @@ async def main(payload: dict, context):
|
||||
_now = datetime.now(_tz)
|
||||
_time_str = _now.strftime('%A, %B %d, %Y %I:%M %p %Z')
|
||||
system_prompt = system_prompt + f'\n\nCurrent date/time: {_time_str}'
|
||||
system_prompt = system_prompt + '\n\nNative AWS tools available: aws_list_lambda_functions, aws_get_cost_and_usage, aws_describe_service. Use these directly for AWS API calls — NEVER use run_code for AWS queries.'
|
||||
system_prompt += 'AWS access: Native boto3 tools available (aws_list_lambda_functions, aws_get_cost_and_usage, aws_describe_service). If AWS MCP Server connected at startup: call_aws (any AWS API), search_documentation, read_documentation, run_script also available.'
|
||||
print(f'[main] System prompt time injection: {_time_str}')
|
||||
|
||||
# Model: claude-sonnet-4-6 via cross-region inference
|
||||
@@ -504,7 +520,7 @@ async def main(payload: dict, context):
|
||||
mcp_connections = services.get('mcp_connections', [])
|
||||
mcp_clients, _mcp_to_close = mcp_loader.load_mcp_tools(mcp_connections, actor_id)
|
||||
|
||||
all_tools = base_tools + mcp_clients
|
||||
all_tools = base_tools + _aws_mcp_tools + mcp_clients
|
||||
|
||||
agent = Agent(
|
||||
model=model,
|
||||
|
||||
Reference in New Issue
Block a user