Weather MCP Agent
Provides current weather and forecast data for any city via OpenWeatherMap. Can be used with Ollama or Claude Desktop for natural-language weather queries.
README
Weather MCP Agent
Introduction
This project was built by Yehya Abou Khechfe.
The project is a Weather MCP Agent that retrieves current weather conditions and forecasts for any city, using the OpenWeatherMap API.
The MCP server exposes weather tools that can be consumed in multiple ways:
- Connected to Ollama (local LLM) for natural-language interaction — see
ollama_weather_mcp/ollama_mcp_client.pyandollama_weather_mcp/ollama_mcp_server.py. - Connected to Claude Desktop — add the server to your Claude configuration file (
claude_desktop_config.json) as described below. - A simple client with no LLM integrated, used for testing the server directly — see
weather_mcp/mcp_client.pyandweather_mcp/mcp_server.py.
Project Structure
wheather-mcp-agent/
├── ollama_weather_mcp/
│ ├── ollama_mcp_client.py # Interactive client powered by Ollama
│ └── ollama_mcp_server.py # MCP server extended with a prompt for Ollama
├── weather_mcp/
│ ├── __init__.py
│ ├── mcp_client.py # Simple client (no LLM) for testing the server
│ └── mcp_server.py # Core MCP server exposing the weather tools
├── .env # Environment variables (OpenWeatherMap API key)
├── main.py
├── pyproject.toml
└── README.md
Prerequisites
- Python 3.10+
- uv — used as the package and project manager
- Ollama installed and running locally, with a pulled model (e.g.
llama3) mcp[cli]— the MCP Python SDKhttpx— for async HTTP requests to the OpenWeatherMap APIpython-dotenv— for loading environment variables from.env- An OpenWeatherMap API key — get one at openweathermap.org/api
Installing dependencies with uv
uv sync
Setting up your .env file
Create a .env file at the project root:
OPENWEATHER_API_KEY=your_api_key_here
Connecting to Claude Desktop
To use this MCP server with Claude Desktop, add it to your Claude configuration file (claude_desktop_config.json):
{
"mcpServers": {
"weather": {
"command": "uv",
"args": ["run", "--directory", "C:\\path\\to\\wheather-mcp-agent", "weather_mcp/mcp_server.py"]
}
}
}
Restart Claude Desktop after saving the configuration — the weather tools should then appear as available tools in a new conversation.
Running the Ollama-powered client
uv run .\ollama_weather_mcp\ollama_mcp_client.py
Example session
[INFO] Server-client connection initialized
Weather Assistant — ask about current conditions or the forecast for any city.
You can also ask general questions.
Type 'q', 'exit', or 'quit' to leave.
You: what is the current weather in paris
[INFO] Requesting Ollama to extract tool and arguments...
Current weather in Paris, FR: clear sky, 32.79°C (feels like 31.48°C), ranging from 32.3°C to 35.03°C, with 28% humidity.
You: and tomorrow ?
[INFO] Requesting Ollama to extract tool and arguments...
--------------------
Weather Forecast in Paris, FR
2026-07-29 12:00:00 — 33.5°C, clear sky
2026-07-29 15:00:00 — 35.88°C, clear sky
2026-07-29 18:00:00 — 37.16°C, clear sky
2026-07-29 21:00:00 — 30.5°C, clear sky
2026-07-30 00:00:00 — 25.28°C, clear sky
2026-07-30 03:00:00 — 22.37°C, scattered clouds
2026-07-30 06:00:00 — 21.97°C, broken clouds
2026-07-30 09:00:00 — 24.71°C, overcast clouds
2026-07-30 12:00:00 — 28.47°C, overcast clouds
2026-07-30 15:00:00 — 33.05°C, clear sky
--------------------
You: what is the capital of lebanon
[INFO] Requesting Ollama to extract tool and arguments...
[INFO] Requesting Ollama to answer a general question ...
Answer: The capital of Lebanon is Beirut (بيروت).
You:
Running the simple test client (no LLM)
Useful for testing the MCP server's tools directly, without going through an LLM:
uv run .\weather_mcp\mcp_client.py
Available Tools
| Tool | Description |
|---|---|
fetch_current_weather |
Fetches the current weather conditions for a given city. |
fetch_weather_forecast |
Fetches the weather forecast (3-hour intervals) for a given city. |
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。