Skip to main content
Glama
Domt301

Weather MCP Server

by Domt301

Weather MCP Server

A Model Context Protocol (MCP) server that provides weather information and time utilities for AI assistants and applications.

Overview

This MCP server implements a simple weather service with two main tools:

  • Weather Information: Get current weather data for any city

  • Time Service: Retrieve the current timestamp

Built with TypeScript and the official MCP SDK, this server demonstrates how to create custom tools that can be used by Claude Desktop and other MCP-compatible clients.

Related MCP server: Weather MCP Server

Features

  • šŸŒ¤ļø Weather Data: Fetch weather information for any city worldwide

  • ā° Time Service: Get current timestamp in ISO format

  • šŸ”’ Input Validation: Robust parameter validation using Zod schemas

  • šŸš€ TypeScript: Full type safety and modern JavaScript features

  • šŸ“” stdio Transport: Communicates via standard input/output for seamless integration

Installation

Prerequisites

  • Node.js 18+

  • npm or yarn package manager

Setup

  1. Clone the repository

    git clone <repository-url>
    cd my-mcp-server
  2. Install dependencies

    npm install
  3. Build the project

    npm run build

Usage

Development

Run the server in development mode:

npm run dev

Production

Start the built server:

npm start

Integration with Claude Desktop

Add this server to your Claude Desktop configuration:

{
  "mcpServers": {
    "weather-server": {
      "command": "node",
      "args": ["/path/to/my-mcp-server/build/index.js"]
    }
  }
}

Available Tools

get_weather

Retrieves weather information for a specified city.

Parameters:

  • city (string, required): The city to get weather for

  • units (string, optional): Temperature units - "metric" or "imperial" (defaults to "metric")

Example Response:

Weather in London:
Temperature: 18°C
Conditions: Partly cloudy
Humidity: 65%

get_time

Returns the current timestamp in ISO 8601 format.

Parameters: None

Example Response:

Current time: 2025-01-08T14:30:25.123Z

Project Structure

my-mcp-server/
ā”œā”€ā”€ index.ts          # Main server implementation
ā”œā”€ā”€ package.json      # Project dependencies and scripts
ā”œā”€ā”€ tsconfig.json     # TypeScript configuration
ā”œā”€ā”€ build/           # Compiled JavaScript output
└── README.md        # This file

Technical Details

Dependencies

  • @modelcontextprotocol/sdk: Official MCP SDK for server implementation

  • axios: HTTP client for external API calls

  • zod: Runtime type validation and parsing

Architecture

The server follows the MCP specification:

  1. Tool Registration: Tools are registered via ListToolsRequestSchema handler

  2. Tool Execution: Tool calls are handled via CallToolRequestSchema handler

  3. Error Handling: Proper MCP error codes and validation

  4. Transport: Uses stdio transport for communication

Weather Data

Currently returns mock weather data for demonstration purposes. To integrate with a real weather API:

  1. Sign up for a weather service (e.g., OpenWeatherMap)

  2. Replace the mock data generation in the get_weather case

  3. Add proper API key handling and HTTP requests

Scripts

  • npm run build - Compile TypeScript to JavaScript

  • npm run dev - Build and run in development mode

  • npm start - Run the compiled server

Contributing

  1. Fork the repository

  2. Create a feature branch (git checkout -b feature/amazing-feature)

  3. Make your changes

  4. Build and test (npm run build)

  5. Commit your changes (git commit -m 'Add amazing feature')

  6. Push to the branch (git push origin feature/amazing-feature)

  7. Open a Pull Request

License

This project is open source and available under the MIT License.

Learn More


Built with ā¤ļø using TypeScript and the Model Context Protocol

F
license - not found
-
quality - not tested
D
maintenance

Maintenance

–Maintainers
–Response time
–Release cycle
–Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    -
    quality
    D
    maintenance
    Provides real-time weather information and forecasts, connecting AI assistants with live weather data for current conditions and multi-day forecasts for any location worldwide.
    Last updated
  • F
    license
    -
    quality
    D
    maintenance
    Enables AI assistants to fetch current weather conditions and forecasts for any city using the Open-Meteo API. Provides temperature, precipitation, and hourly forecast data through natural language queries.
    Last updated
  • F
    license
    -
    quality
    D
    maintenance
    Provides weather information through OpenWeather API, enabling users to get current weather conditions, 5-day forecasts, and perform temperature conversions for any city. Offers a secure interface for AI assistants to access comprehensive weather data including temperature, humidity, wind, and pressure information.
    Last updated
  • A
    license
    -
    quality
    D
    maintenance
    Provides real-time weather data and forecasts for locations worldwide using the OpenWeatherMap API. It enables AI assistants to retrieve current conditions, temperature, and forecasts through a simple tool-based interface.
    Last updated
    MIT

View all related MCP servers

Related MCP Connectors

  • A real clock for AI agents: current time, timezone conversion, and DST facts from the IANA tzdb.

  • 60+ units, live FX, timezones, and date arithmetic for AI agents.

  • US weather, alerts, earthquakes and elevation for AI agents, from NWS/NOAA and USGS. No API keys.

View all MCP Connectors

Latest Blog Posts

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/Domt301/Claude_mcp_weather_server'

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