Weather MCP Server
Connects a Google Gemini agent to a weather MCP server, enabling natural-language queries about weather data through tool calls.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Weather MCP ServerWhat's the weather in Tokyo, Japan right now?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Weather Demo
A demo-ready Model Context Protocol (MCP) project that connects a Google Gemini agent to a weather MCP server. The agent discovers weather tools automatically and answers natural-language questions using live data from the free wttr.in API — no weather API key required.
What This Demo Shows
MCP Server (
server.py) — exposes 4 weather tools (current weather, daily/hourly forecasts, city comparison).MCP Client (
client.py) — a Gemini-powered agent that calls those tools and summarizes results in plain English.Flexible transport — switch between HTTP (default) and stdio via
.env.Clean configuration — secrets in
.env, dependencies inrequirements.txt.
Related MCP server: Weather MCP Server
Architecture / Pseudo-flow
flowchart LR
User -->|prompt| Client
Client -->|generate_content tools=[session]| Gemini
Gemini -->|tool call| Client
Client -->|MCP call_tool| Server
Server -->|HTTP| WTTR
WTTR --> Server --> Client --> Gemini
Gemini -->|final answer| UserRequest lifecycle:
You type a question in the client REPL.
The client sends your prompt to Google Gemini along with the live MCP session as a tool.
Gemini decides which weather tool(s) to call.
The client forwards tool calls to the MCP server over HTTP or stdio.
The server fetches data from wttr.in and returns structured JSON.
Gemini synthesizes a natural-language answer and prints it back to you.
Project Structure
MCP/
├── client.py # Gemini agent + MCP client (interactive REPL)
├── server.py # MCP server with weather tools
├── weather_api.py # wttr.in API wrapper (no API key needed)
├── requirements.txt # Python dependencies
├── .env.example # Environment variable template
├── .gitignore
└── README.mdPrerequisites
Python 3.10+
A Google Gemini API key (free tier available at Google AI Studio)
Setup
1. Create a virtual environment
cd MCP
python -m venv .venv
.venv\Scripts\activate2. Install dependencies
pip install -r requirements.txt3. Configure environment variables
copy .env.example .envEdit .env and set your Gemini API key:
GEMINI_API_KEY=your_actual_api_key_here
GEMINI_MODEL=gemini-2.5-flash
MCP_TRANSPORT=http
MCP_HTTP_HOST=127.0.0.1
MCP_HTTP_PORT=8000
MCP_HTTP_PATH=/mcpVariable | Description | Default |
| Google Gemini API key (required) | — |
| Gemini model name |
|
|
|
|
| HTTP server bind address |
|
| HTTP server port |
|
| MCP HTTP endpoint path |
|
Running the Demo
Option A — HTTP mode (default, two terminals)
Terminal 1 — start the MCP server:
python server.pyYou should see:
[Weather MCP Server] Starting with HTTP transport at http://127.0.0.1:8000/mcpTerminal 2 — start the Gemini client:
python client.pyOption B — stdio mode (single terminal)
Set in .env:
MCP_TRANSPORT=stdioThen run only the client (it launches the server as a subprocess):
python client.pyExample Prompts
Try these once the client is running:
What's the weather in Tokyo, Japan right now?Compare the weather between Mumbai, India and London, UK.Will it rain in Paris in the next 12 hours?Give me a 3-day forecast for New York, US.
Type quit or exit to leave the REPL.
Available MCP Tools
Tool | Description |
| Current temperature, humidity, wind, conditions |
| Daily min/max temps (up to 3 days) |
| 3-hourly forecast slots (up to 24 slots / 3 days) |
| Side-by-side current weather for two cities |
wttr.in Limitations
No API key required — free for non-commercial use.
Daily forecast: up to 3 days.
Hourly forecast: 3-hourly intervals (8 slots per day).
Requires a
curl-style User-Agent (handled automatically inweather_api.py).For best location accuracy, use "City, Country" format (e.g.
Tokyo, Japan) orCity@cc(e.g.London@uk).
Troubleshooting
Issue | Fix |
| Copy |
Client can't connect (HTTP mode) | Make sure |
| Try a more specific name, e.g. "Paris, France" |
wttr.in timeout | Check internet connection; wttr.in may be temporarily slow |
Port already in use | Change |
Gemini model error | Try |
License
Demo code — free to use and share.
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/nishantwebdev/python-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server