Spaces:
Sleeping
Sleeping
| import httpx | |
| from mcp.server.fastmcp import FastMCP | |
| mcp = FastMCP("My App") | |
| def calculate_bmi(weight_kg: float, height_m: float) -> float: | |
| """Calculate BMI given weight in kg and height in meters""" | |
| return weight_kg / (height_m**2) | |
| async def fetch_weather(city: str) -> str: | |
| """Fetch current weather for a city""" | |
| async with httpx.AsyncClient() as client: | |
| response = await client.get(f"https://api.weather.com/{city}") | |
| return response.text | |
| app = mcp.sse_app() | |
| #from fastapi import FastAPI | |
| # | |
| #app = FastAPI() | |
| # | |
| #@app.get("/") | |
| #def greet_json(): | |
| # return {"Hello": "World!"} | |