mjolnir-strike opened a new issue, #1461:
URL: https://github.com/apache/flink-agents/issues/1461

   ### Search before asking
   
   - [x] I searched in the 
[issues](https://github.com/apache/flink-agents/issues) and found nothing 
similar.
   
   ### Description
   
   `MCPServer` in `python/flink_agents/integrations/mcp/mcp.py` connects with 
`mcp.client.streamable_http.streamablehttp_client(url=..., headers=..., 
timeout=..., sse_read_timeout=..., auth=...)`. The MCP Python SDK deprecated 
that function in 1.24.0 in favour of `streamable_http_client(url, 
http_client=...)`, where headers, timeouts and auth are configured on an 
`httpx.AsyncClient`.
   
   **Why it matters**
   
   - With the currently resolved `mcp` 1.30.0, every connection emits 
`DeprecationWarning: Use streamable_http_client instead.` It shows up 3 times 
in `flink_agents/integrations/mcp/tests/test_mcp.py`.
   - `mcp` 2.x removes `streamablehttp_client` entirely (checked against 
v2.3.0), so this call is one of the things keeping `mcp<2` in 
`python/pyproject.toml`.
   
   **Proposed change (Python only)**
   
   - Build the client explicitly and pass it in:
     ```python
     http_client = httpx.AsyncClient(
         headers=self.headers,
         timeout=httpx.Timeout(
             self.timeout.total_seconds(), 
read=self.sse_read_timeout.total_seconds()
         ),
         auth=self.auth,
     )
     ```
     then `streamable_http_client(url=self.endpoint, http_client=http_client)`, 
closing the client in the same `async with`. In 1.24+, the deprecated wrapper 
builds exactly this client (`create_mcp_http_client` is a plain 
`httpx.AsyncClient(timeout=..., headers=..., auth=...)`), so timeout, header, 
auth and redirect behavior stay the same.
   - Raise the lower bound from `mcp>=1.8.0` to `mcp>=1.24.0`, the first 
version with `streamable_http_client`. The `<2` upper bound stays.
   - Keep the existing `test_mcp.py` coverage, and add a check that connecting 
no longer emits the `DeprecationWarning`.
   
   **Out of scope:** moving to `mcp` 2.x. That release also changes 
`ClientSession(read_timeout_seconds=...)` from `timedelta` to `float`, so it is 
a separate step. The Java integration is not affected: it uses the Java MCP 
SDK's `HttpClientStreamableHttpTransport`.
   
   **Question for committers:** is raising the minimum `mcp` version to 1.24.0 
acceptable before 1.0?
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to