home / mcp / weather mcp server
Provides weather data and forecasts through MCP by querying a public weather source and returning current conditions and upcoming forecasts.
Configuration
View docs{
"mcpServers": {
"koya-rama-mcp": {
"command": "python",
"args": [
"weather_mcp_server.py"
],
"env": {
"PYTHONPATH": "."
}
}
}
}You can run the Weather Chat Assistant MCP Server to power a chat-based weather query experience. The MCP server exposes weather tools that let a client request current conditions and forecasts, enabling real-time, natural-language weather information in your app.
You will connect a client to the Weather Chat Assistant MCP Server and use its weather tools to ask for current conditions or forecasts. The server provides two primary tools you can invoke via the MCP protocol: get_weather and get_forecast. Use these tools through your MCP client to request weather data for a city, region, or country, and then display the results in your chat UI.
Prerequisites: you need Python installed on your system. You also need pip to install dependencies.
pip install -r requirements.txtNavigate to the MCP server directory, install dependencies, and start the server.
cd weather-mcp-server
pip install -r requirements.txt
python weather_mcp_server.pyIf you want to test the MCP server from another terminal, you can run a small client snippet that connects, invokes a weather query, and then disconnects. This example uses the WeatherMCPClient to fetch current weather for London.
python -c "
import asyncio
from mcp_client import WeatherMCPClient
async def test():
client = WeatherMCPClient()
if await client.connect():
result = await client.get_weather('London')
print(result)
await client.disconnect()
asyncio.run(test())
"Common issues include missing dependencies, network timeouts when querying the weather service, or port conflicts. Ensure you installed dependencies with the correct Python environment and that you can reach the required weather data sources.
If you encounter a module not found error, reinstall dependencies and retry.
Fetches current weather data for a given location, including temperature, conditions, humidity, and wind.
Returns a weather forecast for a specified location, typically covering upcoming days with conditions and temperatures.