Skip to main content
Glama

MCP Container Weather Server

by Pimmetjeoss
weather.py1.71 kB
import asyncio import httpx from mcp.server.models import InitializationOptions from mcp.server import NotificationOptions, Server from mcp.server.stdio import stdio_server from mcp.types import Resource, Tool, TextContent server = Server("weather-server") @server.list_tools() async def handle_list_tools() -> list[Tool]: return [ Tool( name="get-weather", description="Krijg het huidige weer voor een stad", inputSchema={ "type": "object", "properties": { "city": { "type": "string", "description": "Naam van de stad" } }, "required": ["city"] } ) ] @server.call_tool() async def handle_call_tool(name: str, arguments: dict) -> list[TextContent]: if name == "get-weather": city = arguments.get("city") # Simpele mock data - vervang met echte API call weather_data = f"Het weer in {city}: Zonnig, 20°C" return [TextContent(type="text", text=weather_data)] raise ValueError(f"Onbekende tool: {name}") async def main(): async with stdio_server() as (read_stream, write_stream): await server.run( read_stream, write_stream, InitializationOptions( server_name="weather-server", server_version="1.0.0", capabilities=server.get_capabilities( notification_options=NotificationOptions(), experimental_capabilities={}, ) ) ) if __name__ == "__main__": asyncio.run(main())

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Pimmetjeoss/MCP_container'

If you have feedback or need assistance with the MCP directory API, please join our Discord server