官方说明Weather MCP Tool for Claude Desktop An MCP (Model Context Protocol) tool that provides real-time weather data, forecasts, and historical weather information using the OpenWeatherMap API, specifically designed for Claude Desktop.
配置模板(请按你的客户端调整)
claude mcp add weather-mcp-claudedesktop -- npx -y weather-mcp-claudedesktop
An MCP (Model Context Protocol) tool that provides real-time weather data, forecasts, and historical weather information using the OpenWeatherMap API, specifically designed for Claude Desktop. Tutorial For a detailed guide on setting up and using this tool, check out our comprehensive Medium tutorial: Tutorial: Using Claude Desktop with Weather MCP Tool to Access Real-Time Weather Data Worldwide Features - Real-time weather conditions for any location - Weather forecasts (up to 5 days) - Historical weather data (last 5 days) - Air quality information - Weather alerts and warnings - Location search functionality Setup 1. Ensure you have Python 3.10 or higher installed 2. Install dependencies: 3. Get an API key from OpenWeatherMap (free tier available) - Note: New API keys may take up to 24 hours to activate 4. Set up environment variables for API key (recommended method): - Create a .env file in the project directory - Add your API key to the file: - Add .env to your .gitignore file to prevent committing sensitive data 5. Update main.py to use the environment variable: Integration with Claude Desktop 1. Configure your MCP settings in Claude Desktop by adding the following to your MCP configuration: 2. Replace the path with the full path to your main.py file 3. Run the server using: 4. Keep the server running while using Claude Desktop Available Tools 1. get_current_weather Get real-time weather conditions for a location: 2. get_weather_forecast Get weather forecast for a location: 3. get_air_quality Get air quality data for a location: 4. get_historical_weather Get historical weather data for a specific date: 5. search_location Search for locations by name: 6. get_weather_alerts Get weather alerts for a location: Sample Queries You can ask Claude Desktop questions like: - "What's the current weather in New York?" - "Show me the 5-day forecast for London" - "What's the air quality like in Beijing today?" - "How was the weather in Paris on March 14th?" - "Search for locations named 'Tokyo'" - "Are there any weather alerts for Miami?" - "Compare the current weather in Chicago, Miami, and Seattle" - "Show me a comparison of air quality in Beijing, Los Angeles, and Delhi" Error Handling All tools include proper error handling and will return an error message if something goes wrong: Troubleshooting If the MCP server is not working in Claude Desktop: 1. Make sure the server is running - you should see output when you start the script 2. Verify the path in your settings is correct and absolute 3. Make sure Python 3.10+ is in your system PATH