Spaces:
Running
Running
Jeremiah Lowin commited on
Commit ·
884c3bb
1
Parent(s): 9302244
Update asgi.mdx
Browse files- docs/deployment/asgi.mdx +7 -1
docs/deployment/asgi.mdx
CHANGED
|
@@ -5,6 +5,9 @@ description: Integrate FastMCP servers into existing Starlette, FastAPI, or othe
|
|
| 5 |
icon: plug
|
| 6 |
---
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
While FastMCP provides standalone server capabilities, you can also integrate your FastMCP server into existing web applications. This approach is useful for:
|
| 9 |
|
| 10 |
- Adding MCP functionality to an existing website or API
|
|
@@ -16,11 +19,14 @@ Please note that all FastMCP servers have a `run()` method that can be used to s
|
|
| 16 |
|
| 17 |
## ASGI Server
|
| 18 |
|
| 19 |
-
|
| 20 |
FastMCP servers can be created as [Starlette](https://www.starlette.io/) ASGI apps for straightforward hosting or integration into existing applications.
|
| 21 |
|
| 22 |
The first step is to obtain a Starlette application instance from your FastMCP server using the `http_app()` method:
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
```python
|
| 25 |
from fastmcp import FastMCP
|
| 26 |
|
|
|
|
| 5 |
icon: plug
|
| 6 |
---
|
| 7 |
|
| 8 |
+
import { VersionBadge } from '/snippets/version-badge.mdx'
|
| 9 |
+
|
| 10 |
+
|
| 11 |
While FastMCP provides standalone server capabilities, you can also integrate your FastMCP server into existing web applications. This approach is useful for:
|
| 12 |
|
| 13 |
- Adding MCP functionality to an existing website or API
|
|
|
|
| 19 |
|
| 20 |
## ASGI Server
|
| 21 |
|
|
|
|
| 22 |
FastMCP servers can be created as [Starlette](https://www.starlette.io/) ASGI apps for straightforward hosting or integration into existing applications.
|
| 23 |
|
| 24 |
The first step is to obtain a Starlette application instance from your FastMCP server using the `http_app()` method:
|
| 25 |
|
| 26 |
+
<Tip>
|
| 27 |
+
The `http_app()` method is new in FastMCP 2.3.2. In older versions, use `sse_app()` for SSE transport or `streamable_http_app()` for Streamable HTTP transport.
|
| 28 |
+
</Tip>
|
| 29 |
+
|
| 30 |
```python
|
| 31 |
from fastmcp import FastMCP
|
| 32 |
|