MCP weather server using MSN Weather API
Project description
MCP Server MSN Weather
A Model Context Protocol (MCP) server that provides weather data using the MSN Weather API. This server enables access to weather alerts and forecasts for any location by name or address.
Installation
pip install mcp-server-msnweather
Requirements
- Python >= 3.10
- httpx >= 0.28.1
- mcp[cli] >= 1.2.0
Usage
-
You'll need to obtain two API keys:
- MSN Weather API key from Microsoft (for weather data)
- Bing Maps API key (for location search and geocoding)
-
Start the server with your API keys:
mcp-server-msnweather --wxapikey YOUR_WEATHER_API_KEY --autosuggestapikey YOUR_BING_MAPS_API_KEY
Available Tools
get_alerts
Fetches weather alerts for a specific location by name.
Parameters:
location_name(string): Name of the location (e.g., "Seattle, WA")
Example:
result = await mcp.call_tool("get_alerts", {
"location_name": "Seattle, WA"
})
get_forecast
Gets a 7-day weather forecast for a specific location by name.
Parameters:
location_name(string): Name of the location (e.g., "Seattle, WA")
Example:
result = await mcp.call_tool("get_forecast", {
"location_name": "Seattle, WA"
})
get_location_coordinates
Converts a location name to complete location information including latitude and longitude coordinates, region, country, and address.
Parameters:
location_name(string): Name of the location to look up (e.g., "Seattle, WA")
Example:
result = await mcp.call_tool("get_location_coordinates", {
"location_name": "Seattle, WA"
})
Development
To set up the development environment:
# Clone the repository
git clone https://github.com/yourusername/mcp-server-msnweather.git
cd mcp-server-msnweather
# Create a virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows use: .venv\Scripts\activate
# Install in development mode
pip install -e .
Running Tests
The project includes debug scripts in the debug/ directory to test different features:
# Set your API keys as environment variables
export MSN_WEATHER_API_KEY="your-weather-api-key"
export BING_MAPS_API_KEY="your-bing-maps-api-key"
# Test location lookup
python debug/test_location.py
# Test weather alerts
python debug/test_alerts.py
# Test weather forecast
python debug/test_forecast.py
License
See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_server_msnweather-0.3.0.tar.gz.
File metadata
- Download URL: mcp_server_msnweather-0.3.0.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4a73e164964ecdaa99caaddd2c0b5fcef9dbc759077046d9d760714793cbebe
|
|
| MD5 |
16f0c074023902b92eacce55239ddbfd
|
|
| BLAKE2b-256 |
a863a8b8d49a7baa810865f72255f1501a926fd76750440a75ad25a3554a0591
|
File details
Details for the file mcp_server_msnweather-0.3.0-py3-none-any.whl.
File metadata
- Download URL: mcp_server_msnweather-0.3.0-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89adcd756a178d1fd3016c699b46bd981cd06b7390c1afb9d0b4961894af3526
|
|
| MD5 |
50af5053d01720c7c9de85dab012f6a4
|
|
| BLAKE2b-256 |
8c7d09a7ba0761b37257f823abe4a776e8790b9fda6a761367af8193f86f1a0f
|