49b9bb6724
Deploy Docs / deploy-docs (push) Failing after 1s
Conformance Tests / client-conformance (push) Failing after 3s
Conformance Tests / server-conformance (push) Failing after 1s
GitHub Actions Security Analysis / zizmor (push) Failing after 1s
CI / checks (push) Failing after 59m20s
CI / all-green (push) Waiting to run
23 lines
796 B
Python
23 lines
796 B
Python
"""The one-liner HTTP deploy: one stateless ASGI app serves both protocol eras, so it exports `build_app()`."""
|
|
|
|
from starlette.applications import Starlette
|
|
|
|
from mcp.server.mcpserver import MCPServer
|
|
from stories._hosting import NO_DNS_REBIND, run_app_from_args
|
|
|
|
|
|
def build_app() -> Starlette:
|
|
mcp = MCPServer("stateless-legacy-example")
|
|
|
|
@mcp.tool(description="A simple greeting tool.")
|
|
def greet(name: str) -> str:
|
|
return f"Hello, {name}!"
|
|
|
|
# stateless_http=True: no Mcp-Session-Id, fresh transport per POST — horizontally
|
|
# scalable. The same app also answers 2026-era envelope requests with no extra config.
|
|
return mcp.streamable_http_app(stateless_http=True, transport_security=NO_DNS_REBIND)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
run_app_from_args(build_app)
|