This is an automated email from the ASF dual-hosted git repository. xtsong pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/flink-agents.git
commit 2ddf2e26bd68348e71b4dbe2f43f8bfab2ebdd25 Author: youjin <[email protected]> AuthorDate: Mon Jan 19 18:59:41 2026 +0800 [feature] Unified MCP parameter names in Python and Java --- python/flink_agents/integrations/mcp/mcp.py | 10 +++++----- python/flink_agents/integrations/mcp/tests/test_mcp.py | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/python/flink_agents/integrations/mcp/mcp.py b/python/flink_agents/integrations/mcp/mcp.py index 79cf26f4..a15c4b3d 100644 --- a/python/flink_agents/integrations/mcp/mcp.py +++ b/python/flink_agents/integrations/mcp/mcp.py @@ -144,8 +144,8 @@ class MCPServer(Resource, ABC): # HTTP connection parameters endpoint: str headers: Dict[str, Any] | None = None - timeout: timedelta = timedelta(seconds=30) - sse_read_timeout: timedelta = timedelta(seconds=60 * 5) + timeout: int = 30 + sse_read_timeout: int = 60*5 auth: httpx.Auth | None = None session: ClientSession = Field(default=None, exclude=True) @@ -190,8 +190,8 @@ class MCPServer(Resource, ABC): async with streamablehttp_client( url=self.endpoint, headers=self.headers, - timeout=self.timeout, - sse_read_timeout=self.sse_read_timeout, + timeout=timedelta(seconds=self.timeout), + sse_read_timeout=timedelta(seconds=self.sse_read_timeout), auth=self.auth, ) as (read, write, _), ClientSession( read, @@ -218,7 +218,7 @@ class MCPServer(Resource, ABC): arguments = kwargs if kwargs else (args[0] if args else {}) result = await session.call_tool( - tool_name, arguments, read_timeout_seconds=self.timeout + tool_name, arguments, read_timeout_seconds=timedelta(seconds=self.timeout), ) content = [extract_mcp_content_item(item) for item in result.content] diff --git a/python/flink_agents/integrations/mcp/tests/test_mcp.py b/python/flink_agents/integrations/mcp/tests/test_mcp.py index 6e5aa3cb..46ae0315 100644 --- a/python/flink_agents/integrations/mcp/tests/test_mcp.py +++ b/python/flink_agents/integrations/mcp/tests/test_mcp.py @@ -18,7 +18,6 @@ import multiprocessing import runpy import time -from datetime import timedelta from pathlib import Path from urllib.parse import parse_qs, urlparse @@ -108,7 +107,7 @@ def test_serialize_mcp_server() -> None: # noqa:D103 mcp_server = MCPServer( endpoint="http://localhost:8080", auth=oauth_auth, - timeout=timedelta(seconds=5), + timeout=5, ) data = mcp_server.model_dump_json(serialize_as_any=True)
