Weather MCP Server
An example Model Context Protocol (MCP) server that exposes a get_weather tool, letting any MCP-compatible AI client fetch current temperatures by city name.
How it works
- Resolves the city name to coordinates via the Open-Meteo Geocoding API
- Fetches the current temperature from the Open-Meteo Forecast API
No API key required — both APIs are free and open.
Tool
| Tool | Description | Input |
|---|---|---|
get_weather | Get current temperature for a city | city (string) |
Example response: San Francisco: 14.2°C
Setup
npm install
Running the server
node weather-server.js
The server communicates over stdio using the MCP protocol.
Connecting to Claude Code
The repo includes a .mcp.json file that Claude Code picks up automatically. When you open this directory in Claude Code, the weather-server MCP server is registered and the get_weather tool becomes available.
To connect manually, add the following to your MCP client config:
{
"mcpServers": {
"weather-server": {
"command": "node",
"args": ["./weather-server.js"]
}
}
}
Requirements
- Node.js 18+ (native
fetchrequired) - No external API keys