A Model Context Protocol (MCP) server that provides weather information using the OpenWeatherMap API.
- Node.js (v14 or higher)
- npm
- OpenWeatherMap API key
-
Clone or download this repository
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory:touch .env
-
Add your OpenWeatherMap API key to the
.env
file:OPENWEATHER_API_KEY=your_openweathermap_api_key_here
You can get a free API key from OpenWeatherMap.
Add this server to your MCP configuration file:
{
"weather": {
"command": "node",
"args": ["index.js"],
"cwd": "/path/to/weather-mcp-server"
}
}
getWeather
: Get current weather information for any city
Run the test suite:
npm test
Variable | Description | Required |
---|---|---|
OPENWEATHER_API_KEY |
Your OpenWeatherMap API key | Yes |
Once configured with Claude Code, you can ask for weather information:
- "What's the weather in London?"
- "Get me the current weather in Tokyo"
- "How's the weather in New York?"