docs: restructure into topical sections and add the four most-asked-for pages (#3044)
This commit is contained in:
parent
080f2a869d
commit
220d362112
1 changed files with 2403 additions and 343 deletions
16
docs_src/troubleshooting/tutorial005.py
Normal file
16
docs_src/troubleshooting/tutorial005.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
from starlette.applications import Starlette
|
||||
from starlette.routing import Mount
|
||||
|
||||
from mcp.server import MCPServer
|
||||
|
||||
mcp = MCPServer("Weather")
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
def forecast(city: str) -> str:
|
||||
"""Today's forecast for one city."""
|
||||
return f"{city}: Rain."
|
||||
|
||||
|
||||
# The mount works. The MCP app's own lifespan never runs.
|
||||
app = Starlette(routes=[Mount("/", app=mcp.streamable_http_app())])
|
||||
Loading…
Reference in a new issue