MCP Weather Server — Demo

MCP Weather Server — Demo

Demo MCP server that provides weather data for cities, with tools to get weather and list available cities.

Category
Visit Server

README

MCP Weather Server — Demo

Demo project from the YouTube video: "What is MCP? Model Context Protocol Explained (2026)"

<div align="center"> <h3>MCP Tutorial: Connect Claude to Any Tool (2026)</h3> <a href="https://www.youtube.com/watch?v=40k3SIwlFVM"> <img src="https://img.youtube.com/vi/40k3SIwlFVM/maxresdefault.jpg" alt="Watch the MCP Tutorial" style="width:100%; max-width:600px;"> </a> <p><i>Click the image to watch the MCP guide on YouTube</i></p> </div>

This is a minimal Model Context Protocol (MCP) server written in Python. It exposes two tools that an AI assistant can call:

Tool Description
get_weather Returns weather data for a given city
list_cities Lists all cities with available data

Prerequisites

  • Python 3.10 or higher
  • pip

Setup & Run

# 1. Clone or download this folder
cd demo/

# 2. (Optional) Create a virtual environment
python -m venv .venv
source .venv/bin/activate        # macOS / Linux
.venv\Scripts\activate           # Windows

# 3. Install the MCP SDK
pip install -r requirements.txt

# 4. Run the server
python weather_server.py

The server starts and listens on stdio — it's ready for an MCP host (like Claude Desktop or a custom client) to connect.


Connect to Claude Desktop

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "weather": {
      "command": "python",
      "args": ["/full/path/to/demo/weather_server.py"]
    }
  }
}

Restart Claude Desktop. Then ask it:

"What's the weather in Tokyo?"

Claude will automatically call the get_weather tool and return:

🌍 Weather in Tokyo:
🌡️  Temperature: 18°C
☁️  Condition:   Clear
💧 Humidity:    55%
💨 Wind:        10 km/h NE

Extend to a Real Weather API

Replace the WEATHER_DATA dict with a live API call:

import httpx

async def fetch_live_weather(city: str) -> dict:
    url = f"https://api.openweathermap.org/data/2.5/weather"
    params = {"q": city, "appid": "YOUR_API_KEY", "units": "metric"}
    async with httpx.AsyncClient() as client:
        resp = await client.get(url, params=params)
        data = resp.json()
        return {
            "temp": data["main"]["temp"],
            "condition": data["weather"][0]["description"].title(),
            "humidity": data["main"]["humidity"],
            "wind": f"{data['wind']['speed']} m/s"
        }

Project Structure

demo/
├── weather_server.py   # MCP server — all logic here
├── requirements.txt    # pip install mcp
└── README.md           # This file

How MCP Works (Quick Recap)

Claude Desktop (Host)
    └── MCP Client (built into host)
            └── MCP Protocol (JSON-RPC 2.0 over stdio)
                    └── weather_server.py (YOUR server)
                            └── Returns weather data

The AI model never calls your server directly — the MCP client handles discovery, schema validation, and communication. You just implement the logic.


Next Steps

  • Add more tools: get_forecast, get_air_quality
  • Switch transport from stdio to HTTP + SSE for a remote server
  • Publish your server to the MCP community registry

Official MCP Resources

📖 Documentation

Resource Link
Official Docs https://modelcontextprotocol.io/docs
Getting Started https://modelcontextprotocol.io/introduction
All Examples https://modelcontextprotocol.io/examples
GitHub Organization https://github.com/modelcontextprotocol
All Official Servers https://github.com/modelcontextprotocol/servers

🔌 Official MCP Server Examples (from the video)

These are production-ready servers maintained by Anthropic — install and use them today:

Server What it does GitHub
🐙 GitHub Browse repos, read files, manage PRs and issues via AI https://github.com/modelcontextprotocol/servers/tree/main/src/github
🗄️ PostgreSQL Query your database with natural language https://github.com/modelcontextprotocol/servers/tree/main/src/postgres
📁 Filesystem Read and write local files directly from AI https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem
🔍 Brave Search Real-time web search inside any AI chat https://github.com/modelcontextprotocol/servers/tree/main/src/brave-search
💬 Slack Read channels, summarize threads, post messages https://github.com/modelcontextprotocol/servers/tree/main/src/slack
🧠 Memory Persistent AI memory via a knowledge graph https://github.com/modelcontextprotocol/servers/tree/main/src/memory

📦 SDKs

Language Install GitHub
Python pip install mcp https://github.com/modelcontextprotocol/python-sdk
TypeScript / Node.js npm install @modelcontextprotocol/sdk https://github.com/modelcontextprotocol/typescript-sdk

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