visproj commited on
Commit
e880bf8
·
verified ·
1 Parent(s): 536b5af

Update server_http.py

Browse files
Files changed (1) hide show
  1. server_http.py +13 -4
server_http.py CHANGED
@@ -380,8 +380,8 @@ async def mcp_endpoint(
380
  # ============================================================================
381
 
382
  @app.get("/")
383
- async def root():
384
- """Root endpoint with server info."""
385
  return {
386
  "name": "Healthcare API MCP",
387
  "version": "1.0.0",
@@ -389,7 +389,7 @@ async def root():
389
  "protocolVersion": MCP_PROTOCOL_VERSION,
390
  "providers": list(providers.keys()),
391
  "endpoints": {
392
- "mcp": "/mcp (POST) - MCP Streamable HTTP endpoint (recommended)",
393
  "legacy": {
394
  "tools": "/mcp/tools (GET) - List tools (legacy)",
395
  "call": "/mcp/call (POST) - Execute tool (legacy)",
@@ -399,6 +399,15 @@ async def root():
399
  }
400
 
401
 
 
 
 
 
 
 
 
 
 
402
  @app.get("/health")
403
  async def health_check():
404
  """Health check endpoint."""
@@ -544,4 +553,4 @@ if __name__ == "__main__":
544
  host="0.0.0.0",
545
  port=7860,
546
  log_level="info"
547
- )
 
380
  # ============================================================================
381
 
382
  @app.get("/")
383
+ async def root_info():
384
+ """Root endpoint with server info (GET only)."""
385
  return {
386
  "name": "Healthcare API MCP",
387
  "version": "1.0.0",
 
389
  "protocolVersion": MCP_PROTOCOL_VERSION,
390
  "providers": list(providers.keys()),
391
  "endpoints": {
392
+ "mcp": "/ or /mcp (POST) - MCP Streamable HTTP endpoint",
393
  "legacy": {
394
  "tools": "/mcp/tools (GET) - List tools (legacy)",
395
  "call": "/mcp/call (POST) - Execute tool (legacy)",
 
399
  }
400
 
401
 
402
+ @app.post("/")
403
+ async def root_mcp(
404
+ request: Request,
405
+ mcp_session_id: Optional[str] = Header(None, alias="Mcp-Session-Id")
406
+ ):
407
+ """Root MCP endpoint - same as /mcp for compatibility."""
408
+ return await mcp_endpoint(request, mcp_session_id)
409
+
410
+
411
  @app.get("/health")
412
  async def health_check():
413
  """Health check endpoint."""
 
553
  host="0.0.0.0",
554
  port=7860,
555
  log_level="info"
556
+ )