Spaces:
Sleeping
Sleeping
Update server.py
Browse files
server.py
CHANGED
@@ -1,11 +1,9 @@
|
|
1 |
-
import os
|
2 |
import random
|
3 |
import string
|
|
|
4 |
|
5 |
-
from fastmcp import FastMCP
|
6 |
from pydantic import BaseModel
|
7 |
-
from starlette.requests import Request
|
8 |
-
from starlette.responses import PlainTextResponse
|
9 |
|
10 |
# Create an MCP server
|
11 |
mcp = FastMCP("Airline Agent")
|
@@ -89,9 +87,6 @@ flight_database = {
|
|
89 |
itinery_database = {}
|
90 |
ticket_database = {}
|
91 |
|
92 |
-
@mcp.custom_route("/health", methods=["GET"])
|
93 |
-
async def health_check(request: Request) -> PlainTextResponse:
|
94 |
-
return PlainTextResponse("OK")
|
95 |
|
96 |
@mcp.tool()
|
97 |
def fetch_flight_info(date: Date, origin: str, destination: str):
|
@@ -175,8 +170,4 @@ def file_ticket(user_request: str, user_profile: UserProfile):
|
|
175 |
|
176 |
|
177 |
if __name__ == "__main__":
|
178 |
-
|
179 |
-
transport="streamable-http",
|
180 |
-
host="0.0.0.0",
|
181 |
-
port=8000
|
182 |
-
)
|
|
|
|
|
1 |
import random
|
2 |
import string
|
3 |
+
import uvicorn
|
4 |
|
5 |
+
from mcp.server.fastmcp import FastMCP
|
6 |
from pydantic import BaseModel
|
|
|
|
|
7 |
|
8 |
# Create an MCP server
|
9 |
mcp = FastMCP("Airline Agent")
|
|
|
87 |
itinery_database = {}
|
88 |
ticket_database = {}
|
89 |
|
|
|
|
|
|
|
90 |
|
91 |
@mcp.tool()
|
92 |
def fetch_flight_info(date: Date, origin: str, destination: str):
|
|
|
170 |
|
171 |
|
172 |
if __name__ == "__main__":
|
173 |
+
uvicorn.run(mcp.streamable_http_app, host="0.0.0.0", port=8000)
|
|
|
|
|
|
|
|