awslabs / awslabs/agentcore-samples
[Help] MCP tools load successfully locally but not in Bedrock AgentCore Runtime with langgraph framework(only manual tools appear)
- Dominant language
- Python
- Stars
- 3.4k
- Forks
- 1.3k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 30
Description
## Summary
MCP tools from a FastMCP.cloud server load correctly when running the agent locally, but when the same code is deployed to Amazon Bedrock AgentCore Runtime, the MCP tools are not loaded — only the manually defined @tool functions are available.
```
I have a LangGraph-based agent using BedrockAgentCoreApp that dynamically loads tools from an external MCP server via MultiServerMCPClient.
Locally:
await get_mcp_tools() succeeds.
MCP tools (including echo_tool and any custom tools added in FastMCP dashboard) are loaded and available to the agent.
In AgentCore Runtime (deployed):
Outbound HTTPS works (tested with a tool that calls https://httpbin.org/json — succeeds).
MCP tool loading silently fails — mcp_tools becomes [].
Only the two manual tools (calculate_tax and test_httpbin_json) are available.
No error is printed in CloudWatch logs (the print statements in get_mcp_tools() do not appear, or the exception is caught and returns empty list).
## Details
MCP_CONFIG = {
"weather": {
"transport": "streamable_http",
"url": "https://missing-amber-blackbird.fastmcp.app/mcp",
"headers": {
"Accept": "application/json, text/event-stream",
"User-Agent": "Mozilla/5.0 (compatible; LangChain-MCP/1.0)"
}
}
}
async def get_mcp_tools():
global _mcp_tools_cache
if _mcp_tools_cache is not None:
return _mcp_tools_cache
try:
from langchain_mcp_adapters.client import MultiServerMCPClient
print("Loading MCP tools...")
client = MultiServerMCPClient(MCP_CONFIG)
_mcp_tools_cache = await client.get_tools()
print(f"Loaded {len(_mcp_tools_cache)} MCP tools")
return _mcp_tools_cache
except Exception as e:
print(f"⚠ MCP tools disabled: {e}")
import traceback
traceback.print_exc()
return []
## Expected Behavior
MCP tools should load in AgentCore Runtime exactly as they do locally, and be bound to the LLM / available in the graph.
## Additional Context
FastMCP server URL: https://missing-amber-blackbird.fastmcp.app/mcp (publicly accessible, works from local machine).
Runtime has outbound internet access (confirmed via requests.get("https://httpbin.org/json") in a tool).
No VPC private subnet restrictions suspected (outbound calls succeed).
Possibly related to httpx behavior in AgentCore microVM environment (headers, TLS, or IP blocking by FastMCP firewall).
Any guidance on debugging tool loading in AgentCore Runtime or known issues with external MCP servers would be greatly appreciated.
Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.