Initial Checks
Description
Description
When using the python-sdk with transport set to streamable-http, the connection to a remote MCP server deployed on Google Cloud Run does not establish. The API stays in a pending state, and no updates are received.
However, the same MCP server works fine under the following conditions:
- When accessed via Google Cloud Proxy
- When transport is changed to SSE
- When using the JS SDK, streamable-http transport works without issues
This suggests a compatibility or configuration issue specifically between python-sdk's streamable-http transport and direct access to Cloud Run URLs.
Reproduction Steps
- Deploy an MCP server to Cloud Run using this official guide:
https://cloud.google.com/blog/topics/developers-practitioners/build-and-deploy-a-remote-mcp-server-to-google-cloud-run-in-under-10-minutes
- Use:
- Transport:
streamable-http
- Endpoint: Public URL of Cloud Run MCP server
- Attempt to connect using <cloud_run_url>/mcp
- Observe: API status remains in
pending and no data is received
Observations
- Switching transport to SSE resolves the issue.
- Using a Cloud Proxy to access the MCP server also works with streamable-http.
- JS SDK does not face this issue under the same deployment conditions.
- The Cloud Run URL is publicly accessible and works with other tools.
Environment
- SDK:
python-sdk (v1.9.4)
- MCP Server: Deployed on Cloud Run
- Python version: [3.12.11]
- OS - Docker image: [linux/amd64]
Expected Behavior
The SDK should establish a connection to the Cloud Run-hosted MCP server and transition the API status from pending to active.
Additional Notes
This might point to either:
- SDK's HTTP streaming implementation not being fully compatible with Cloud Run’s networking behavior
- Some internal headers or keep-alive expectations that differ between SSE and streamable-http
Any guidance, workaround, or fix would be appreciated.
Example Code
from mcp.server.fastmcp import FastMCP
# Create server
mcp = FastMCP("Echo Server")
@mcp.tool()
def echo(text: str) -> str:
"""Echo the input text"""
return text
def main():
mcp.run(transport="streamable-http", host="0.0.0.0", port=8080)
if __name__ == "__main__":
main()
Python & MCP Python SDK
SDK Version: 1.9.4
Python Version: 3.12.11
Initial Checks
Description
Description
When using the
python-sdkwith transport set tostreamable-http, the connection to a remote MCP server deployed on Google Cloud Run does not establish. The API stays in a pending state, and no updates are received.However, the same MCP server works fine under the following conditions:
This suggests a compatibility or configuration issue specifically between
python-sdk's streamable-http transport and direct access to Cloud Run URLs.Reproduction Steps
https://cloud.google.com/blog/topics/developers-practitioners/build-and-deploy-a-remote-mcp-server-to-google-cloud-run-in-under-10-minutes
streamable-httppendingand no data is receivedObservations
Environment
python-sdk(v1.9.4)Expected Behavior
The SDK should establish a connection to the Cloud Run-hosted MCP server and transition the API status from pending to active.
Additional Notes
This might point to either:
Any guidance, workaround, or fix would be appreciated.
Example Code
Python & MCP Python SDK