fastmcp/tests/server/test_app_state.py
Jeremiah Lowin e9aad2eacb feat: Add --workspace flag to fastmcp install cursor (#1522)
Co-authored-by: Jeremiah Lowin <jlowin@users.noreply.github.com>
Co-authored-by: marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>
2025-08-19 20:10:12 +00:00

26 lines
837 B
Python

from fastmcp.server import FastMCP
from fastmcp.server.http import create_sse_app, create_streamable_http_app
def test_http_app_sets_mcp_server_state():
server = FastMCP(name="StateTest")
app = server.http_app()
assert app.state.fastmcp_server is server
def test_http_app_sse_sets_mcp_server_state():
server = FastMCP(name="StateTest")
app = server.http_app(transport="sse")
assert app.state.fastmcp_server is server
def test_create_streamable_http_app_sets_state():
server = FastMCP(name="StateTest")
app = create_streamable_http_app(server, "/mcp/")
assert app.state.fastmcp_server is server
def test_create_sse_app_sets_state():
server = FastMCP(name="StateTest")
app = create_sse_app(server, message_path="/message", sse_path="/sse/")
assert app.state.fastmcp_server is server