Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

Add "http" as an alias for streamable-http

Jeremiah Lowin76e3df1bc1de
diff --git a/src/fastmcp/client/transports.py b/src/fastmcp/client/transports.py
index 153491029..b0571618d 100644
--- a/src/fastmcp/client/transports.py
+++ b/src/fastmcp/client/transports.py
@@ -736,11 +736,11 @@ class MCPConfigTransport(ClientTransport):
"mcpServers": {
"weather": {
"url": "https://weather-api.example.com/mcp",
- "transport": "streamable-http"
+ "transport": "http"
},
"calendar": {
"url": "https://calendar-api.example.com/mcp",
- "transport": "streamable-http"
+ "transport": "http"
}
}
}
diff --git a/tests/auth/providers/test_bearer.py b/tests/auth/providers/test_bearer.py
index ac7e529b1..07790ef48 100644
--- a/tests/auth/providers/test_bearer.py
+++ b/tests/auth/providers/test_bearer.py
@@ -65,7 +65,7 @@ def mcp_server_url(rsa_key_pair: RSAKeyPair) -> Generator[str]:
with run_server_in_process(
run_mcp_server,
public_key=rsa_key_pair.public_key,
- run_kwargs=dict(transport="streamable-http"),
+ run_kwargs=dict(transport="http"),
) as url:
yield f"{url}/mcp/"
@@ -696,7 +696,7 @@ class TestFastMCPBearerAuth:
run_mcp_server,
public_key=rsa_key_pair.public_key,
auth_kwargs=dict(required_scopes=["read", "write"]),
- run_kwargs=dict(transport="streamable-http"),
+ run_kwargs=dict(transport="http"),
) as url:
mcp_server_url = f"{url}/mcp/"
with pytest.raises(httpx.HTTPStatusError) as exc_info:
@@ -719,7 +719,7 @@ class TestFastMCPBearerAuth:
run_mcp_server,
public_key=rsa_key_pair.public_key,
auth_kwargs=dict(required_scopes=["read", "write"]),
- run_kwargs=dict(transport="streamable-http"),
+ run_kwargs=dict(transport="http"),
) as url:
mcp_server_url = f"{url}/mcp/"
async with Client(mcp_server_url, auth=BearerAuth(token)) as client:
diff --git a/tests/auth/test_oauth_client.py b/tests/auth/test_oauth_client.py
index f36cf4c91..cb7204818 100644
--- a/tests/auth/test_oauth_client.py
+++ b/tests/auth/test_oauth_client.py
@@ -43,7 +43,7 @@ def run_server(host: str, port: int, **kwargs) -> None:
@pytest.fixture(scope="module")
def streamable_http_server() -> Generator[str, None, None]:
- with run_server_in_process(run_server, transport="streamable-http") as url:
+ with run_server_in_process(run_server, transport="http") as url:
yield f"{url}/mcp/"
diff --git a/tests/client/test_openapi.py b/tests/client/test_openapi.py
index 2ee4727a9..6f662e927 100644
--- a/tests/client/test_openapi.py
+++ b/tests/client/test_openapi.py
@@ -56,7 +56,7 @@ def run_proxy_server(host: str, port: int, shttp_url: str, **kwargs) -> None:
class TestClientHeaders:
@pytest.fixture(scope="class")
def shttp_server(self) -> Generator[str, None, None]:
- with run_server_in_process(run_server, transport="streamable-http") as url:
+ with run_server_in_process(run_server, transport="http") as url:
yield f"{url}/mcp/"
@pytest.fixture(scope="class")
@@ -69,7 +69,7 @@ class TestClientHeaders:
with run_server_in_process(
run_proxy_server,
shttp_url=shttp_server,
- transport="streamable-http",
+ transport="http",
) as url:
yield f"{url}/mcp/"
diff --git a/tests/client/test_streamable_http.py b/tests/client/test_streamable_http.py
index 5b182c933..858c8f285 100644
--- a/tests/client/test_streamable_http.py
+++ b/tests/client/test_streamable_http.py
@@ -103,13 +103,23 @@ async def streamable_http_server(
stateless_http: bool = False,
) -> AsyncGenerator[str, None]:
with run_server_in_process(
- run_server, stateless_http=stateless_http, transport="streamable-http"
+ run_server, stateless_http=stateless_http, transport="http"
) as url:
async with Client(transport=StreamableHttpTransport(f"{url}/mcp/")) as client:
assert await client.ping()
yield f"{url}/mcp/"
+async def streamable_http_server_with_streamable_http_alias() -> AsyncGenerator[
+ str, None
+]:
+ """Test that the "streamable-http" transport alias works."""
+ with run_server_in_process(run_server, transport="streamable-http") as url:
+ async with Client(transport=StreamableHttpTransport(f"{url}/mcp/")) as client:
+ assert await client.ping()
+ yield f"{url}/mcp/"
+
+
async def test_ping(streamable_http_server: str):
"""Test pinging the server."""
async with Client(
@@ -119,6 +129,19 @@ async def test_ping(streamable_http_server: str):
assert result is True
+async def test_ping_with_streamable_http_alias(
+ streamable_http_server_with_streamable_http_alias: str,
+):
+ """Test pinging the server."""
+ async with Client(
+ transport=StreamableHttpTransport(
+ streamable_http_server_with_streamable_http_alias
+ )
+ ) as client:
+ result = await client.ping()
+ assert result is True
+
+
async def test_http_headers(streamable_http_server: str):
"""Test getting HTTP headers from the server."""
async with Client(
diff --git a/tests/server/http/test_http_dependencies.py b/tests/server/http/test_http_dependencies.py
index 514f0a9d3..ff88e1e7a 100644
--- a/tests/server/http/test_http_dependencies.py
+++ b/tests/server/http/test_http_dependencies.py
@@ -44,7 +44,7 @@ def run_server(host: str, port: int, **kwargs) -> None:
@pytest.fixture(autouse=True, scope="module")
def shttp_server() -> Generator[str, None, None]:
- with run_server_in_process(run_server, transport="streamable-http") as url:
+ with run_server_in_process(run_server, transport="http") as url:
yield f"{url}/mcp/"
diff --git a/tests/server/http/test_http_middleware.py b/tests/server/http/test_http_middleware.py
index 0c36d0522..6fbe14363 100644
--- a/tests/server/http/test_http_middleware.py
+++ b/tests/server/http/test_http_middleware.py
@@ -96,7 +96,7 @@ async def test_streamable_http_app_with_custom_middleware():
server._additional_http_routes = routes
# Create the app with custom middleware
- app = server.http_app(transport="streamable-http", middleware=custom_middleware)
+ app = server.http_app(transport="http", middleware=custom_middleware)
# Create a test client
transport = ASGITransport(app=app)