Skip to content

Commit 76d9e34

Browse files
committed
Inline the OK status code
1 parent 9194e0c commit 76d9e34

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

‎src/mcp/server/_streamable_http_modern.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@
7777
logger = logging.getLogger(__name__)
7878

7979

80-
_OK_STATUS = 200
81-
82-
8380
@dataclass
8481
class _SingleExchangeDispatchContext:
8582
"""`DispatchContext` for one inbound HTTP request.
@@ -181,7 +178,7 @@ async def _write(
181178
send: Send,
182179
) -> None:
183180
"""Serialise a JSON-RPC reply with the table-mapped HTTP status."""
184-
status = ERROR_CODE_HTTP_STATUS.get(msg.error.code, _OK_STATUS) if isinstance(msg, JSONRPCError) else _OK_STATUS
181+
status = ERROR_CODE_HTTP_STATUS.get(msg.error.code, 200) if isinstance(msg, JSONRPCError) else 200
185182
body = msg.model_dump(mode="json", by_alias=True, exclude_none=True)
186183
if isinstance(msg, JSONRPCError) and msg.id is None:
187184
# JSON-RPC requires `id: null` to appear on the wire when the request
@@ -508,7 +505,7 @@ async def watch_disconnect(cancel_scope: anyio.CancelScope) -> None:
508505
await send(
509506
{
510507
"type": "http.response.start",
511-
"status": _OK_STATUS,
508+
"status": 200,
512509
"headers": [
513510
(b"content-type", b"text/event-stream"),
514511
(b"cache-control", b"no-cache, no-transform"),

0 commit comments

Comments
 (0)