MCP Weather Server

MCP Weather Server

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.

Category
Visit Server

README

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


🔗 Related

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured