Skip to main content

An MCP server for weather information

Project description

smithery badge PyPI - Downloads PyPI - Version

Weather MCP Server

A Model Context Protocol (MCP) server that provides weather information using the Open-Meteo API.

Features

  • Get current weather information for a specified city.

Installation

Pip Installation and Usage, This package can be installed using pip:

pip install mcp_weather_server

This server is designed to be installed manually by adding its configuration to the cline_mcp_settings.json file.

  1. Add the following entry to the mcpServers object in your cline_mcp_settings.json file:
{
  "mcpServers": {
    "weather": {
      "command": "python",
      "args": [
        "-m",
        "mcp_weather_server"
      ],
      "disabled": false,
      "autoApprove": []
    }
  }
}
  1. Save the cline_mcp_settings.json file.

Configuration

This server does not require an API key. It uses the Open-Meteo API, which is free and open-source.

Usage

This server provides several tools: get_weather, get_weather_by_datetime_range, and get_current_datetime.

get_weather

Retrieves the current weather information for a given city.

Parameters:

  • city (string, required): The name of the city.

Example:

To get the weather in Taipei, you would use the tool like this:

<use_mcp_tool>
<server_name>weather</server_name>
<tool_name>get_weather</tool_name>
<arguments>
{
  "city": "Taipei"
}
</arguments>
</use_mcp_tool>

get_weather_by_datetime_range

Retrieves weather information for a specified city between start and end dates.

Parameters:

  • city (string, required): The name of the city.
  • start_date (string, required): Start date in format YYYY-MM-DD (ISO 8601).
  • end_date (string, required): End date in format YYYY-MM-DD (ISO 8601).

Example:

To get the weather in London between 2024-01-01 and 2024-01-07, you would use the tool like this:

<use_mcp_tool>
<server_name>weather</server_name>
<tool_name>get_weather_by_datetime_range</tool_name>
<arguments>
{
  "city": "London",
  "start_date": "2024-01-01",
  "end_date": "2024-01-07"
}
</arguments>
</use_mcp_tool>

get_current_datetime

Retrieves the current time in a specified timezone.

Parameters:

  • timezone_name (string, required): IANA timezone name (e.g., 'America/New_York', 'Europe/London'). Use UTC timezone if no timezone provided by the user.

Example:

To get the current time in New York, you would use the tool like this:

<use_mcp_tool>
<server_name>weather</server_name>
<tool_name>get_current_datetime</tool_name>
<arguments>
{
  "timezone_name": "America/New_York"
}
</arguments>
</use_mcp_tool>

For developers

Change Working Directory Before Running Python

python -m mcp_weather_server

Or if you want Python to find your package no matter where you run from, you can set PYTHONPATH:

set PYTHONPATH=C:\xxx\mcp_weather_server\src
python -m mcp_weather_server

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_weather_server-0.2.1.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_weather_server-0.2.1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file mcp_weather_server-0.2.1.tar.gz.

File metadata

  • Download URL: mcp_weather_server-0.2.1.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mcp_weather_server-0.2.1.tar.gz
Algorithm Hash digest
SHA256 de0abbe613ebd087e0936f415aae6a281df5295df0c3ffebc3f132f49ef11341
MD5 cce85057d45a5c26bc4eb4e50584c006
BLAKE2b-256 2bc037c7eb71b47c589877828f4ef10278f65e65f7c07e91814416d44f26c298

See more details on using hashes here.

File details

Details for the file mcp_weather_server-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_weather_server-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b40a101d4e231eda01a5a22754265cebb223a68621f25a73c7d7131f5f54b890
MD5 a944ea2f0fd4c2b8ab30de9541941773
BLAKE2b-256 8f1d245448e4be8326a513059debeb6aad644be0347070d2bd6cf3e7e8870f8b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page