MCP Weather Server
Suggested as a replacement for the hardcoded geolocation functionality to get real coordinates for cities via the Google Maps API
Allows exposing the weather tools to LangChain agents for building workflows that can access location and weather data
Enables exposing the weather tools to OpenAI function-calling agents to incorporate weather data into conversations and decision-making
Click on "Deploy 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., "@MCP Weather Serverget the weather forecast for New York City"
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 Server
A simple and modular MCP (Modular Command Protocol) server that exposes weather-related tools β perfect for integration with AI agents, LLMs, or any tool-using client.
This project demonstrates how to create and serve tools such as:
get_coordinates(city)get_forecast(latitude, longitude)
Designed to be lightweight, clean, and easy to extend.
π§ What Is MCP?
MCP (Modular Command Protocol) is a protocol for exposing tools (Python functions) in a machine-readable format so they can be:
Automatically discovered
Dynamically called by AI agents
Interoperable across systems
Itβs built for tool-using LLMs, agents, and next-gen integrations.
Related MCP server: ai-mcp
π Project Structure
mcp-server/
βββ main.py # Starts the FastMCP server
βββ tools
|------ get_forcast.py # MCP tools: get_coordinates and get_forecast
βββ pyproject.toml # Python dependencies
βββ README.md # You're here!π Getting Started
1. Clone the Repo
git clone https://github.com/jeannassereldine/mcp-server.git
cd mcp-server3. Run the Server
uv run weather.pyThis starts the MCP server over stdio. You can connect any MCP client that supports the protocol.
π§ Tools Overview
get_coordinates(city: str) -> Tuple[float, float]
Returns hardcoded latitude and longitude for a given city.
β Replace this with a real geolocation API like OpenCage or Google Maps.
get_forecast(latitude: float, longitude: float) -> str
Returns a formatted weather forecast string for the given coordinates.
β Replace with a live weather API like api.weather.gov.
format_forecast(forecasts: List[Dict]) -> str
Helper function that formats multiple forecast entries into a readable string.
π§© Want to Build an MCP Client?
Stay tuned! The next part of this project will include a lightweight client that can:
Auto-discover tools
Call them based on context
Build real-time agent workflows
π§ Use Cases
Build agent backends with clean, callable tools
Expose local or cloud-based APIs to LLMs
Prototype tools for LangChain or OpenAI function-calling agents
Teach MCP integration through a practical example
π License
This project is open-source under the MIT License.
π Contributing
Pull requests are welcome! Feel free to open issues or suggest features you'd like to see.
π Related
Available Tools
2 toolsget_coordinatesC
Returns the latitude and longitude of the specified city as a tuple.
Args:
city: the city of
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. While it states the return format (tuple), it doesn't mention error conditions, rate limits, authentication requirements, or what happens with invalid city names. For a tool with no annotation coverage, this leaves significant behavioral gaps.
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 brief but poorly structured. The first sentence is clear, but the 'Args:' section is incomplete ('the city of' ends abruptly). While it's concise, the incomplete sentence undermines its effectiveness. Every sentence should earn its place, and the incomplete second sentence doesn't.
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 tool's simplicity (one parameter) and the presence of an output schema, the description is somewhat complete but has gaps. The output schema existence means the description doesn't need to explain return values in detail, but it should still cover behavioral aspects. With no annotations and minimal parameter documentation, it's adequate but with clear room for improvement.
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 description adds minimal parameter semantics beyond what the schema provides. It mentions 'city: the city of' but this is incomplete and adds little value. With 0% schema description coverage and only one parameter, the baseline would be 4 for zero parameters, but here we have one undocumented parameter. The description doesn't compensate for the coverage gap.
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: 'Returns the latitude and longitude of the specified city as a tuple.' This is a specific verb (returns) + resource (latitude and longitude) combination. However, it doesn't distinguish this tool from its sibling 'get_forecast' - both likely involve geographic data but serve different purposes.
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 about when to use this tool versus alternatives. There's no mention of the sibling tool 'get_forecast' or any context about when coordinate retrieval is appropriate versus weather forecasting. The description only states what the tool does, not when to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_forecastC
Get weather forecast for a location. Args: latitude: Latitude of the location longitude: Longitude of the location
| Name | Required | Description | Default |
|---|---|---|---|
| latitude | Yes | ||
| longitude | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't describe important behavioral aspects: whether this is a read-only operation, what data format is returned, if there are rate limits, authentication requirements, or error conditions. The description is minimal and lacks operational context.
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 appropriately concise with a clear purpose statement followed by parameter documentation. The two-sentence structure is efficient with no wasted words. However, the 'Args:' formatting is slightly redundant since parameters are already documented in the schema, preventing a perfect score.
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 tool has an output schema (which handles return values) and simple parameters, the description is minimally adequate. However, for a weather forecasting tool with no annotations, users would benefit from more context about forecast type, time horizon, data sources, or common use cases. The description meets basic requirements but leaves important questions unanswered.
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 0%, so the description must compensate. It explicitly lists both parameters (latitude, longitude) and their purpose ('of the location'), which adds value beyond the bare schema. However, it doesn't provide format details (e.g., decimal degrees), valid ranges, or examples. The baseline would be lower without this parameter listing.
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 'Get weather forecast for a location' - a specific verb ('Get') and resource ('weather forecast'). It distinguishes from the sibling tool 'get_coordinates' by focusing on forecast rather than location data. However, it doesn't specify what type of forecast (e.g., daily, hourly, current) or time range, keeping it from a perfect score.
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. It doesn't mention the sibling tool 'get_coordinates' or suggest when one might be preferred over the other (e.g., use get_coordinates first to obtain coordinates, then get_forecast). There's no context about prerequisites or limitations.
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.
2 tool updates
- First observed
get_coordinates - First observed
get_forecast
TDQS
Scored across 2 tools
The two tools have completely distinct purposes: get_coordinates converts a city name to geographic coordinates, while get_forecast provides weather data for given coordinates. There is no overlap or ambiguity between these functions.
Both tools follow a consistent 'verb_noun' naming pattern (get_coordinates, get_forecast) with identical verb style and snake_case convention throughout. The naming is perfectly uniform and predictable.
With only 2 tools, this server feels severely under-scoped for a weather domain. A weather server should typically include current conditions, forecasts, historical data, alerts, and multiple location input methods. Two tools cannot provide meaningful coverage.
The tool surface is severely incomplete for a weather server. Missing essential operations like getting current weather conditions, temperature data, precipitation forecasts, weather alerts, or supporting direct city name input for forecasts. The workflow requires manual coordinate lookup before getting forecasts, creating unnecessary friction.
Maintenance
Related MCP Connectors
The official Model Context Protocol server for Ambee. It gives any MCP-compatible AI assistant β Claude, ChatGPT, Cursor, VS Code, Ollama, and more direct access to live air quality, pollen, and weather data. To get started, including information on signing up and obtaining your Ambee key, check out the Ambee documentation on https://docs.ambeedata.com
Hosted MCP server for Xweather weather data: conditions, forecasts, alerts, and more.
Nifty's MCP server β exposes tasks, projects, messages, and files as tools for AI agents.
MCP server exposing the Backtest360 engine API as tools for AI agents.
Related MCP Servers
- FlicenseBqualityDmaintenanceA Model Context Protocol compatible server that provides weather information for any city using Ollama's LLM capabilities through an exposed get-weather tool.1-
- FlicenseAqualityDmaintenanceLightweight MCP server that exposes tools for system information and weather lookup, designed for agent integration via stdio.1-
- FlicenseNot gradedqualityDmaintenanceA lightweight Model Context Protocol (MCP) server that gives AI assistants the ability to fetch real-time weather data for any city using the OpenWeatherMap API.1-
- FlicenseBqualityDmaintenanceA minimal MCP server using FastMCP to demonstrate tool creation, including a get_weather example.1-