Skip to content

Instantly share code, notes, and snippets.

@Proteusiq
Created December 14, 2025 17:55
Show Gist options
  • Select an option

  • Save Proteusiq/0c0a09f7862847de1fc0d0a4becd1faa to your computer and use it in GitHub Desktop.

Select an option

Save Proteusiq/0c0a09f7862847de1fc0d0a4becd1faa to your computer and use it in GitHub Desktop.
things mcp
from fastmcp import FastMCP
from fastmcp.server.auth.providers.jwt import StaticTokenVerifier
from agents.tools import get_coordinates, get_dmi_weather
# define autheticifacation mechanism
verifier = StaticTokenVerifier(
tokens={
"generatedtoken": {
"client_id": "prayson@42.com",
"scopes": ["read:data", "write:data", "admin:users"]
},
},
required_scopes=["read:data"]
)
mcp = FastMCP(
name="DMIWeather",
auth=verifier,
)
@mcp.tool(
name="get_dmi_weather",
description="Get weather information of a give place in Denmark.",
tags={"catalog", "information"},
meta={"version": "0.1", "author": "prayson-42"}
)
def get_weather(location: str) -> str:
address = "+".join(location.split())
latitude, longitude = get_coordinates(query=address)
weather_report = get_dmi_weather(latitude=latitude, longitude=longitude)
return weather_report
if __name__ == "__main__":
mcp.run(transport="streamable-http", port=9000)
# Or run with: fastmcp run server.py --port 9000 --transport http
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment