MCP 天气服务端
基于 Model Context Protocol (MCP) 的天气信息服务,提供实时天气和预报功能。
快速入门
-
安装依赖包: npm install mcp-weather-api
-
使用 npx 直接运行: npx mcp-weather-api
-
配置环境变量(可选): export QWEATHER_API_KEY=your-api-key export WEATHER_DEFAULT_LOCATION=101010100
-
在 MCP 中添加配置: { "mcpServers": { "weather": { "command": "npx", "args": ["-y", "mcp-weather-api"] } } }
-
调用天气工具,如获取当前天气: { location: "New York, NY", options: { units: "metric", language: "en" } }