Weather MCP Server
A simple Model Context Protocol (MCP) server built with TypeScript that provides weather information using the Open-Meteo API.
Features
š¤ļø Get Weather: Fetch current weather data for any city worldwide
š Greet: Simple greeting tool for testing
š Uses free Open-Meteo API (no API key required)
š Built with MCP TypeScript SDK
š” HTTP transport support
Prerequisites
Node.js 18+
npm or yarn
Installation
Install dependencies:
Usage
Development Mode
Run the server with auto-reload:
Production Mode
Build the TypeScript code:
Start the server:
The server will start on http://localhost:3000/mcp by default. You can change the port by setting the PORT environment variable:
Connecting to the Server
Using MCP Inspector
The easiest way to test your server:
Then connect to: http://localhost:3000/mcp
Using Claude Code
Using VS Code
Using Cursor
Click this deeplink
Available Tools
1. get-weather
Get current weather information for any city.
Input:
Output:
Example queries:
"What's the weather in Tokyo?"
"Get me the current temperature in London"
"How's the weather in New York?"
2. greet
Simple greeting tool for testing the server.
Input:
Output:
API Information
This server uses the free Open-Meteo API which provides:
Current weather conditions
No API key required
Global coverage
Reliable geocoding
Project Structure
Development
The server is built using:
@modelcontextprotocol/sdk: MCP TypeScript SDK
Express: HTTP server
Zod: Schema validation
TypeScript: Type safety
Health Check
The server includes a health check endpoint:
Response:
Troubleshooting
Port already in use
If port 3000 is already in use, specify a different port:
City not found
Make sure you're using the correct city name. The API uses geocoding to find cities, so try:
Full city names: "New York" instead of "NYC"
Including country if ambiguous: "London, UK" or "London, Ontario"
License
MIT