Skip to content

fix(python): preserve zero MCP streamable HTTP timeouts - #14288

Open
King Star (jstar0) wants to merge 1 commit into
microsoft:mainfrom
jstar0:fix/mcp-streamable-http-zero-timeouts
Open

fix(python): preserve zero MCP streamable HTTP timeouts#14288
King Star (jstar0) wants to merge 1 commit into
microsoft:mainfrom
jstar0:fix/mcp-streamable-http-zero-timeouts

Conversation

@jstar0

Copy link
Copy Markdown
Contributor

Description

Preserve explicit zero timeout values for streamable HTTP MCP connections in the Python connector instead of falling back to the default timeout.

Validation

  • Existing focused validation for this branch is green.

@jstar0
King Star (jstar0) requested a review from a team as a code owner August 15, 2026 00:58
Copilot AI lite review requested due to automatic review settings August 15, 2026 00:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR fixes MCP Streamable HTTP client argument forwarding so explicitly provided zero timeouts (0.0) are passed through, and adds a regression test to prevent reintroducing the bug.

Changes:

  • Update MCPStreamableHttpPlugin.get_mcp_client() to forward timeout / sse_read_timeout when they are 0.0 by checking is not None.
  • Add a unit test that asserts timeout=0.0 and sse_read_timeout=0.0 are forwarded to streamablehttp_client.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
python/tests/unit/connectors/mcp/test_mcp.py Adds regression coverage ensuring zero timeouts are forwarded to the underlying client factory.
python/semantic_kernel/connectors/mcp.py Fixes argument construction to include explicit zero values for timeouts.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +380 to +381
@patch("semantic_kernel.connectors.mcp.streamablehttp_client")
def test_streamable_http_client_forwards_zero_timeouts(mock_client):

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAF Automated Review — Iteration 1

Result: No findings
Scope: full PR (1 commit(s)): a05c6a15f445
Model: claude-opus-4.8

Overview

This is a minimal, correctly-scoped bug fix that changes two guards in
MCPStreamableHttpPlugin.get_mcp_client() from truthiness (if self.timeout:)
to explicit is not None, so an explicitly-configured timeout=0.0 /
sse_read_timeout=0.0 is forwarded to the MCP client instead of being dropped in
favor of the SDK defaults. The change brings the streamable-HTTP plugin into
parity with the pre-existing SSE plugin behavior (mcp.py:804-806), preserves the
None "omit-and-use-defaults" path (guarded by the existing
test_with_kwargs_streamablehttp), and is locked by a new focused test. No
untrusted input can reach these developer-supplied configuration values, and in
the pinned mcp->httpx chain a forwarded 0.0 yields an immediate timeout rather
than an infinite one, so there is no denial-of-service exposure. No publishable
defect was found.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants