Jeremiah Lowin commited on
Commit
b4aeccd
·
1 Parent(s): d8a9a0b

Revert trailing slashes

Browse files
docs/deployment/running-server.mdx CHANGED
@@ -66,7 +66,7 @@ When using Stdio transport, you will typically *not* run the server yourself as
66
 
67
  Streamable HTTP is a modern, efficient transport for exposing your MCP server via HTTP. It is generally recommended over SSE for new web-based deployments.
68
 
69
- 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/`).
70
  <CodeGroup>
71
  ```python {6} server.py
72
  from fastmcp import FastMCP
@@ -81,7 +81,7 @@ import asyncio
81
  from fastmcp import Client
82
 
83
  async def example():
84
- async with Client("http://127.0.0.1:8000/mcp/") as client:
85
  await client.ping()
86
 
87
  if __name__ == "__main__":
@@ -102,7 +102,7 @@ if __name__ == "__main__":
102
  transport="streamable-http",
103
  host="127.0.0.1",
104
  port=4200,
105
- path="/my-custom-path/",
106
  log_level="debug",
107
  )
108
  ```
@@ -111,7 +111,7 @@ import asyncio
111
  from fastmcp import Client
112
 
113
  async def example():
114
- async with Client("http://127.0.0.1:4200/my-custom-path/") as client:
115
  await client.ping()
116
 
117
  if __name__ == "__main__":
@@ -124,7 +124,7 @@ if __name__ == "__main__":
124
 
125
  Server-Sent Events (SSE) is an HTTP-based protocol for server-to-client streaming. While FastMCP supports SSE, Streamable HTTP is preferred for new projects.
126
 
127
- To run a server using SSE, you can use the `run()` method with the `transport` argument set to `"sse"`. This will start a Uvicorn server on the default host (`127.0.0.1`), port (`8000`), and with default SSE path (`/sse/`) and message path (`/messages/`).
128
 
129
  <CodeGroup>
130
  ```python {6} server.py
@@ -142,7 +142,7 @@ from fastmcp.client.transports import SSETransport
142
 
143
  async def example():
144
  async with Client(
145
- transport=SSETransport("http://127.0.0.1:8000/sse/")
146
  ) as client:
147
  await client.ping()
148
 
@@ -169,7 +169,7 @@ if __name__ == "__main__":
169
  host="127.0.0.1",
170
  port=4200,
171
  log_level="debug",
172
- path="/my-custom-sse-path/",
173
  message_path="/my-custom-message-path/",
174
  )
175
  ```
@@ -180,7 +180,7 @@ from fastmcp.client.transports import SSETransport
180
 
181
  async def example():
182
  async with Client(
183
- transport=SSETransport("http://127.0.0.1:4200/my-custom-sse-path/")
184
  ) as client:
185
  await client.ping()
186
 
 
66
 
67
  Streamable HTTP is a modern, efficient transport for exposing your MCP server via HTTP. It is generally recommended over SSE for new web-based deployments.
68
 
69
+ 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`).
70
  <CodeGroup>
71
  ```python {6} server.py
72
  from fastmcp import FastMCP
 
81
  from fastmcp import Client
82
 
83
  async def example():
84
+ async with Client("http://127.0.0.1:8000/mcp") as client:
85
  await client.ping()
86
 
87
  if __name__ == "__main__":
 
102
  transport="streamable-http",
103
  host="127.0.0.1",
104
  port=4200,
105
+ path="/my-custom-path",
106
  log_level="debug",
107
  )
108
  ```
 
111
  from fastmcp import Client
112
 
113
  async def example():
114
+ async with Client("http://127.0.0.1:4200/my-custom-path") as client:
115
  await client.ping()
116
 
117
  if __name__ == "__main__":
 
124
 
125
  Server-Sent Events (SSE) is an HTTP-based protocol for server-to-client streaming. While FastMCP supports SSE, Streamable HTTP is preferred for new projects.
126
 
127
+ To run a server using SSE, you can use the `run()` method with the `transport` argument set to `"sse"`. This will start a Uvicorn server on the default host (`127.0.0.1`), port (`8000`), and with default SSE path (`/sse`) and message path (`/messages/`).
128
 
129
  <CodeGroup>
130
  ```python {6} server.py
 
142
 
143
  async def example():
144
  async with Client(
145
+ transport=SSETransport("http://127.0.0.1:8000/sse")
146
  ) as client:
147
  await client.ping()
148
 
 
169
  host="127.0.0.1",
170
  port=4200,
171
  log_level="debug",
172
+ path="/my-custom-sse-path",
173
  message_path="/my-custom-message-path/",
174
  )
175
  ```
 
180
 
181
  async def example():
182
  async with Client(
183
+ transport=SSETransport("http://127.0.0.1:4200/my-custom-sse-path")
184
  ) as client:
185
  await client.ping()
186
 
src/fastmcp/settings.py CHANGED
@@ -59,9 +59,9 @@ class ServerSettings(BaseSettings):
59
  # HTTP settings
60
  host: str = "127.0.0.1"
61
  port: int = 8000
62
- sse_path: str = "/sse/"
63
  message_path: str = "/messages/"
64
- streamable_http_path: str = "/mcp/"
65
  debug: bool = False
66
 
67
  # resource settings
 
59
  # HTTP settings
60
  host: str = "127.0.0.1"
61
  port: int = 8000
62
+ sse_path: str = "/sse"
63
  message_path: str = "/messages/"
64
+ streamable_http_path: str = "/mcp"
65
  debug: bool = False
66
 
67
  # resource settings