Skip to main content
Glama

Weather MCP Server

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

  1. Install dependencies:

npm install

Usage

Development Mode

Run the server with auto-reload:

npm run dev

Production Mode

  1. Build the TypeScript code:

npm run build
  1. Start the server:

npm start

The server will start on http://localhost:3000/mcp by default. You can change the port by setting the PORT environment variable:

PORT=8080 npm run dev

Connecting to the Server

Using MCP Inspector

The easiest way to test your server:

npx @modelcontextprotocol/inspector

Then connect to: http://localhost:3000/mcp

Using Claude Code

claude mcp add --transport http weather-server http://localhost:3000/mcp

Using VS Code

code --add-mcp "{\"name\":\"weather-server\",\"type\":\"http\",\"url\":\"http://localhost:3000/mcp\"}"

Using Cursor

Click this deeplink

Available Tools

1. get-weather

Get current weather information for any city.

Input:

{ "city": "Sydney" }

Output:

{ "city": "Sydney, Australia", "temperature": 22.5, "weatherCode": 0, "windSpeed": 15.2, "humidity": 65, "description": "Clear sky" }

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:

{ "name": "Alice" }

Output:

{ "greeting": "Hello, Alice! Welcome to the Weather MCP Server!" }

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

weather-mcp-server/ ā”œā”€ā”€ src/ │ └── index.ts # Main server implementation ā”œā”€ā”€ dist/ # Compiled JavaScript (generated) ā”œā”€ā”€ package.json # Dependencies and scripts ā”œā”€ā”€ tsconfig.json # TypeScript configuration └── README.md # This file

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:

curl http://localhost:3000/health

Response:

{ "status": "ok", "server": "weather-mcp-server", "version": "1.0.0" }

Troubleshooting

Port already in use

If port 3000 is already in use, specify a different port:

PORT=8080 npm run dev

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

-
security - not tested
F
license - not found
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Provides current weather information for any city worldwide using the free Open-Meteo API, enabling users to query temperature, wind speed, humidity, and weather conditions through natural language.

  1. Features
    1. Prerequisites
      1. Installation
        1. Usage
          1. Development Mode
          2. Production Mode
        2. Connecting to the Server
          1. Using MCP Inspector
          2. Using Claude Code
          3. Using VS Code
          4. Using Cursor
        3. Available Tools
          1. 1. get-weather
          2. 2. greet
        4. API Information
          1. Project Structure
            1. Development
              1. Health Check
                1. Troubleshooting
                  1. Port already in use
                  2. City not found
                2. License

                  MCP directory API

                  We provide all the information about MCP servers via our MCP API.

                  curl -X GET 'https://glama.ai/api/mcp/v1/servers/xiaoyuchenhot/weather-mcp-server'

                  If you have feedback or need assistance with the MCP directory API, please join our Discord server