by isdaniel
A Model Context Protocol (MCP) server that provides weather information using the Open-Meteo API.
mcp_weather_server is a Model Context Protocol (MCP) server designed to provide weather information by leveraging the free and open-source Open-Meteo API.
To use mcp_weather_server, you first need to install it via pip:
pip install mcp_weather_server
After installation, you need to configure it by adding an entry to the mcpServers
object in your cline_mcp_settings.json
file. This involves specifying the command to run the server and optionally disabling it or setting auto-approval.
Once configured, you can interact with the server using specific tools within your MCP environment. Examples are provided for each tool, demonstrating how to structure your requests.
Q: Does mcp_weather_server require an API key? A: No, mcp_weather_server uses the Open-Meteo API, which is free and open-source and does not require an API key.
Q: How do I get current weather for a city?
A: You can use the get_weather
tool and provide the city name as a parameter.
Q: Can I get historical weather data?
A: Yes, the get_weather_by_datetime_range
tool allows you to specify a city, start date, and end date to retrieve historical weather information.
Q: How do I get the current time in a specific timezone?
A: Use the get_current_datetime
tool and provide the IANA timezone name (e.g., 'America/New_York'). If no timezone is provided, it defaults to UTC.
A Model Context Protocol (MCP) server that provides weather information using the Open-Meteo API.
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.
mcpServers
object in your cline_mcp_settings.json
file:{
"mcpServers": {
"weather": {
"command": "python",
"args": [
"-m",
"mcp_weather_server"
],
"disabled": false,
"autoApprove": []
}
}
}
cline_mcp_settings.json
file.This server does not require an API key. It uses the Open-Meteo API, which is free and open-source.
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>
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
Reviews feature coming soon
Stay tuned for community discussions and feedback