Spaces:
Paused
Paused
Update app.py
Browse files
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.
|
| 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 |
-
#
|
| 86 |
-
transport =
|
| 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 |
-
|
| 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)
|