Skip to content

Commit f5f9c67

Browse files
Theodor N. EngøyTheodor N. Engøy
authored andcommitted
tests: cover MCPServer max_body_bytes passthrough
1 parent 213a374 commit f5f9c67

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/server/mcpserver/test_server.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,23 @@ async def test_sse_app_returns_starlette_app(self):
7777
assert sse_routes[0].path == "/sse"
7878
assert mount_routes[0].path == "/messages"
7979

80+
async def test_sse_app_passes_max_body_bytes(self):
81+
mcp = MCPServer("test")
82+
app = mcp.sse_app(host="0.0.0.0", max_body_bytes=123)
83+
84+
mount_routes = [r for r in app.routes if isinstance(r, Mount)]
85+
assert len(mount_routes) == 1
86+
87+
message_app = mount_routes[0].app
88+
assert hasattr(message_app, "__self__"), "Expected a bound method for message handler"
89+
sse_transport = message_app.__self__
90+
assert getattr(sse_transport, "_max_body_bytes") == 123
91+
92+
async def test_streamable_http_app_passes_max_body_bytes(self):
93+
mcp = MCPServer("test")
94+
mcp.streamable_http_app(host="0.0.0.0", max_body_bytes=123)
95+
assert mcp.session_manager.max_body_bytes == 123
96+
8097
async def test_non_ascii_description(self):
8198
"""Test that MCPServer handles non-ASCII characters in descriptions correctly"""
8299
mcp = MCPServer()

0 commit comments

Comments
 (0)