Local Weather & International Time MCP Agent
Provides real-time weather forecasts and international time details through MCP tools, including geocoding, hourly/daily forecasts, and timezone information for any city.
README
🌤️ Local Weather & International Time MCP Agent
A high-performance, real-time Weather and International Time Dashboard built on Model Context Protocol (MCP) using Python, FastMCP / MCPServer, Streamlit, Open-Meteo API, and TimeAPI.io.
🏛️ System Architecture & Workflow
The application leverages a decoupled client-server architecture powered by the Model Context Protocol (MCP) over Standard Input/Output (stdio) JSON-RPC 2.0 communication.
graph TD
subgraph UI_Layer["🖥️ Frontend UI Layer (Streamlit)"]
UI["app.py (Streamlit Web Dashboard)"]
CSS["Dynamic Glassmorphism Theme Engine"]
Cache["@st.cache_data (5-Min Caching Layer)"]
end
subgraph MCP_Client_Layer["⚡ MCP Client IPC Layer"]
ClientSession["mcp.Client (Stdio Client Session)"]
ProcessParams["StdioServerParameters (sys.executable server.py)"]
end
subgraph MCP_Server_Layer["🔌 MCP Server Layer (server.py)"]
MCPServer["mcp.server.MCPServer"]
ToolWeather["@mcp.tool() weather"]
ToolTime["@mcp.tool() time_info"]
ToolGeocode["@mcp.tool() geocode"]
end
subgraph Backend_Services["⚙️ External Services & Logic Layer"]
WeatherEngine["weather.py (Open-Meteo Integration)"]
TimeEngine["time_service.py (TimeAPI.io & ZoneInfo)"]
end
subgraph External_APIs["🌐 External REST APIs"]
OpenMeteo["Open-Meteo Forecast & Geocoding API"]
TimeAPI["TimeAPI.io REST API Service"]
end
UI --> Cache
Cache --> ClientSession
ClientSession -->|JSON-RPC 2.0 via Stdio| ProcessParams
ProcessParams --> MCPServer
MCPServer --> ToolWeather
MCPServer --> ToolTime
MCPServer --> ToolGeocode
ToolWeather --> WeatherEngine
ToolTime --> TimeEngine
WeatherEngine -->|Async HTTP GET| OpenMeteo
TimeEngine -->|Async HTTP GET| TimeAPI
🔄 High-Level Sequence Workflow
sequenceDiagram
autonumber
actor User
participant Dashboard as Streamlit UI (app.py)
participant Client as MCP Client Session
participant Server as MCP Server (server.py)
participant ExternalAPIs as External REST APIs (Open-Meteo & TimeAPI)
User->>Dashboard: Search City (e.g. "Berlin")
Dashboard->>Client: Request Weather & International Time
Client->>Server: Call MCP Tools (weather & time_info)
Server->>ExternalAPIs: Fetch Live Weather & Time Data
ExternalAPIs-->>Server: Return Data Payloads
Server-->>Client: Return Structured MCP Tool Response
Client-->>Dashboard: Deliver Formatted Weather & Time Data
Dashboard-->>User: Render Dynamic Glassmorphic UI Dashboard
📁 File Significance & Responsibilities
| File | Type | Significance & Responsibility |
|---|---|---|
[app.py](file:///c:/Users/Aditya%20Verma/OneDrive/Desktop/My%20Work/Weather_App_MCP/app.py) |
Streamlit Frontend Application | Main web interface. Implements the dynamic glassmorphism design system using native st.html(), interactive Plotly 24-hour forecast trends, 7-day extended daily forecast cards, sidebar quick-search city pills, metric/imperial unit toggles, sub-50ms data caching layer (@st.cache_data), and an interactive MCP Protocol Inspector. |
[server.py](file:///c:/Users/Aditya%20Verma/OneDrive/Desktop/My%20Work/Weather_App_MCP/server.py) |
MCP Server Entrypoint | Exposes model tools over Model Context Protocol (MCPServer) stdio IPC transport. Registers @mcp.tool() endpoints: weather, time_info, and geocode. |
[weather.py](file:///c:/Users/Aditya%20Verma/OneDrive/Desktop/My%20Work/Weather_App_MCP/weather.py) |
Weather Processing Engine | Handles asynchronous HTTP GET requests to Open-Meteo REST APIs. Maps WMO weather codes to emojis and categories, converts wind direction degrees to cardinal directions (N/NE/E/SE/S/SW/W/NW), handles unit conversions (°C vs °F, km/h vs mph), and returns structured current, 24-hour hourly, and 7-day daily forecasts. |
[time_service.py](file:///c:/Users/Aditya%20Verma/OneDrive/Desktop/My%20Work/Weather_App_MCP/time_service.py) |
International Time Service | Manages international time and date resolution. Queries the TimeAPI.io REST API and features a native zoneinfo standard library fallback for zero-downtime date/time calculation, UTC offsets (UTC+02:00), timezone abbreviations (CEST), and DST status. |
[client.py](file:///c:/Users/Aditya%20Verma/OneDrive/Desktop/My%20Work/Weather_App_MCP/client.py) |
CLI Testing & Verification | Independent command-line client script that demonstrates full MCP stdio client initialization, protocol handshaking, tool listing, and execution testing via command line arguments. |
[requirements.txt](file:///c:/Users/Aditya%20Verma/OneDrive/Desktop/My%20Work/Weather_App_MCP/requirements.txt) |
Package Manifest | Declares project dependencies: mcp>=1.0.0, httpx>=0.27.0, streamlit>=1.35.0, plotly>=5.20.0, and pandas>=2.0.0. |
✨ Key Features & Capabilities
- Dual MCP Tool Pipeline: Seamlessly orchestrates multiple MCP tools (
weather+time_info+geocode) over JSON-RPC 2.0 standard. - Glassmorphism Aesthetic UI: Custom dynamic background gradients that respond live to weather conditions (Clear Day, Clear Night, Rain, Storm, Cloud, Snow, Fog).
- International Date & Time Comparison: Bottom-right hero badge displaying live formatted date, 12-hour clock time, timezone abbreviation, and UTC offset for instant side-by-side global comparison.
- Interactive 24-Hour Plotly Forecast Chart: Interactive splined temperature curve combined with rain probability bar charts.
- 7-Day Extended Daily Forecast: Card grid displaying daily high/low temperatures, weather icons, and rain accumulation totals.
- Unit Switching: Toggle between Metric (
°C,km/h,mm) and Imperial (°F,mph,in). - 10-Minute Response Caching: Fast
@st.cache_data(ttl=300)caching for instant sub-50ms repeat searches. - Interactive MCP Protocol Inspector: Expanded debug tab showing protocol architecture flow, tool schemas, query latency breakdown, and raw structured JSON responses.
🚀 How to Run
-
Install Dependencies:
pip install -r requirements.txt -
Test MCP Server via CLI:
python client.py "Berlin" -
Launch Web Application:
streamlit run app.py
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。