fix: serve MCP over Streamable HTTP instead of legacy SSE
PR Checks / hadolint (pull_request) Successful in 40s
PR Checks / build-test (pull_request) Successful in 3m19s
PR Checks / pytest (pull_request) Successful in 2m47s
Docker Build and Push / test (pull_request) Successful in 3m1s
Docker Build and Push / integration-test (pull_request) Successful in 3m24s
Docker Build and Push / build (pull_request) Successful in 3m4s
PR Checks / hadolint (pull_request) Successful in 40s
PR Checks / build-test (pull_request) Successful in 3m19s
PR Checks / pytest (pull_request) Successful in 2m47s
Docker Build and Push / test (pull_request) Successful in 3m1s
Docker Build and Push / integration-test (pull_request) Successful in 3m24s
Docker Build and Push / build (pull_request) Successful in 3m4s
Current MCP clients (OpenCode, Claude, ...) only speak Streamable HTTP: they POST JSON-RPC to the configured URL, so a legacy SSE endpoint answers 405 Method Not Allowed and not a single tool can be reached. Run FastMCP's http_app (build_app()) under uvicorn instead of mcp.run(sse): the MCP endpoint is now /mcp, and the custom GET /health route keeps serving the Kubernetes probes. Add transport tests asserting /mcp and /health are exposed and /sse is gone.
This commit is contained in:
3 files changed
+49
-5
No files matched your search
@@ -0,0 +1,27 @@
|
||||
"""Transport-level tests for the mcp-maildir ASGI app.
|
||||
|
||||
Current MCP clients (OpenCode, Claude, ...) only speak Streamable HTTP: they
|
||||
POST JSON-RPC to the configured URL. Serving the legacy SSE transport alone
|
||||
makes those clients fail with `405 Method Not Allowed`, so the app built by
|
||||
`server.build_app()` must expose the MCP endpoint at /mcp.
|
||||
|
||||
Env vars are set in tests/conftest.py (shared session-wide).
|
||||
"""
|
||||
|
||||
from server import build_app, MCP_HTTP_PATH
|
||||
|
||||
|
||||
def app_paths() -> set:
|
||||
return {getattr(route, "path", None) for route in build_app().routes}
|
||||
|
||||
|
||||
class TestTransport:
|
||||
def test_mcp_endpoint_is_streamable_http(self):
|
||||
assert MCP_HTTP_PATH == "/mcp"
|
||||
assert MCP_HTTP_PATH in app_paths()
|
||||
|
||||
def test_health_endpoint_is_exposed_for_probes(self):
|
||||
assert "/health" in app_paths()
|
||||
|
||||
def test_legacy_sse_endpoint_is_gone(self):
|
||||
assert "/sse" not in app_paths()
|
||||
Reference in new issue
Block a user