This commit is contained in:
2026-01-23 09:27:23 +03:00
commit 91cdb1328b
5 changed files with 74 additions and 0 deletions

29
weather_mcp.py Normal file
View File

@@ -0,0 +1,29 @@
from mcp.server.fastmcp import FastMCP
from pydantic import BaseModel
class WeatherResult(BaseModel):
city: str
temperature: int
units: str
condition: str
server = FastMCP(name="weather")
@server.tool(
name="get_weather",
description="Возвращает актуальную погоду по городу",
)
async def get_weather(city: str, units: str = "metric") -> WeatherResult:
return WeatherResult(
city=city,
temperature=18,
units=units,
condition="partly cloudy",
)
if __name__ == "__main__":
server.run()