Код: Выделить всё
def create_starlette_app():
"""
Create a Starlette application that wraps the WSGI app and adds the MCP route if enabled.
"""
api = create_app()
API_APP = WSGIMiddleware(app=api)
routes = []
lifespan = create_lifespan
LOGGER.info("MCP is enabled, adding MCP route to ASGI app.")
MCP_SERVER = mcp_asgi_server()
routes.append(Mount(name="mcp", path="/mcp", app=MCP_SERVER))
lifespan = MCP_SERVER.lifespan
return Router(routes=routes, lifespan=lifespan, default=API_APP)
Код: Выделить всё
import tools.mcp_tool_1
import tools.mcp_tool_2
mcp = FastMCP(resource_prefix_format="path")
mcp.mount(server=tools.mcp_tool_1, prefix="mcp_tool_1")
mcp.mount(server=tools.mcp_tool_2, prefix="mcp_tool_2")
def mcp_asgi_server():
return mcp.http_app(path="/", transport="sse")
Код: Выделить всё
Error in post_writer: Client error '404 Not Found' for url 'http://localhost:5001/mcp/messages/?session_id=e89b672cfdf34e818f68acf2e9cc40f9'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
Подробнее: https://stackoverflow.com/questions/796 ... urning-404
Мобильная версия