mcp-server-weather-js
by: hideya
Simple Weather MCP Server Example
📌Overview
Purpose: To provide a Node.js server implementation of the Model Context Protocol (MCP) for accessing weather information across the US.
Overview: This project serves as a practical example from the MCP Quickstart, offering an easy-to-use npm package for fetching weather data. It integrates seamlessly with tools like Claude Desktop for user-friendly access to weather alerts and forecasts.
Key Features:
-
get-alerts: Retrieves weather alerts for a specified US state by using its two-letter code (e.g., CA for California).
-
get-forecast: Provides weather forecast information for a specific location in the US, based on latitude and longitude coordinates.
Simple Weather MCP Server Example
Node.js server implementing the Model Context Protocol (MCP)
for accessing weather information in the US.
This example is explained in MCP Quickstart and is hosted as an npm package for convenient use with npx
.
Usage with Claude Desktop
Merge the following JSON fragment into your claude_desktop_config.json
.
# MacOS/Linux
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
# Windows
code $env:AppData\Claude\claude_desktop_config.json
{
"mcpServers": {
"weather": {
"command": "npx",
"args": [
"-y",
"@h1deya/mcp-server-weather"
]
}
}
}
Refer to the "Testing your server with Claude for Desktop" section of MCP Quickstart for details.
Tools
-
get-alerts
Get weather alerts for a US state.
Input:state
(string): Two-letter US state code (e.g., CA, NY) -
get-forecast
Get weather forecast for a location in the US
Inputs:latitude
(number): Latitude of the locationlongitude
(number): Longitude of the location
Example Queries
- Tomorrow's weather in Palo Alto?
- Any weather alerts in California?
Original Author and License
This example is based on the code explained in MCP Quickstart, whose license is CC-BY-4.0.
The completed code examples are also hosted in a repository licensed under MIT. This repo follows the MIT license.