Jeremiah Lowin commited on
Commit
9a0fa94
·
1 Parent(s): c1940a6

Alias streamable-http as http

Browse files
docs/clients/client.mdx CHANGED
@@ -102,7 +102,7 @@ config = {
102
  "mcpServers": {
103
  "server_name": {
104
  # Remote HTTP/SSE server
105
- "transport": "streamable-http", # or "sse"
106
  "url": "https://api.example.com/mcp",
107
  "headers": {"Authorization": "Bearer token"},
108
  "auth": "oauth" # or bearer token string
 
102
  "mcpServers": {
103
  "server_name": {
104
  # Remote HTTP/SSE server
105
+ "transport": "http", # or "sse"
106
  "url": "https://api.example.com/mcp",
107
  "headers": {"Authorization": "Bearer token"},
108
  "auth": "oauth" # or bearer token string
docs/clients/transports.mdx CHANGED
@@ -41,7 +41,7 @@ Streamable HTTP is the recommended transport for web-based deployments, providin
41
 
42
  - **Class:** `fastmcp.client.transports.StreamableHttpTransport`
43
  - **Inferred From:** URLs starting with `http://` or `https://` (default for HTTP URLs since v2.3.0) that do not contain `/sse/` in the path
44
- - **Server Compatibility:** Works with FastMCP servers running in `streamable-http` mode
45
 
46
  #### Basic Usage
47
 
@@ -150,7 +150,7 @@ client = Client(transport)
150
  - **Use Streamable HTTP when:**
151
  - Setting up new deployments (recommended default)
152
  - You need bidirectional streaming
153
- - You're connecting to FastMCP servers running in `streamable-http` mode
154
 
155
  - **Use SSE when:**
156
  - Connecting to legacy FastMCP servers running in `sse` mode
@@ -397,7 +397,7 @@ config = {
397
  # Remote HTTP server
398
  "weather": {
399
  "url": "https://weather-api.example.com/mcp",
400
- "transport": "streamable-http"
401
  },
402
  # Local stdio server
403
  "assistant": {
@@ -408,7 +408,7 @@ config = {
408
  # Another remote server
409
  "calendar": {
410
  "url": "https://calendar-api.example.com/mcp",
411
- "transport": "streamable-http"
412
  }
413
  }
414
  }
 
41
 
42
  - **Class:** `fastmcp.client.transports.StreamableHttpTransport`
43
  - **Inferred From:** URLs starting with `http://` or `https://` (default for HTTP URLs since v2.3.0) that do not contain `/sse/` in the path
44
+ - **Server Compatibility:** Works with FastMCP servers running in `http` mode
45
 
46
  #### Basic Usage
47
 
 
150
  - **Use Streamable HTTP when:**
151
  - Setting up new deployments (recommended default)
152
  - You need bidirectional streaming
153
+ - You're connecting to FastMCP servers running in `http` mode
154
 
155
  - **Use SSE when:**
156
  - Connecting to legacy FastMCP servers running in `sse` mode
 
397
  # Remote HTTP server
398
  "weather": {
399
  "url": "https://weather-api.example.com/mcp",
400
+ "transport": "http"
401
  },
402
  # Local stdio server
403
  "assistant": {
 
408
  # Another remote server
409
  "calendar": {
410
  "url": "https://calendar-api.example.com/mcp",
411
+ "transport": "http"
412
  }
413
  }
414
  }
docs/deployment/running-server.mdx CHANGED
@@ -105,7 +105,7 @@ When using Stdio transport, you will typically *not* run the server yourself as
105
 
106
  Streamable HTTP is a modern, efficient transport for exposing your MCP server via HTTP. It is the recommended transport for web-based deployments.
107
 
108
- To run a server using Streamable HTTP, you can use the `run()` method with the `transport` argument set to `"streamable-http"`. This will start a Uvicorn server on the default host (`127.0.0.1`), port (`8000`), and path (`/mcp/`).
109
  <CodeGroup>
110
  ```python {6} server.py
111
  from fastmcp import FastMCP
@@ -113,7 +113,7 @@ from fastmcp import FastMCP
113
  mcp = FastMCP()
114
 
115
  if __name__ == "__main__":
116
- mcp.run(transport="streamable-http")
117
  ```
118
  ```python {5} client.py
119
  import asyncio
@@ -128,6 +128,10 @@ if __name__ == "__main__":
128
  ```
129
  </CodeGroup>
130
 
 
 
 
 
131
  To customize the host, port, path, or log level, provide appropriate keyword arguments to the `run()` method.
132
 
133
  <CodeGroup>
@@ -138,7 +142,7 @@ mcp = FastMCP()
138
 
139
  if __name__ == "__main__":
140
  mcp.run(
141
- transport="streamable-http",
142
  host="127.0.0.1",
143
  port=4200,
144
  path="/my-custom-path",
@@ -158,7 +162,6 @@ if __name__ == "__main__":
158
  ```
159
  </CodeGroup>
160
 
161
-
162
  ### SSE
163
 
164
  <Warning>
@@ -250,7 +253,7 @@ def hello(name: str) -> str:
250
 
251
  async def main():
252
  # Use run_async() in async contexts
253
- await mcp.run_async(transport="streamable-http")
254
 
255
  if __name__ == "__main__":
256
  asyncio.run(main())
 
105
 
106
  Streamable HTTP is a modern, efficient transport for exposing your MCP server via HTTP. It is the recommended transport for web-based deployments.
107
 
108
+ To run a server using Streamable HTTP, you can use the `run()` method with the `transport` argument set to `"http"`. This will start a Uvicorn server on the default host (`127.0.0.1`), port (`8000`), and path (`/mcp/`).
109
  <CodeGroup>
110
  ```python {6} server.py
111
  from fastmcp import FastMCP
 
113
  mcp = FastMCP()
114
 
115
  if __name__ == "__main__":
116
+ mcp.run(transport="http")
117
  ```
118
  ```python {5} client.py
119
  import asyncio
 
128
  ```
129
  </CodeGroup>
130
 
131
+ <Tip>
132
+ For backward compatibility, wherever `"http"` is accepted as a transport name, you can also pass `"streamable-http"` as a fully supported alias. This is particularly useful when upgrading from FastMCP 1.x in the official Python SDK and FastMCP \<= 2.9, where `"streamable-http"` was the standard name.
133
+ </Tip>
134
+
135
  To customize the host, port, path, or log level, provide appropriate keyword arguments to the `run()` method.
136
 
137
  <CodeGroup>
 
142
 
143
  if __name__ == "__main__":
144
  mcp.run(
145
+ transport="http",
146
  host="127.0.0.1",
147
  port=4200,
148
  path="/my-custom-path",
 
162
  ```
163
  </CodeGroup>
164
 
 
165
  ### SSE
166
 
167
  <Warning>
 
253
 
254
  async def main():
255
  # Use run_async() in async contexts
256
+ await mcp.run_async(transport="http")
257
 
258
  if __name__ == "__main__":
259
  asyncio.run(main())
docs/getting-started/installation.mdx CHANGED
@@ -47,7 +47,7 @@ FastMCP root path: ~/Developer/fastmcp
47
  Upgrading from the official MCP SDK's FastMCP 1.0 to FastMCP 2.0 is generally straightforward. The core server API is highly compatible, and in many cases, changing your import statement from `from mcp.server.fastmcp import FastMCP` to `from fastmcp import FastMCP` will be sufficient.
48
 
49
 
50
- ```python {1-5}
51
  # Before
52
  # from mcp.server.fastmcp import FastMCP
53
 
@@ -56,8 +56,9 @@ from fastmcp import FastMCP
56
 
57
  mcp = FastMCP("My MCP Server")
58
  ```
 
59
  <Warning>
60
- Prior to `fastmcp==2.3.0` and `mcp==1.8.0`, the 2.x API always mirrored the 1.0 API. However, as the projects diverge, this can not be guaranteed. You may see deprecation warnings if you attempt to use 1.0 APIs in FastMCP 2.x. Please refer to this documentation for details on new capabilities.
61
  </Warning>
62
 
63
  ## Versioning and Breaking Changes
 
47
  Upgrading from the official MCP SDK's FastMCP 1.0 to FastMCP 2.0 is generally straightforward. The core server API is highly compatible, and in many cases, changing your import statement from `from mcp.server.fastmcp import FastMCP` to `from fastmcp import FastMCP` will be sufficient.
48
 
49
 
50
+ ```python {5}
51
  # Before
52
  # from mcp.server.fastmcp import FastMCP
53
 
 
56
 
57
  mcp = FastMCP("My MCP Server")
58
  ```
59
+
60
  <Warning>
61
+ Prior to `fastmcp==2.3.0` and `mcp==1.8.0`, the 2.x API always mirrored the official 1.0 API. However, as the projects diverge, this can not be guaranteed. You may see deprecation warnings if you attempt to use 1.0 APIs in FastMCP 2.x. Please refer to this documentation for details on new capabilities.
62
  </Warning>
63
 
64
  ## Versioning and Breaking Changes
docs/integrations/anthropic.mdx CHANGED
@@ -31,7 +31,7 @@ def roll_dice(n_dice: int) -> list[int]:
31
  return [random.randint(1, 6) for _ in range(n_dice)]
32
 
33
  if __name__ == "__main__":
34
- mcp.run(transport="streamable-http", port=8000)
35
  ```
36
 
37
  ## Deploy the Server
@@ -175,7 +175,7 @@ def roll_dice(n_dice: int) -> list[int]:
175
 
176
  if __name__ == "__main__":
177
  print(f"\n---\n\n🔑 Dice Roller access token:\n\n{access_token}\n\n---\n")
178
- mcp.run(transport="streamable-http", port=8000)
179
  ```
180
 
181
  ### Client Authentication
 
31
  return [random.randint(1, 6) for _ in range(n_dice)]
32
 
33
  if __name__ == "__main__":
34
+ mcp.run(transport="http", port=8000)
35
  ```
36
 
37
  ## Deploy the Server
 
175
 
176
  if __name__ == "__main__":
177
  print(f"\n---\n\n🔑 Dice Roller access token:\n\n{access_token}\n\n---\n")
178
+ mcp.run(transport="http", port=8000)
179
  ```
180
 
181
  ### Client Authentication
docs/integrations/chatgpt.mdx CHANGED
@@ -102,7 +102,7 @@ def create_server(
102
 
103
  if __name__ == "__main__":
104
  mcp = create_server("path/to/records.json")
105
- mcp.run(transport="streamable-http", port=8000)
106
  ```
107
 
108
  ### Deploy the Server
 
102
 
103
  if __name__ == "__main__":
104
  mcp = create_server("path/to/records.json")
105
+ mcp.run(transport="http", port=8000)
106
  ```
107
 
108
  ### Deploy the Server
docs/integrations/claude-code.mdx CHANGED
@@ -32,7 +32,7 @@ def roll_dice(n_dice: int) -> list[int]:
32
  return [random.randint(1, 6) for _ in range(n_dice)]
33
 
34
  if __name__ == "__main__":
35
- mcp.run(transport="streamable-http", port=8000)
36
  ```
37
 
38
  ## Connect to Claude Code
 
32
  return [random.randint(1, 6) for _ in range(n_dice)]
33
 
34
  if __name__ == "__main__":
35
+ mcp.run(transport="http", port=8000)
36
  ```
37
 
38
  ## Connect to Claude Code
docs/integrations/openai.mdx CHANGED
@@ -38,7 +38,7 @@ def roll_dice(n_dice: int) -> list[int]:
38
  return [random.randint(1, 6) for _ in range(n_dice)]
39
 
40
  if __name__ == "__main__":
41
- mcp.run(transport="streamable-http", port=8000)
42
  ```
43
 
44
  ### Deploy the Server
@@ -172,7 +172,7 @@ def roll_dice(n_dice: int) -> list[int]:
172
 
173
  if __name__ == "__main__":
174
  print(f"\n---\n\n🔑 Dice Roller access token:\n\n{access_token}\n\n---\n")
175
- mcp.run(transport="streamable-http", port=8000)
176
  ```
177
 
178
  #### Client Authentication
 
38
  return [random.randint(1, 6) for _ in range(n_dice)]
39
 
40
  if __name__ == "__main__":
41
+ mcp.run(transport="http", port=8000)
42
  ```
43
 
44
  ### Deploy the Server
 
172
 
173
  if __name__ == "__main__":
174
  print(f"\n---\n\n🔑 Dice Roller access token:\n\n{access_token}\n\n---\n")
175
+ mcp.run(transport="http", port=8000)
176
  ```
177
 
178
  #### Client Authentication
docs/patterns/cli.mdx CHANGED
@@ -42,11 +42,12 @@ This command runs the server directly in your current Python environment. You ar
42
 
43
  | Option | Flag | Description |
44
  | ------ | ---- | ----------- |
45
- | Transport | `--transport`, `-t` | Transport protocol to use (`stdio`, `streamable-http`, or `sse`) |
46
  | Host | `--host` | Host to bind to when using http transport (default: 127.0.0.1) |
47
  | Port | `--port`, `-p` | Port to bind to when using http transport (default: 8000) |
48
  | Log Level | `--log-level`, `-l` | Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL) |
49
 
 
50
  #### Server Specification
51
  <VersionBadge version="2.3.5" />
52
 
@@ -79,14 +80,14 @@ if __name__ == "__main__":
79
  You can run it with Streamable HTTP transport regardless of what's in the `__main__` block:
80
 
81
  ```bash
82
- fastmcp run server.py --transport streamable-http --port 8000
83
  ```
84
 
85
  **Examples**
86
 
87
  ```bash
88
  # Run a local server with Streamable HTTP transport on a custom port
89
- fastmcp run server.py --transport streamable-http --port 8000
90
 
91
  # Connect to a remote server and proxy as a stdio server
92
  fastmcp run https://example.com/mcp-server
@@ -112,14 +113,14 @@ The `dev` command is a shortcut for testing a server over STDIO only. When the I
112
  1. Select "STDIO" from the transport dropdown
113
  2. Connect manually
114
 
115
- This command does not support HTTP testing. To test a server over HTTP:
116
- 1. Start your server manually with HTTP transport using either:
117
  ```bash
118
- fastmcp run server.py --transport streamable-http
119
  ```
120
- or
121
  ```bash
122
- python server.py # Assuming your __main__ block sets HTTP transport
123
  ```
124
  2. Open the MCP Inspector separately and connect to your running server
125
  </Warning>
 
42
 
43
  | Option | Flag | Description |
44
  | ------ | ---- | ----------- |
45
+ | Transport | `--transport`, `-t` | Transport protocol to use (`stdio`, `http`, or `sse`) |
46
  | Host | `--host` | Host to bind to when using http transport (default: 127.0.0.1) |
47
  | Port | `--port`, `-p` | Port to bind to when using http transport (default: 8000) |
48
  | Log Level | `--log-level`, `-l` | Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL) |
49
 
50
+
51
  #### Server Specification
52
  <VersionBadge version="2.3.5" />
53
 
 
80
  You can run it with Streamable HTTP transport regardless of what's in the `__main__` block:
81
 
82
  ```bash
83
+ fastmcp run server.py --transport http --port 8000
84
  ```
85
 
86
  **Examples**
87
 
88
  ```bash
89
  # Run a local server with Streamable HTTP transport on a custom port
90
+ fastmcp run server.py --transport http --port 8000
91
 
92
  # Connect to a remote server and proxy as a stdio server
93
  fastmcp run https://example.com/mcp-server
 
113
  1. Select "STDIO" from the transport dropdown
114
  2. Connect manually
115
 
116
+ This command does not support HTTP testing. To test a server over Streamable HTTP or SSE:
117
+ 1. Start your server manually with the appropriate transport using either the command line:
118
  ```bash
119
+ fastmcp run server.py --transport http
120
  ```
121
+ or by setting the transport in your code:
122
  ```bash
123
+ python server.py # Assuming your __main__ block sets Streamable HTTP transport
124
  ```
125
  2. Open the MCP Inspector separately and connect to your running server
126
  </Warning>
docs/python-sdk/fastmcp-client-transports.mdx CHANGED
@@ -168,11 +168,11 @@ Transport for connecting to one or more MCP servers defined in an MCPConfig.
168
  "mcpServers": {
169
  "weather": {
170
  "url": "https://weather-api.example.com/mcp",
171
- "transport": "streamable-http"
172
  },
173
  "calendar": {
174
  "url": "https://calendar-api.example.com/mcp",
175
- "transport": "streamable-http"
176
  }
177
  }
178
  }
 
168
  "mcpServers": {
169
  "weather": {
170
  "url": "https://weather-api.example.com/mcp",
171
+ "transport": "http"
172
  },
173
  "calendar": {
174
  "url": "https://calendar-api.example.com/mcp",
175
+ "transport": "http"
176
  }
177
  }
178
  }
docs/servers/auth/bearer.mdx CHANGED
@@ -19,7 +19,7 @@ The [MCP specification](https://modelcontextprotocol.io/specification/2025-03-26
19
 
20
  Bearer Token authentication is a common way to secure HTTP-based APIs. In this model, the client sends a token (usually a JSON Web Token or JWT) in the `Authorization` header with the "Bearer" scheme. The server then validates this token to grant or deny access.
21
 
22
- FastMCP supports Bearer Token authentication for its HTTP-based transports (`streamable-http` and `sse`), allowing you to protect your server from unauthorized access.
23
 
24
  ## Authentication Strategy
25
 
 
19
 
20
  Bearer Token authentication is a common way to secure HTTP-based APIs. In this model, the client sends a token (usually a JSON Web Token or JWT) in the `Authorization` header with the "Bearer" scheme. The server then validates this token to grant or deny access.
21
 
22
+ FastMCP supports Bearer Token authentication for its HTTP-based transports (`http` and `sse`), allowing you to protect your server from unauthorized access.
23
 
24
  ## Authentication Strategy
25
 
docs/servers/proxy.mdx CHANGED
@@ -118,7 +118,7 @@ config = {
118
  "mcpServers": {
119
  "default": { # For single server configs, 'default' is commonly used
120
  "url": "https://example.com/mcp",
121
- "transport": "streamable-http"
122
  }
123
  }
124
  }
@@ -145,11 +145,11 @@ config = {
145
  "mcpServers": {
146
  "weather": {
147
  "url": "https://weather-api.example.com/mcp",
148
- "transport": "streamable-http"
149
  },
150
  "calendar": {
151
  "url": "https://calendar-api.example.com/mcp",
152
- "transport": "streamable-http"
153
  }
154
  }
155
  }
 
118
  "mcpServers": {
119
  "default": { # For single server configs, 'default' is commonly used
120
  "url": "https://example.com/mcp",
121
+ "transport": "http"
122
  }
123
  }
124
  }
 
145
  "mcpServers": {
146
  "weather": {
147
  "url": "https://weather-api.example.com/mcp",
148
+ "transport": "http"
149
  },
150
  "calendar": {
151
  "url": "https://calendar-api.example.com/mcp",
152
+ "transport": "http"
153
  }
154
  }
155
  }
docs/servers/server.mdx CHANGED
@@ -158,8 +158,8 @@ if __name__ == "__main__":
158
  # This runs the server, defaulting to STDIO transport
159
  mcp.run()
160
 
161
- # To use a different transport, e.g., HTTP:
162
- # mcp.run(transport="streamable-http", host="127.0.0.1", port=9000)
163
  ```
164
 
165
  FastMCP supports several transport options:
@@ -260,7 +260,7 @@ Transport settings are provided when running the server and control network beha
260
  ```python
261
  # Configure transport when running
262
  mcp.run(
263
- transport="streamable-http",
264
  host="0.0.0.0", # Bind to all interfaces
265
  port=9000, # Custom port
266
  log_level="DEBUG", # Override global log level
@@ -268,7 +268,7 @@ mcp.run(
268
 
269
  # Or for async usage
270
  await mcp.run_async(
271
- transport="streamable-http",
272
  host="127.0.0.1",
273
  port=8080,
274
  )
 
158
  # This runs the server, defaulting to STDIO transport
159
  mcp.run()
160
 
161
+ # To use a different transport, e.g., Streamable HTTP:
162
+ # mcp.run(transport="http", host="127.0.0.1", port=9000)
163
  ```
164
 
165
  FastMCP supports several transport options:
 
260
  ```python
261
  # Configure transport when running
262
  mcp.run(
263
+ transport="http",
264
  host="0.0.0.0", # Bind to all interfaces
265
  port=9000, # Custom port
266
  log_level="DEBUG", # Override global log level
 
268
 
269
  # Or for async usage
270
  await mcp.run_async(
271
+ transport="http",
272
  host="127.0.0.1",
273
  port=8080,
274
  )
docs/tutorials/rest-api.mdx CHANGED
@@ -82,7 +82,7 @@ mcp = FastMCP.from_openapi(
82
  )
83
 
84
  if __name__ == "__main__":
85
- mcp.run(transport="streamable-http", port=8000)
86
  ```
87
 
88
  And that's it! With just a few lines of code, you've created an MCP server that exposes the entire JSONPlaceholder API as a collection of tools.
@@ -195,7 +195,7 @@ mcp = FastMCP.from_openapi(
195
  )
196
 
197
  if __name__ == "__main__":
198
- mcp.run(transport="streamable-http", port=8000)
199
  ```
200
  With this configuration:
201
  - `GET /users/{id}` becomes a `ResourceTemplate`.
 
82
  )
83
 
84
  if __name__ == "__main__":
85
+ mcp.run(transport="http", port=8000)
86
  ```
87
 
88
  And that's it! With just a few lines of code, you've created an MCP server that exposes the entire JSONPlaceholder API as a collection of tools.
 
195
  )
196
 
197
  if __name__ == "__main__":
198
+ mcp.run(transport="http", port=8000)
199
  ```
200
  With this configuration:
201
  - `GET /users/{id}` becomes a `ResourceTemplate`.
docs/updates.mdx CHANGED
@@ -107,7 +107,7 @@ img="https://www.jlowin.dev/_image?href=%2F_astro%2Fhero.M_hv6gEB.png&w=1000&h=5
107
  cta="Read more"
108
  >
109
 
110
- FastMCP 2.3 introduces full support for Streamable HTTP, a modern alternative to SSE that simplifies MCP deployments over the web. It’s efficient, reliable, and now the default HTTP transport. Just run your server with transport="streamable-http" and connect clients via a standard URL—FastMCP handles the rest. No special setup required. This release makes deploying MCP servers easier and more portable than ever.
111
 
112
  </Card>
113
  </Update>
 
107
  cta="Read more"
108
  >
109
 
110
+ FastMCP 2.3 introduces full support for Streamable HTTP, a modern alternative to SSE that simplifies MCP deployments over the web. It’s efficient, reliable, and now the default HTTP transport. Just run your server with transport="http" and connect clients via a standard URL—FastMCP handles the rest. No special setup required. This release makes deploying MCP servers easier and more portable than ever.
111
 
112
  </Card>
113
  </Update>
tests/cli/test_cli.py CHANGED
@@ -328,6 +328,41 @@ class TestRunCommand:
328
  assert result.exit_code == 0
329
  mock_server.run.assert_called_once_with(transport="sse")
330
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  def test_run_command_with_host(self, temp_python_file):
332
  """Test run command with host option."""
333
  with (
 
328
  assert result.exit_code == 0
329
  mock_server.run.assert_called_once_with(transport="sse")
330
 
331
+ def test_run_command_with_http_transports(self, temp_python_file):
332
+ """Test run command with both http and streamable-http transport options."""
333
+ # Test "http" transport
334
+ with (
335
+ patch("fastmcp.cli.run.parse_file_path") as mock_parse,
336
+ patch("fastmcp.cli.run.import_server") as mock_import,
337
+ ):
338
+ mock_parse.return_value = (temp_python_file, None)
339
+ mock_server = MagicMock()
340
+ mock_server.name = "test_server"
341
+ mock_import.return_value = mock_server
342
+
343
+ result = runner.invoke(
344
+ cli.app, ["run", str(temp_python_file), "--transport", "http"]
345
+ )
346
+ assert result.exit_code == 0
347
+ mock_server.run.assert_called_once_with(transport="http")
348
+
349
+ # Test "streamable-http" transport (alias for http)
350
+ with (
351
+ patch("fastmcp.cli.run.parse_file_path") as mock_parse,
352
+ patch("fastmcp.cli.run.import_server") as mock_import,
353
+ ):
354
+ mock_parse.return_value = (temp_python_file, None)
355
+ mock_server = MagicMock()
356
+ mock_server.name = "test_server"
357
+ mock_import.return_value = mock_server
358
+
359
+ result = runner.invoke(
360
+ cli.app,
361
+ ["run", str(temp_python_file), "--transport", "streamable-http"],
362
+ )
363
+ assert result.exit_code == 0
364
+ mock_server.run.assert_called_once_with(transport="streamable-http")
365
+
366
  def test_run_command_with_host(self, temp_python_file):
367
  """Test run command with host option."""
368
  with (
tests/client/test_streamable_http.py CHANGED
@@ -110,6 +110,7 @@ async def streamable_http_server(
110
  yield f"{url}/mcp/"
111
 
112
 
 
113
  async def streamable_http_server_with_streamable_http_alias() -> AsyncGenerator[
114
  str, None
115
  ]:
@@ -216,3 +217,41 @@ class TestTimeout:
216
  ) as client:
217
  with pytest.raises(McpError):
218
  await client.call_tool("sleep", {"seconds": 0.2}, timeout=0.1)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  yield f"{url}/mcp/"
111
 
112
 
113
+ @pytest.fixture()
114
  async def streamable_http_server_with_streamable_http_alias() -> AsyncGenerator[
115
  str, None
116
  ]:
 
217
  ) as client:
218
  with pytest.raises(McpError):
219
  await client.call_tool("sleep", {"seconds": 0.2}, timeout=0.1)
220
+
221
+
222
+ async def test_fastmcp_run_with_streamable_http_alias():
223
+ """Test that FastMCP.run() works with 'streamable-http' transport alias."""
224
+ server = fastmcp_server()
225
+
226
+ # This should work without error - testing that the alias is recognized
227
+ import threading
228
+ import time
229
+
230
+ def run_server():
231
+ try:
232
+ server.run(transport="streamable-http", port=0, log_level="error")
233
+ except Exception:
234
+ # Expected to fail when port is 0, but we're just testing the transport parsing
235
+ pass
236
+
237
+ # Run in a separate thread briefly to test transport argument parsing
238
+ thread = threading.Thread(target=run_server, daemon=True)
239
+ thread.start()
240
+ time.sleep(0.1) # Give it a moment to start and parse arguments
241
+ # Thread will exit naturally when the function completes
242
+
243
+
244
+ async def test_fastmcp_run_async_with_streamable_http_alias():
245
+ """Test that FastMCP.run_async() works with 'streamable-http' transport alias."""
246
+ server = fastmcp_server()
247
+
248
+ # Test that run_async accepts the streamable-http alias
249
+ try:
250
+ # Use a timeout to prevent hanging
251
+ await asyncio.wait_for(
252
+ server.run_async(transport="streamable-http", port=0, log_level="error"),
253
+ timeout=0.1,
254
+ )
255
+ except (asyncio.TimeoutError, Exception):
256
+ # Expected to fail/timeout, but we're testing that the transport is accepted
257
+ pass