weather-server
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., "@weather-serverWhat's the weather in Tokyo and the 3-day forecast?"
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.
Model Context Protocol (MCP) - Weather Tool Server & Agent Interoperability
An implementation of Anthropic's Model Context Protocol (MCP) using the Python MCP SDK. This repository demonstrates how to standardize communication between an AI agent and external tools, separating tool execution from agent logic for true cross-framework interoperability.
š Overview
The Model Context Protocol (MCP) defines an open standard for AI models to discover and call tools, read data resources, and utilize prompt templates over a unified interface (using JSON-RPC 2.0).
This project implements:
Custom MCP Server (
weather_server.py): Exposesget_weatherandget_forecastover standard input/output (stdio).MCP Client (
mcp_client.py): Demonstrates protocol initialization, dynamic tool discovery (list_tools), and structured tool calls (call_tool).Interoperability Demo (
mcp_client_interop.py): Demonstrates how multiple distinct agent client implementations consume the exact same MCP tool server without modifying server-side code.Complete Experiment Report (
experiment_report.md): Comprehensive lab documentation with JSON-RPC payload breakdowns.
Related MCP server: weather-mcp-server
š Repository Structure
.
āāā weather_server.py # MCP Tool Server implementation
āāā mcp_client.py # Standard async MCP Client
āāā mcp_client_interop.py # Multi-agent framework interoperability test
āāā requirements.txt # Dependencies (mcp SDK)
āāā experiment_report.md # Detailed experiment writeup & JSON-RPC spec
āāā README.md # Project documentationš Getting Started
Prerequisites
Python 3.10 or higher
pippackage manager
1. Installation
Clone the repository and install the dependencies:
git clone https://github.com/your-username/mcp-weather-server.git
cd mcp-weather-server
pip install -r requirements.txtš ļø Usage
Run Primary MCP Client & Server Interaction
Executes the client, spawns weather_server.py via stdio, initializes the session, discovers tools, and invokes get_weather for Mumbai and get_forecast for Chennai:
python mcp_client.pyExpected Output:
==================================================
Model Context Protocol (MCP) Client Initializing
==================================================
[Transport] Connecting via Stdio: python weather_server.py
[Step 1] Initializing MCP Session...
-> Connected to Server: weather-server v0.1.0
-> Server Protocol Version: 2025-06-18
[Step 2] Executing list_tools() Request...
-> Discovered 2 tool(s):
- Tool Name: get_weather
- Tool Name: get_forecast
[Step 3] Executing call_tool('get_weather', city='Mumbai')...
-> Response received from server:
[TextContent]: Mumbai: 28 deg C, Partly Cloudy, Humidity 65%
[Step 4] Executing call_tool('get_forecast', city='Chennai')...
-> Response received from server:
[TextContent]: Chennai 3-day: Day1: 28C Sunny | Day2: 25C Rainy | Day3: 30C SunnyRun Interoperability Test
Demonstrates two different simulated agent frameworks executing against the same MCP tool server without code modifications:
python mcp_client_interop.pyš Connecting to Claude Desktop
You can easily plug this weather_server.py into Claude Desktop:
Open your Claude Desktop configuration file:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Add your server under
mcpServers:
{
"mcpServers": {
"weather": {
"command": "python",
"args": [
"C:/path/to/repository/weather_server.py"
]
}
}
}Restart Claude Desktop. You will now see the
get_weatherandget_forecasttools available directly in your chat interface!
š Protocol Flow Breakdown (JSON-RPC 2.0)
1. Initialization (initialize)
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-06-18",
"clientInfo": { "name": "mcp-python-sdk", "version": "1.19.0" }
}
}2. Tool Discovery (tools/list)
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list"
}3. Tool Invocation (tools/call)
{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "get_weather",
"arguments": { "city": "Mumbai" }
}
}š License
Distributed under the MIT License. See LICENSE for details.
This server cannot be deployed
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.
Weather, code search, currency & Solana trust scoring as MCP tools. Free, no API key needed.
MCP server for weather with reasoning ā umbrella advice, outdoor checks, city comparisons.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to retrieve live weather updates for any city via OpenWeatherMap, wrapped in MCP format.1-
- AlicenseAqualityDmaintenanceProvides real-time weather and forecast data via MCP tools, enabling AI agents to query current weather and up to 3-day forecasts for any city.3MIT
- AlicenseAqualityBmaintenanceMCP server that provides current weather for any city using Open-Meteo APIs. It exposes a single tool 'get_weather' returning temperature, humidity, wind, and other weather data.18 npmMIT
- FlicenseAqualityCmaintenanceProvides current weather data for any city using the Open-Meteo API, exposed as an MCP tool for integration with MCP clients.1-