aeonshift commited on
Commit
61df420
·
verified ·
1 Parent(s): e57d054

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -3,7 +3,7 @@ import json
3
  import requests
4
  from fastapi import FastAPI
5
  from mcp.server.lowlevel import Server, NotificationOptions
6
- from mcp.server.sse import SSEServerTransport
7
  from mcp import types as mcp_types
8
  import uvicorn
9
 
@@ -82,8 +82,8 @@ async def start_mcp_server():
82
  notification_options=NotificationOptions()
83
  )
84
 
85
- # Hugging Face Spaces handles the port and host, so we specify only the path
86
- transport = SSEServerTransport(path="/airtable/mcp")
87
  await server.run(transport)
88
 
89
  # Start the MCP server when the FastAPI app starts
@@ -98,6 +98,5 @@ async def health_check():
98
  return {"status": "healthy"}
99
 
100
  if __name__ == "__main__":
101
- # Hugging Face Spaces uses PORT environment variable
102
- port = int(os.getenv("PORT", 7860)) # Default to 7860 if PORT is not set
103
  uvicorn.run(app, host="0.0.0.0", port=port)
 
3
  import requests
4
  from fastapi import FastAPI
5
  from mcp.server.lowlevel import Server, NotificationOptions
6
+ from mcp.server.stdio import StdioServerTransport # Use StdioServerTransport
7
  from mcp import types as mcp_types
8
  import uvicorn
9
 
 
82
  notification_options=NotificationOptions()
83
  )
84
 
85
+ # Use StdioServerTransport
86
+ transport = StdioServerTransport()
87
  await server.run(transport)
88
 
89
  # Start the MCP server when the FastAPI app starts
 
98
  return {"status": "healthy"}
99
 
100
  if __name__ == "__main__":
101
+ port = int(os.getenv("PORT", 7860))
 
102
  uvicorn.run(app, host="0.0.0.0", port=port)