Weather MCP Server
The Weather MCP Server allows AI assistants to fetch and manage weather data through the standardized Model Context Protocol (MCP).
Get Real-Time Weather: Fetch current weather conditions for any location, optionally including air quality data
Weather Forecasts: Retrieve weather predictions for 1 to 14 days ahead for any specified location
Location Search: Find and validate locations using city names, coordinates, or postal codes
MCP Communication: Integrates directly with AI assistants via stdin/stdout protocol communication
Debug Logging: Provides comprehensive logging for troubleshooting and development
Error Handling: Gracefully manages common issues like invalid API keys or location errors
Provides Docker support for containerizing the weather MCP server, allowing it to be run in isolation with the required environment variables
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 forecast for Tokyo this weekend?"
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.
Weather MCP Server
A Model Context Protocol (MCP) server that provides weather information using the WeatherAPI service. This server enables AI assistants to fetch current weather, forecasts, and search for locations through stdio communication.
Features
Current Weather: Get real-time weather conditions for any location
Weather Forecast: Retrieve weather forecasts up to 14 days ahead
Location Search: Find and validate location names
Air Quality Data: Optional air quality information
Debug Logging: Comprehensive logging for troubleshooting
Stdio Communication: Direct MCP protocol communication via stdin/stdout
Related MCP server: MCP Weather Server
Prerequisites
Python 3.13+
uv package manager
WeatherAPI account and API key
Installation
Option 1: Via Smithery (Recommended)
Install automatically via Smithery MCP registry:
npx -y @smithery/cli install weather-mcp-server --client claudeOr for other MCP clients:
npx -y @smithery/cli install weather-mcp-serverThis will automatically:
Install the weather MCP server
Add it to your MCP client configuration
Prompt you for your WeatherAPI key
Option 2: Manual Installation
Clone or download this repository
Get a WeatherAPI key:
Sign up at https://www.weatherapi.com
Get your free API key from the dashboard
⚠️ Keep your API key secure - never commit it to version control
Install dependencies:
uv sync
Configuration
Environment Variables
Set your WeatherAPI key:
export WEATHER_API_KEY=your_api_key_hereOptional - Enable debug logging:
export DEBUG=trueMCP Client Configuration
Add this server to your MCP client configuration (e.g., config.json):
{
"mcpServers": {
"weather": {
"command": "uv",
"args": [
"--directory",
"/path/to/weather-mcp-server",
"run",
"server.py"
],
"env": {
"WEATHER_API_KEY": "your_api_key_here"
}
}
}
}To enable debug logging, add the DEBUG environment variable:
{
"mcpServers": {
"weather": {
"command": "uv",
"args": [
"--directory",
"/path/to/weather-mcp-server",
"run",
"server.py"
],
"env": {
"WEATHER_API_KEY": "your_api_key_here",
"DEBUG": "true"
}
}
}
}Usage
Running the Server
Direct execution:
WEATHER_API_KEY=your_api_key uv run server.pyWith debug logging:
DEBUG=true WEATHER_API_KEY=your_api_key uv run server.pyWith MCP client: The server automatically starts when your MCP client (like mcphost or Claude Desktop) connects to it.
Available Tools
1. weather_current
Get current weather conditions for a location.
Parameters:
q(required): Location query (city name, coordinates, postal code)aqi(optional): Include air quality data ("yes" or "no", default: "no")
Example:
{
"name": "weather_current",
"arguments": {
"q": "New York, NY",
"aqi": "yes"
}
}2. weather_forecast
Get weather forecast for 1-14 days.
Parameters:
q(required): Location querydays(optional): Number of forecast days (1-14, default: 1)
Example:
{
"name": "weather_forecast",
"arguments": {
"q": "London, UK",
"days": 7
}
}3. weather_search
Search for locations matching a query.
Parameters:
q(required): Search query
Example:
{
"name": "weather_search",
"arguments": {
"q": "Paris"
}
}Location Query Formats
The weather tools accept various location formats:
City name: "New York", "London"
City and state/country: "New York, NY", "London, UK"
Coordinates: "40.7128,-74.0060"
Postal code: "10001", "SW1A 1AA"
Airport code: "JFK", "LHR"
Testing
Manual Testing
Test the server with JSON-RPC requests:
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}' | WEATHER_API_KEY=your_api_key uv run server.pyWith debug logging:
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}' | DEBUG=true WEATHER_API_KEY=your_api_key uv run server.pyTool Testing
Test a weather tool:
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"weather_current","arguments":{"q":"New York"}}}' | WEATHER_API_KEY=your_api_key uv run server.pyDocker Support
Building the Image
docker build -t weather-mcp-server .Running with Docker
docker run --rm -i -e WEATHER_API_KEY=your_api_key weather-mcp-serverDebug Mode
The server includes optional debug logging. Set the DEBUG environment variable to enable detailed logging.
Log levels:
INFO: Basic server operations (default)DEBUG: Detailed request/response information, API calls (when DEBUG=true)
Error Handling
The server handles common errors gracefully:
Invalid API key: Returns error message with guidance
Location not found: Suggests alternative search terms
Network issues: Provides retry suggestions
Rate limiting: Indicates when limits are exceeded
Dependencies
httpx: HTTP client for API requestsasyncio: Async/await supportStandard library:
json,logging,sys,os
API Limits
WeatherAPI free tier includes:
1 million calls per month
Current weather and 3-day forecast
Upgrade for extended forecasts and higher limits
Troubleshooting
Common Issues
"No content response received"
Check API key is set correctly
Verify network connectivity
Review debug logs for errors
"API key not provided"
Set the
WEATHER_API_KEYenvironment variableCheck the MCP client configuration
"Location not found"
Try different location formats
Use the weather_search tool to find valid locations
Debug Output
Enable detailed logging by setting the DEBUG environment variable:
DEBUG=true WEATHER_API_KEY=your_api_key uv run server.py 2>&1 | grep -E "(DEBUG|ERROR)"Architecture
This server implements the MCP protocol using:
stdio communication: Direct JSON-RPC over stdin/stdout
Asyncio event loop: Non-blocking request handling
Manual JSON-RPC: Custom implementation for precise control
WeatherAPI integration: RESTful API calls with error handling
Contributing
Fork the repository
Create a feature branch
Make your changes
Test thoroughly
Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
WeatherAPI Documentation: https://www.weatherapi.com/docs/
MCP Specification: https://spec.modelcontextprotocol.io/
Issues: Report bugs and feature requests in the repository issues
Last updated: July 12, 2025
Available Tools
3 toolsweather_currentC
Get current weather for a location
| Name | Required | Description | Default |
|---|---|---|---|
| q | Yes | Location query (city name, lat/lon, postal code, etc) | |
| aqi | No | Include air quality data ('yes' or 'no') | no |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool's function but does not cover important aspects such as rate limits, authentication needs, error handling, or response format. This leaves significant gaps in understanding how the tool behaves beyond its basic purpose.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise and front-loaded, consisting of a single sentence that directly states the tool's purpose. There is no wasted language, making it efficient and easy to parse for an AI agent.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of annotations and output schema, the description is incomplete. It does not address behavioral traits, response format, or usage context, which are crucial for a tool with parameters and no structured output information. This leaves the agent with insufficient information to fully understand the tool's operation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, clearly documenting both parameters ('q' for location query and 'aqi' for air quality data). The description does not add any additional meaning beyond what the schema provides, so it meets the baseline score of 3 for adequate but not enhanced parameter semantics.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with a specific verb ('Get') and resource ('current weather for a location'), making it easy to understand what it does. However, it does not explicitly differentiate itself from sibling tools like 'weather_forecast' or 'weather_search', which might offer similar weather-related functionality.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'weather_forecast' or 'weather_search'. It lacks context about use cases, exclusions, or prerequisites, leaving the agent to infer usage based on the tool name alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
weather_forecastC
Get weather forecast (1-14 days) for a location
| Name | Required | Description | Default |
|---|---|---|---|
| q | Yes | Location query (city name, lat/lon, postal code, etc) | |
| days | No | Number of days (1-14) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but lacks critical behavioral details such as rate limits, authentication requirements, error handling, or response format. For a tool with no annotation coverage, this is a significant gap in transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the core functionality ('Get weather forecast') and includes key constraints (1-14 days, for a location) without any wasted words. It's appropriately sized for the tool's complexity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of annotations and output schema, the description is incomplete. It doesn't address behavioral aspects like rate limits or auth, and while the input schema is well-documented, the description fails to compensate for missing context about what the forecast returns (e.g., temperature, precipitation) or how errors are handled.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 100%, so the input schema already fully documents both parameters (q and days). The description adds minimal value beyond the schema by implying the tool uses location queries and a day range, but doesn't provide additional syntax, format details, or usage examples. This meets the baseline for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with a specific verb ('Get') and resource ('weather forecast'), and includes the time range (1-14 days) and target ('for a location'). However, it doesn't explicitly differentiate from its sibling tools (weather_current and weather_search), which would require mentioning it provides future predictions rather than current conditions or search functionality.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus its siblings (weather_current and weather_search). It doesn't mention alternatives, exclusions, or specific contexts for use, leaving the agent to infer based on tool names alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
weather_searchC
Search for locations matching query
| Name | Required | Description | Default |
|---|---|---|---|
| q | Yes | Location query |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It doesn't disclose behavioral traits such as whether this is a read-only operation, if it requires authentication, rate limits, or what the output format might be (e.g., list of locations with IDs/names). The description is minimal and lacks essential context for safe and effective use.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is very concise with a single sentence 'Search for locations matching query', which is front-loaded and wastes no words. However, it might be overly terse given the lack of context, but it earns points for being direct and structured efficiently.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no annotations, no output schema, and sibling tools present, the description is incomplete. It doesn't explain how this tool fits into the weather context (e.g., is it a prerequisite for other tools?), what the return values are, or any error conditions. For a tool with potential complexity in a weather server, more context is needed.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, with parameter 'q' described as 'Location query'. The description adds no additional meaning beyond this, as it essentially restates the schema. With high schema coverage, the baseline is 3, and the description doesn't compensate with extra details like query format examples or constraints.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description 'Search for locations matching query' states a clear action (search) and target (locations), but it's vague about what kind of locations (weather-related?) and doesn't distinguish from siblings like 'weather_current' or 'weather_forecast'. It provides basic purpose but lacks specificity and differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool vs. alternatives like 'weather_current' or 'weather_forecast'. The description implies it's for searching locations, but doesn't specify if this is for finding locations to then get weather data, or if it's a standalone search. No explicit when/when-not or alternative usage is mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
3 tool updates
- First observed
weather_current - First observed
weather_forecast - First observed
weather_search
TDQS
Each tool has a clearly distinct purpose: weather_current retrieves current conditions, weather_forecast provides future predictions, and weather_search finds locations. There is no overlap in functionality, making tool selection straightforward for an agent.
All tools follow a consistent 'weather_' prefix pattern with descriptive suffixes (current, forecast, search). This uniform naming convention makes the tool set predictable and easy to understand.
With 3 tools, the server is well-scoped for a weather service, covering core needs: current conditions, forecasts, and location lookup. Each tool earns its place without being excessive or insufficient.
The tool set covers essential weather operations for a typical agent, including current data, forecasts, and location search. A minor gap might be historical weather data, but core workflows are well-supported without dead ends.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Hosted MCP server for Xweather weather data: conditions, forecasts, alerts, and more.
1WeatherAPI.com MCP — wraps WeatherAPI.com (api.weatherapi.com)
Related MCP Servers
- AlicenseBqualityDmaintenanceA simple server that implements the Model Context Protocol, allowing AI models like Claude to fetch real-time weather information for any location using the wttr.in API.4221MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that provides real-time weather information and 5-day forecasts to AI assistants, supporting multiple languages and flexible units.322MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables users to fetch weather forecasts through Cursor AI by using natural language queries.MIT
- AlicenseBqualityDmaintenanceA simple Model Context Protocol server that provides real-time weather data to AI agents like GitHub Copilot, allowing users to get current weather information for any city through natural language queries.23297MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- 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/first-it-consulting/weather-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server