Skip to main content
Glama

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.


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


-
security - not tested
F
license - not found
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

A lightweight server that exposes weather-related tools (get_coordinates and get_forecast) using the Modular Command Protocol, designed for integration with AI agents and LLMs.

  1. 🧠 What Is MCP?
    1. 📁 Project Structure
      1. 🚀 Getting Started
        1. 1. Clone the Repo
        2. 3. Run the Server
      2. 🔧 Tools Overview
        1. get_coordinates(city: str) -> Tuple\[float, float]
        2. get_forecast(latitude: float, longitude: float) -> str
        3. format_forecast(forecasts: List\[Dict]) -> str
      3. 🧩 Want to Build an MCP Client?
        1. 🧠 Use Cases
          1. 📌 License
            1. 👋 Contributing
              1. 🔗 Related

                Related MCP Servers

                • -
                  security
                  F
                  license
                  -
                  quality
                  A collection of lightweight servers that expose weather and financial capabilities through the Model Context Protocol, allowing users to access weather alerts, forecasts, and financial market data with technical analysis.
                  Last updated -
                  2
                  Python
                • A
                  security
                  F
                  license
                  A
                  quality
                  A Model Context Protocol server that provides real-time weather information and 5-day forecasts to AI assistants, supporting multiple languages and flexible units.
                  Last updated -
                  3
                  4
                  TypeScript
                • A
                  security
                  A
                  license
                  A
                  quality
                  A Model Context Protocol server that provides comprehensive weather data and forecasts through the OpenWeatherMap API, enabling AI assistants to access real-time weather information, forecasts, air quality data, and location services.
                  Last updated -
                  11
                  10
                  JavaScript
                  MIT License
                • -
                  security
                  F
                  license
                  -
                  quality
                  A modular server based on Model Context Protocol (MCP) that provides weather queries, mathematical calculations, and search functionalities.
                  Last updated -
                  TypeScript

                View all related MCP servers

                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/jeannassereldine/mcp-server'

                If you have feedback or need assistance with the MCP directory API, please join our Discord server