Skip to main content
Glama
MCP Weather Server

MCP Weather Server

🌦️ 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-server

3. Run the Server

uv run weather.py

This 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.


Available Tools

2 tools
get_coordinatesC
Returns the latitude and longitude of the specified city as a tuple.
 Args:
    city: the city of 

Inputs: city (required). Returns: result

get_forecastC

Get weather forecast for a location. Args: latitude: Latitude of the location longitude: Longitude of the location

Inputs: latitude (required), longitude (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 2 tools

    Disambiguation5/5

    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.

    Naming Consistency5/5

    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.

    Tool Count2/5

    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.

    Completeness2/5

    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.

    Related MCP Connectors

    Related MCP Servers