awslabs / awslabs/agentcore-samples

Amazon Bedrock AgentCore Samples - [Bug]

Open
#89 6 comments 0 reactions 0 assignees View on GitHub
01-AgentCore-runtime 01-tutorials bug
Dominant language
Python
Stars
3.4k
Forks
1.3k
Avg merge
1d 22h
Merged PRs (30d)
30

Description

**Describe the bug**
Running from us-west-2:

In 01-tutorials/01-AgentCore-runtime/02-hosting-MCP-server/hosting_mcp_server.ipynb, invoking the remote MCP server test failed. In addition, the error message did not convey the underlying issue:

Here's the stacktrace of the error:

Testing deployed MCP server...
==================================================
Using AWS region: us-west-2
Retrieved Agent ARN: arn:aws:bedrock-agentcore:us-west-2:xxxxxxxx:runtime/mcp_server-4jYLS0BaZ6
✓ Retrieved bearer token from Secrets Manager

Connecting to: https://bedrock-agentcore.us-west-2.amazonaws.com/runtimes/arn%3Aaws%3Abedrock-agentcore%3Aus-west-2%3A602900100639%3Aruntime%2Fmcp_server-4jYLS0BaZ6/invocations?qualifier=DEFAULT
Headers configured ✓

🔄 Initializing MCP session...
Error parsing JSON response
Traceback (most recent call last):
File "/Users/weteh/dev/projects/aws/beta/agentcore/amazon-bedrock-agentcore-samples/.venv/lib/python3.10/site-packages/mcp/client/streamable_http.py", line 305, in _handle_json_response
message = JSONRPCMessage.model_validate_json(content)
File "/Users/weteh/dev/projects/aws/beta/agentcore/amazon-bedrock-agentcore-samples/.venv/lib/python3.10/site-packages/pydantic/main.py", line 746, in model_validate_json
return cls.__pydantic_validator__.validate_json(
pydantic_core._pydantic_core.ValidationError: 1 validation error for JSONRPCMessage
Invalid JSON: expected value at line 1 column 116 [type=json_invalid, input_value=b'{"jsonrpc":"2.0","error...4a1c-bf64-8f45f8ddddf9}', input_type=bytes]
For further information visit https://errors.pydantic.dev/2.11/v/json_invalid

The actual issue is an internal server error, but the jsonb payload is formatted incorrectly:

Here's the jsonb payload:
b'{"jsonrpc":"2.0","error":{"code":-32603,"message":"An internal error occurred while processing the request."},"id":e0fa7aa2-98c9-4a1c-bf64-8f45f8ddddf9}'

**To Reproduce**
Steps to reproduce the behavior (or some version of this):
Run 01-tutorials/01-AgentCore-runtime/02-hosting-MCP-server/hosting_mcp_server.ipynb

**Expected behavior**
The remote MCP server test should succeed.

**Screenshots**
n/a

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.