viraja1 commited on
Commit
11953e0
·
verified ·
1 Parent(s): a8586f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -837,10 +837,16 @@ async def search_repos(query: str, sort: Optional[str] = None, order: str = "des
837
  data = await _client.search_repositories(query, sort, order, limit)
838
  return [_summarize_repo(repo) for repo in data]
839
 
840
- @server.app.get("/")
 
 
 
 
 
841
  def health():
842
  return {"status": "ok"}
843
 
 
844
  if __name__ == "__main__":
845
  import os
846
  import uvicorn
@@ -848,8 +854,8 @@ if __name__ == "__main__":
848
  port = int(os.getenv("PORT", 8000))
849
 
850
  uvicorn.run(
851
- server.app,
852
  host="0.0.0.0",
853
  port=port,
854
- log_level="info"
855
  )
 
837
  data = await _client.search_repositories(query, sort, order, limit)
838
  return [_summarize_repo(repo) for repo in data]
839
 
840
+ try:
841
+ fastapi_app = server.asgi.app # underlying FastAPI app
842
+ except AttributeError:
843
+ raise RuntimeError("Your FastMCP version does not expose server.asgi.app")
844
+
845
+ @fastapi_app.get("/")
846
  def health():
847
  return {"status": "ok"}
848
 
849
+
850
  if __name__ == "__main__":
851
  import os
852
  import uvicorn
 
854
  port = int(os.getenv("PORT", 8000))
855
 
856
  uvicorn.run(
857
+ server.asgi, # ASGI app to run
858
  host="0.0.0.0",
859
  port=port,
860
+ log_level="info",
861
  )