Skip to content

Commit 6482120

Browse files
committed
remove redundant check for initialize and session
1 parent dd007d7 commit 6482120

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

src/mcp/client/streamableHttp.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -111,27 +111,7 @@ async def post_writer():
111111
continue
112112
# Check for 404 (session expired/invalid)
113113
if response.status_code == 404:
114-
if is_initialization and session_id:
115-
logger.info(
116-
"Session expired, retrying without ID"
117-
)
118-
session_id = None
119-
post_headers.pop(
120-
MCP_SESSION_ID_HEADER, None
121-
)
122-
# Retry with client.stream
123-
async with client.stream(
124-
"POST",
125-
url,
126-
json=message.model_dump(
127-
by_alias=True,
128-
mode="json",
129-
exclude_none=True,
130-
),
131-
headers=post_headers,
132-
) as new_response:
133-
response = new_response
134-
elif isinstance(message.root, JSONRPCRequest):
114+
if isinstance(message.root, JSONRPCRequest):
135115
jsonrpc_error = JSONRPCError(
136116
jsonrpc="2.0",
137117
id=message.root.id,

0 commit comments

Comments
 (0)