Nihal2000 commited on
Commit
3cf83c4
·
1 Parent(s): 4c296ca

Fix MCP server transport initialization by mounting mcp.sse_app

Browse files
Files changed (1) hide show
  1. mcp_server.py +4 -9
mcp_server.py CHANGED
@@ -261,7 +261,7 @@ async def list_documents_for_ui(limit: int = 100, offset: int = 0) -> Dict[str,
261
 
262
  # Blaxel Deployment Support
263
  from fastapi import FastAPI
264
- from mcp.server.streamable_http import StreamableHTTPServerTransport
265
  import os
266
 
267
  # Get Blaxel environment variables
@@ -271,14 +271,9 @@ port = int(os.getenv("BL_SERVER_PORT", "8000"))
271
  # Create FastAPI app
272
  app = FastAPI()
273
 
274
- # Initialize HTTP transport instead of stdio
275
- transport = StreamableHTTPServerTransport()
276
-
277
- # Connect MCP server to HTTP transport
278
- mcp.connect(transport)
279
-
280
- # Mount transport to FastAPI
281
- transport.mount(app)
282
 
283
  @app.get("/health")
284
  async def health_check():
 
261
 
262
  # Blaxel Deployment Support
263
  from fastapi import FastAPI
264
+ # from mcp.server.streamable_http import StreamableHTTPServerTransport
265
  import os
266
 
267
  # Get Blaxel environment variables
 
271
  # Create FastAPI app
272
  app = FastAPI()
273
 
274
+ # Mount FastMCP SSE app to FastAPI
275
+ # This exposes the MCP server at /sse
276
+ app.mount("/sse", mcp.sse_app)
 
 
 
 
 
277
 
278
  @app.get("/health")
279
  async def health_check():